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-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
|
|
|
|
@loop:
|
2023-11-10 00:55:03 +01:00
|
|
|
beq @loop_end
|
2023-12-08 00:03:29 +01:00
|
|
|
lda (ARG0),y
|
|
|
|
sta (ARG2),y
|
2023-11-10 00:55:03 +01:00
|
|
|
dey
|
|
|
|
bra @loop
|
2023-12-08 22:56:35 +01:00
|
|
|
@loop_end:
|
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
|
|
|
|
|