c64-livecoding/wip-hugo/routines/memory/memcpy.s
2025-05-15 16:18:50 +02:00

35 lines
677 B
ArmAsm

;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
;;Move length bytes from A_start address to lenght bytes starting at B_start.
.proc memcpy
.include "mem.inc"
LDY #$00
loop:
LDA (B_start), Y
STA (A_start), Y
INY
BEQ y_overflow
change_length:
DEC length
BNE loop
DEC length +1
BPL loop
JMP loop_end
;;;;check if length hi byte is 0. if it is end this
;;LDA length + 1
;;BEQ loop_end
;;DEC length +1
;;JMP loop
y_overflow:
LDY #$00
INC B_start + 1
INC A_start + 1
jmp change_length
loop_end:
RTS
.endproc