6502-OS/programs/memcopy.s65
2023-12-20 12:27:54 +01:00

29 lines
575 B
Plaintext

.ifndef INCLUDE_MEMCOPY
INCLUDE_MEMCOPY = 1
.include "system.h65"
.export memcopy
.code
;********************************************************************************
; @function Copy a block of memory to a different address
; @param ARG0-1: Source address
; @param ARG2-3: Target address
; @param y: Number of bytes to copy
;********************************************************************************
.proc memcopy
cpy #0
beq @rts
@copy_byte:
dey
lda (ARG0),y
sta (ARG2),y
cpy #0
bne @copy_byte
@rts:
rts
.endproc
.endif ; guard