6502-OS/programs/memcopy.s65

29 lines
575 B
Plaintext
Raw Permalink Normal View History

2023-11-10 00:55:03 +01:00
.ifndef INCLUDE_MEMCOPY
INCLUDE_MEMCOPY = 1
2023-12-08 22:56:35 +01:00
.include "system.h65"
2023-11-10 00:55:03 +01:00
2023-12-20 12:27:54 +01:00
.export memcopy
2023-12-08 22:56:35 +01:00
.code
2023-11-10 00:55:03 +01:00
;********************************************************************************
; @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
2023-12-08 22:56:35 +01:00
cpy #0
2023-12-20 12:27:54 +01:00
beq @rts
@copy_byte:
dey
2023-12-08 00:03:29 +01:00
lda (ARG0),y
sta (ARG2),y
2023-12-20 12:27:54 +01:00
cpy #0
bne @copy_byte
@rts:
2023-11-10 00:55:03 +01:00
rts
2023-12-08 22:56:35 +01:00
.endproc
2023-11-10 00:55:03 +01:00
.endif ; guard