acme/ACME_Lib/cbm/c64/memmove.a

32 lines
776 B
Plaintext
Raw Normal View History

;ACME 0.95.7
!ifdef lib_cbm_c64_memmove_a !eof
lib_cbm_c64_memmove_a = 1
; this macro inserts code to move a memory block.
; it calls a function from the basic interpreter, so:
; - BASIC ROM must be banked in
; - the source block must be below $a000 so it can be read
; source and target blocks are allowed to overlap.
!macro basic_memmove .src_start, .src_end, .target_start {
!address {
.z_target_end = $58
.z_src_end = $5a
.z_src_start = $5f
.fn = $a3bf
}
lda #<.src_start
ldx #>.src_start
sta .z_src_start
stx .z_src_start + 1
lda #<.src_end
ldx #>.src_end
sta .z_src_end
stx .z_src_end + 1
lda #<(.target_start + .src_end - .src_start)
ldx #>(.target_start + .src_end - .src_start)
sta .z_target_end
stx .z_target_end + 1
jsr .fn
}