2009-03-21 06:40:53 +00:00
|
|
|
; utility routine to copy memory
|
2009-01-22 01:27:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
.export copymem
|
|
|
|
.exportzp copy_src
|
|
|
|
.exportzp copy_dest
|
|
|
|
|
|
|
|
|
|
|
|
.segment "IP65ZP" : zeropage
|
|
|
|
|
|
|
|
; pointers for copying
|
|
|
|
copy_src: .res 2 ; source pointer
|
|
|
|
copy_dest: .res 2 ; destination pointer
|
|
|
|
|
|
|
|
|
|
|
|
.bss
|
|
|
|
|
|
|
|
end: .res 1
|
|
|
|
|
|
|
|
|
|
|
|
.code
|
|
|
|
|
2009-03-21 06:40:53 +00:00
|
|
|
;copy memory
|
|
|
|
;inputs:
|
|
|
|
; copy_src is address of buffer to copy from
|
|
|
|
; copy_dest is address of buffer to copy to
|
|
|
|
; AX = number of bytes to copy
|
|
|
|
;outputs: none
|
2009-01-22 01:27:03 +00:00
|
|
|
copymem:
|
|
|
|
sta end
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
cpx #0
|
|
|
|
beq @tail
|
|
|
|
|
|
|
|
: lda (copy_src),y
|
|
|
|
sta (copy_dest),y
|
|
|
|
iny
|
|
|
|
bne :-
|
|
|
|
inc copy_src+1 ;next page
|
|
|
|
inc copy_dest+1 ;next page
|
|
|
|
dex
|
|
|
|
bne :-
|
|
|
|
|
|
|
|
@tail:
|
|
|
|
lda end
|
|
|
|
beq @done
|
|
|
|
|
|
|
|
: lda (copy_src),y
|
|
|
|
sta (copy_dest),y
|
|
|
|
iny
|
|
|
|
cpy end
|
|
|
|
bne :-
|
|
|
|
|
|
|
|
@done:
|
|
|
|
rts
|