6502-OS/programs/memcopy.s65

26 lines
547 B
Plaintext

.ifndef INCLUDE_MEMCOPY
INCLUDE_MEMCOPY = 1
.include "system.h65"
.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
@loop:
beq @loop_end
lda (ARG0),y
sta (ARG2),y
dey
bra @loop
@loop_end:
rts
.endproc
.endif ; guard