ADDR B1 B2 B3 B4 X:\public_html\EEL4746\programs\memcopy.asm PAGE 1 D000 CC 00 40 test: LDD #$40 ; Copy 40 bytes D003 CE 10 00 LDX #$1000 ; from $1000 (control regs) D006 18 CE 00 00 LDY #$0000 ; to $0000 (internal RAM) D00A 8D 02 BSR memcopy ; Do it! D00C 20 FE end: BRA end ; Stop here D00E 1A 83 00 00 memcopy: CPD #0 ; Compare D to 0. D012 27 0F BEQ done ; If D=0, nothing left to . copy. D014 36 PSHA ; Save the MSB of D. D015 A6 00 LDAA 0,X ; Load next byte to copy. D017 08 INX ; Go to next source byte. D018 18 A7 00 STAA 0,Y ; Store A at destination . addr. D01B 18 08 INY ; Go to next destination . byte. D01D 32 PULA ; Restore the MSB of D. D01E 83 00 01 SUBD #1 ; Decrement # of bytes left. D021 20 EB BRA memcopy ; Repeat. D023 39 done: RTS ; Return to caller. Symbol Table DONE D023 MEMCOPY D00E END D00C TEST D000