RosettaCodeData/Task/Deepcopy/6502-Assembly/deepcopy-3.6502

15 lines
284 B
Plaintext

;input:
;$00,$01 = pointer to source
;$07,$08 = pointer to destination
;X = bytes to copy
;(the memory addresses are arbitrary, but each pair of input addresses MUST be consecutive or this won't work.)
memcpy:
LDY #0
memcpy_again:
lda ($00),y
sta ($07),y
iny
dex
bne memcpy_again
rts