[Coco] 64K ROM to RAM programs - where did this one come from?

Allen Huffman alsplace at pobox.com
Tue Dec 14 16:24:40 EST 2021


Using a Motorola 6809 Emulator I found online (which turns out to be the Xroar site):

http://6809.uk

…I was able to convert the DATA statements from the ROM to RAM program in to “fcb” constant bytes…

start:
 fcb $34,$01,$1A,$50,$10,$8E,$80,$00
 fcb $B7,$FF,$DE,$EC,$A4,$AE,$22,$EE
 fcb $24,$B7,$FF,$DF,$ED,$A1,$AF,$A1
 fcb $EF,$A1,$10,$8C,$FE,$FC,$25,$E8
 fcb $10,$8C,$FF,$00,$24,$0C,$B7,$FF
 fcb $DE,$EC,$A4,$B7,$FF,$DF,$ED,$A1
 fcb $20,$EE,$35,$01,$39

…then “assemble” it and look at the output in the emulator:

4000:	34 01         	PSHS CC
4002:	1A 50         	ORCC #$50
4004:	10 8E 80 00   	LDY #$8000
4008:	B7 FF DE      	STA $FFDE
400B:	EC A4         	LDD ,Y
400D:	AE 22         	LDX $02,Y
400F:	EE 24         	LDU $04,Y
4011:	B7 FF DF      	STA $FFDF
4014:	ED A1         	STD ,Y++
4016:	AF A1         	STX ,Y++
4018:	EF A1         	STU ,Y++
401A:	10 8C FE FC   	CMPY #$FEFC
401E:	25 E8         	BCS $4008
4020:	10 8C FF 00   	CMPY #$FF00
4024:	24 0C         	BCC $4032
4026:	B7 FF DE      	STA $FFDE
4029:	EC A4         	LDD ,Y
402B:	B7 FF DF      	STA $FFDF
402E:	ED A1         	STD ,Y++
4030:	20 EE         	BRA $4020
4032:	35 01         	PULS CC
4034:	39            	RTS

I can now see why it is larger. Instead of copying a byte at a time, like the Frank Hogg version, it copies 6 bytes at a type by loading them in to three 16-bit registers (D, X and U).  That means it is 6 times faster, I guess ;-)

But, what is going on at $401A with the compare against address $FEFC followed by a compare against $FF00?




More information about the Coco mailing list