Amsterdam Compiler Kit for BBC Micro

Discussion of development of software for any "obsolete" computer or video game system. See the WSdev wiki and ObscureDev wiki for more information on certain platforms.
Post Reply
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Amsterdam Compiler Kit for BBC Micro

Post by tepples »

Today I learned that the Amsterdam Compiler Kit claims to support the BBC Micro's 6502 CPU as a target. I have two questions. First, if anybody has used it with 6502, is the quality of its generated code any good? Second, this appears to be the same as the Vrije Universiteit Compiler Kit (VUCK) whose non-free license prompted the development of GCC, but I'm not sure whether I'm right. (The ACK was originally non-free but became free software in 2004.)
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Amsterdam Compiler Kit for BBC Micro

Post by Bregalad »

I remember that I attempted it, but weren't able to make it function. I don't remember the details though.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Amsterdam Compiler Kit for BBC Micro

Post by tepples »

Anyone tried ACK in the past 4 and a half years? It appears to have since added 8080 and Z80, and if anyone can get that working, it might help with a Game Boy and Game Gear target to rival SDCC.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: Amsterdam Compiler Kit for BBC Micro

Post by Oziphantom »

So there is a modern updated version by david green, which runs on normal linux.

Source file

Code: Select all

#include <stdio.h>

int someFunc(int a) {
    printf("step %d\n", a);
}

int main(int argc, char* argv[]) {
	int i;
	for(i = 0 ; i< 20 ; ++i ) {
		someFunc(i);
	}
}
yields with -O6

Code: Select all

; z80dasm 1.1.5
; command line: z80dasm -a -l -o test.s test.com

	org	00100h

	ld l,073h		;0100
	ld h,l			;0102
	ld h,e			;0103
	ld (hl),h			;0104
	jr nz,l0135h		;0105
	ld (hl),h			;0107
	ld h,l			;0108
	ld a,b			;0109
	ld (hl),h			;010a
	dec sp			;010b
	jr nz,l013ch		;010c
	ld (hl),e			;010e
	ld h,l			;010f
	ld h,e			;0110
	ld (hl),h			;0111
	jr nz,l0142h		;0112
	ld (hl),d			;0114
	ld l,a			;0115
	ld l,l			;0116
	dec sp			;0117
	jr nz,l0148h		;0118
	ld (hl),e			;011a
	ld h,l			;011b
	ld h,e			;011c
	ld (hl),h			;011d
	jr nz,l014eh		;011e
	ld h,h			;0120
	ld h,c			;0121
	ld (hl),h			;0122
	ld h,c			;0123
	dec sp			;0124
	jr nz,l0155h		;0125
	ld (hl),e			;0127
	ld h,l			;0128
	ld h,e			;0129
	ld (hl),h			;012a
	jr nz,l015bh		;012b
	ld h,d			;012d
	ld (hl),e			;012e
	ld (hl),e			;012f
	ld a,(bc)			;0130
	ld l,065h		;0131
	ld a,b			;0133
	ld (hl),h			;0134
l0135h:
	ld h,l			;0135
	ld (hl),d			;0136
	ld l,(hl)			;0137
	jr nz,l0199h		;0138
	ld (hl),e			;013a
	ld l,a			;013b
l013ch:
	ld l,l			;013c
	ld h,l			;013d
	ld b,(hl)			;013e
	ld (hl),l			;013f
	ld l,(hl)			;0140
	ld h,e			;0141
l0142h:
	ld a,(bc)			;0142
	ld l,073h		;0143
	ld h,l			;0145
	ld h,e			;0146
	ld (hl),h			;0147
l0148h:
	jr nz,l0178h		;0148
	ld (hl),h			;014a
	ld h,l			;014b
	ld a,b			;014c
	ld (hl),h			;014d
l014eh:
	ld a,(bc)			;014e
	ld l,061h		;014f
	ld l,h			;0151
	ld l,c			;0152
	ld h,a			;0153
	ld l,(hl)			;0154
l0155h:
	jr nz,l0189h		;0155
	ld a,(bc)			;0157
	ld e,a			;0158
	ld (hl),e			;0159
	ld l,a			;015a
l015bh:
	ld l,l			;015b
	ld h,l			;015c
	ld b,(hl)			;015d
	ld (hl),l			;015e
	ld l,(hl)			;015f
	ld h,e			;0160
	ld a,(0090ah)		;0161
	ld h,e			;0164
	ld h,c			;0165
	ld l,h			;0166
	ld l,h			;0167
	jr nz,l0198h		;0168
	ld (hl),b			;016a
	ld (hl),d			;016b
	ld l,a			;016c
	jr nc,l0179h		;016d
	ld (hl),d			;016f
	ld (hl),e			;0170
	ld (hl),h			;0171
	jr nz,l01a7h		;0172
	ld a,(bc)			;0174
	ld (hl),b			;0175
	ld (hl),l			;0176
	ld (hl),e			;0177
l0178h:
	ld l,b			;0178
l0179h:
	jr nz,$+102		;0179
	ld a,(bc)			;017b
	ld l,h			;017c
	ld a,b			;017d
	ld l,c			;017e
	jr nz,l01e5h		;017f
	inc l			;0181
	ld e,a			;0182
	ld e,a			;0183
	ld c,c			;0184
	ld c,c			;0185
	jr nc,l0192h		;0186
	ld (hl),b			;0188
l0189h:
	ld (hl),l			;0189
	ld (hl),e			;018a
	ld l,b			;018b
	jr nz,l01f2h		;018c
	ld a,(bc)			;018e
	ld h,e			;018f
	ld h,c			;0190
	ld l,h			;0191
l0192h:
	ld l,h			;0192
	jr nz,l01f4h		;0193
	ld (hl),b			;0195
	ld (hl),d			;0196
	ld l,c			;0197
l0198h:
	ld l,(hl)			;0198
l0199h:
	ld (hl),h			;0199
	ld h,(hl)			;019a
	ld a,(bc)			;019b
	ld (hl),b			;019c
	ld l,a			;019d
	ld (hl),b			;019e
	jr nz,l0209h		;019f
	ld a,(bc)			;01a1
	ld (hl),b			;01a2
	ld l,a			;01a3
	ld (hl),b			;01a4
	jr nz,l020fh		;01a5
l01a7h:
	ld a,(bc)			;01a7
	ld l,d			;01a8
	ld l,l			;01a9
	ld (hl),b			;01aa
	jr nz,l01dbh		;01ab
	ld (hl),d			;01ad
	ld h,l			;01ae
	ld (hl),h			;01af
	ld a,(bc)			;01b0
	ld l,073h		;01b1
	ld h,l			;01b3
	ld h,e			;01b4
	ld (hl),h			;01b5
	jr nz,l01e6h		;01b6
	ld (hl),d			;01b8
	ld l,a			;01b9
	ld l,l			;01ba
	ld a,(bc)			;01bb
	ld l,061h		;01bc
	ld l,h			;01be
	ld l,c			;01bf
	ld h,a			;01c0
	ld l,(hl)			;01c1
	jr nz,l01f6h		;01c2
	ld a,(bc)			;01c4
	ld e,a			;01c5
	ld e,a			;01c6
	ld c,c			;01c7
	ld c,c			;01c8
	jr nc,l0205h		;01c9
	ld a,(bc)			;01cb
	ld l,064h		;01cc
	ld h,c			;01ce
	ld (hl),h			;01cf
	ld h,c			;01d0
	ld (03209h),a		;01d1
	add hl,sp			;01d4
	jr c,l0208h		;01d5
	ld sp,02e0ah		;01d7
	ld h,h			;01da
l01dbh:
	ld h,c			;01db
	ld (hl),h			;01dc
	ld h,c			;01dd
	ld (03209h),a		;01de
	jr c,l021ah		;01e1
	scf			;01e3
	inc sp			;01e4
l01e5h:
	ld a,(bc)			;01e5
l01e6h:
	ld l,064h		;01e6
	ld h,c			;01e8
	ld (hl),h			;01e9
	ld h,c			;01ea
	ld (03909h),a		;01eb
	dec (hl)			;01ee
	jr nc,l0225h		;01ef
	ld a,(bc)			;01f1
l01f2h:
	ld l,064h		;01f2
l01f4h:
	ld h,c			;01f4
	ld (hl),h			;01f5
l01f6h:
	ld h,c			;01f6
	ld (03209h),a		;01f7
	ld (hl),036h		;01fa
	jr nc,l0208h		;01fc
	ld l,065h		;01fe
	ld a,b			;0200
	ld (hl),h			;0201
	ld h,l			;0202
	ld (hl),d			;0203
	ld l,(hl)			;0204
l0205h:
	jr nz,l0266h		;0205
	ld l,l			;0207
l0208h:
	ld h,c			;0208
l0209h:
	ld l,c			;0209
	ld l,(hl)			;020a
	ld a,(bc)			;020b
	ld l,064h		;020c
	ld h,c			;020e
l020fh:
	ld (hl),h			;020f
	ld h,c			;0210
	ld (03009h),a		;0211
	ld a,(bc)			;0214
	ld l,073h		;0215
	ld h,l			;0217
	ld h,e			;0218
	ld (hl),h			;0219
l021ah:
	jr nz,$+48		;021a
	ld (hl),h			;021c
	ld h,l			;021d
	ld a,b			;021e
	ld (hl),h			;021f
	ld a,(bc)			;0220
	ld l,061h		;0221
	ld l,h			;0223
	ld l,c			;0224
l0225h:
	ld h,a			;0225
	ld l,(hl)			;0226
	jr nz,l025bh		;0227
	ld a,(bc)			;0229
	ld e,a			;022a
	ld l,l			;022b
	ld h,c			;022c
	ld l,c			;022d
	ld l,(hl)			;022e
	ld a,(0090ah)		;022f
	ld h,e			;0232
	ld h,c			;0233
	ld l,h			;0234
	ld l,h			;0235
	jr nz,l0266h		;0236
	ld (hl),b			;0238
	ld (hl),d			;0239
	ld l,a			;023a
	ld (06c0ah),a		;023b
	ld a,b			;023e
	ld l,c			;023f
	jr nz,l02aah		;0240
	inc l			;0242
	dec l			;0243
	ld (0640ah),a		;0244
	ld h,c			;0247
	ld h,h			;0248
	jr nz,l02adh		;0249
	ld a,(bc)			;024b
	ld a,b			;024c
	ld (hl),d			;024d
	ld h,c			;024e
	jr nz,l02b2h		;024f
	ld a,(bc)			;0251
	ld l,l			;0252
	ld l,a			;0253
	halt			;0254
	jr nz,l02c4h		;0255
	inc l			;0257
	ld h,c			;0258
	ld a,(bc)			;0259
	ld l,c			;025a
l025bh:
	ld l,(hl)			;025b
	ld a,b			;025c
	jr nz,l02c7h		;025d
	ld a,(bc)			;025f
	ld l,l			;0260
	ld l,a			;0261
	halt			;0262
	jr nz,l02d2h		;0263
	inc l			;0265
l0266h:
	ld h,c			;0266
	ld a,(bc)			;0267
	ld l,d			;0268
	ld l,l			;0269
	ld (hl),b			;026a
	jr nz,l02b6h		;026b
	ld (0315fh),a		;026d
	ld a,(bc)			;0270
	ld c,c			;0271
	ld (0335fh),a		;0272
	ld a,(0720ah)		;0275
	ld (hl),e			;0278
	ld (hl),h			;0279
	jr nz,l02adh		;027a
	ld a,(bc)			;027c
	ld (hl),b			;027d
	ld (hl),l			;027e
	ld (hl),e			;027f
	ld l,b			;0280
	jr nz,l02e7h		;0281
	ld a,(bc)			;0283
	ld h,e			;0284
	ld h,c			;0285
	ld l,h			;0286
	ld l,h			;0287
	jr nz,l02e9h		;0288
	ld (hl),e			;028a
	ld l,a			;028b
	ld l,l			;028c
	ld h,l			;028d
	ld b,(hl)			;028e
	ld (hl),l			;028f
	ld l,(hl)			;0290
	ld h,e			;0291
	ld a,(bc)			;0292
	ld (hl),b			;0293
	ld l,a			;0294
	ld (hl),b			;0295
	jr nz,$+106		;0296
	ld a,(bc)			;0298
	ld h,e			;0299
	ld h,c			;029a
	ld l,h			;029b
	ld l,h			;029c
	jr nz,$+48		;029d
	ld h,(hl)			;029f
	ld h,c			;02a0
	ld h,h			;02a1
	ld h,h			;02a2
	ld (hl),d			;02a3
	ld l,(hl)			;02a4
	ld (0690ah),a		;02a5
	ld l,(hl)			;02a8
	ld (hl),d			;02a9
l02aah:
	jr nz,$+111		;02aa
	ld a,(bc)			;02ac
l02adh:
	ld l,d			;02ad
	ld l,(hl)			;02ae
	ld a,d			;02af
	jr nz,$+51		;02b0
l02b2h:
	ld h,(hl)			;02b2
	ld a,(bc)			;02b3
	ld l,c			;02b4
	ld l,(hl)			;02b5
l02b6h:
	ld a,b			;02b6
	jr nz,$+106		;02b7
	ld a,(bc)			;02b9
	ld l,c			;02ba
	ld l,(hl)			;02bb
	ld (hl),d			;02bc
	jr nz,$+111		;02bd
	ld a,(bc)			;02bf
	ld sp,00a3ah		;02c0
	ld c,c			;02c3
l02c4h:
	ld (0315fh),a		;02c4
l02c7h:
	ld a,(0720ah)		;02c7
	ld (hl),e			;02ca
	ld (hl),h			;02cb
	jr nz,$+51		;02cc
	ld a,(bc)			;02ce
	ld l,h			;02cf
	ld a,b			;02d0
	ld l,c			;02d1
l02d2h:
	jr nz,$+106		;02d2
	inc l			;02d4
	ld (00a30h),a		;02d5
	ld (hl),d			;02d8
	ld (hl),e			;02d9
	ld (hl),h			;02da
	jr nz,$+55		;02db
	ld a,(bc)			;02dd
	ld l,d			;02de
	ld h,e			;02df
	jr nz,$+75		;02e0
	ld (0335fh),a		;02e2
	ld a,(bc)			;02e5
	ld l,d			;02e6
l02e7h:
	ld l,l			;02e7
	ld (hl),b			;02e8
l02e9h:
	jr nz,$+48		;02e9
	ld (hl),d			;02eb
	ld h,l			;02ec
	ld (hl),h			;02ed
	ld a,(bc)			;02ee
The c.s is a lie so I had to use a dissaembler to get the ouput. With any c compiler from said era, its going to be garbage.
Post Reply