;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- ;;Move memory from B_start B_end to A_start , (implied address) ;;Modifies A,X and B_start gets modified .proc memcpy .include "mem.inc" ;; Let Y + A_start lower nibble represent A_start ;; therefor: A_start = Y - A_start ;; With Y we mean what Y will represent later aka >B_start Sub_16 >A_start, B_start, #$00 ;;Lets move B_start lover-nibble to Y LDY >B_start LDA #$00 STA >B_start loop: Lag_16 >B_end, B_start), Y STA (>A_start), Y ;Tip save time by counting downward, fast to check if Y ==0 // hugo INY TYA CMP #$ff BNE loop ;; Fix overflow LDY #$00 INC