2013-12-13 21:24:03 +00:00
|
|
|
; utility routine to copy memory
|
|
|
|
|
2014-07-07 18:56:21 +00:00
|
|
|
.include "zeropage.inc"
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.export copymem
|
2014-07-07 18:56:21 +00:00
|
|
|
.exportzp copy_src = ptr1
|
|
|
|
.exportzp copy_dest = ptr2
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.bss
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
end: .res 1
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.code
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; copy memory
|
|
|
|
; inputs:
|
2013-12-13 21:24:03 +00:00
|
|
|
; copy_src is address of buffer to copy from
|
|
|
|
; copy_dest is address of buffer to copy to
|
|
|
|
; AX = number of bytes to copy
|
2013-12-27 13:57:56 +00:00
|
|
|
; outputs: none
|
2013-12-13 21:24:03 +00:00
|
|
|
copymem:
|
2013-12-27 13:57:56 +00:00
|
|
|
sta end
|
|
|
|
ldy #0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
cpx #0
|
|
|
|
beq @tail
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
: lda (copy_src),y
|
|
|
|
sta (copy_dest),y
|
|
|
|
iny
|
|
|
|
bne :-
|
|
|
|
inc copy_src+1 ; next page
|
|
|
|
inc copy_dest+1 ; next page
|
|
|
|
dex
|
|
|
|
bne :-
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
@tail:
|
2013-12-27 13:57:56 +00:00
|
|
|
lda end
|
|
|
|
beq @done
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
: lda (copy_src),y
|
|
|
|
sta (copy_dest),y
|
|
|
|
iny
|
|
|
|
cpy end
|
|
|
|
bne :-
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
@done:
|
2013-12-27 13:57:56 +00:00
|
|
|
rts
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; -- LICENSE FOR copymem.s --
|
2013-12-13 21:24:03 +00:00
|
|
|
; The contents of this file are subject to the Mozilla Public License
|
|
|
|
; Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
; compliance with the License. You may obtain a copy of the License at
|
|
|
|
; http://www.mozilla.org/MPL/
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; Software distributed under the License is distributed on an "AS IS"
|
|
|
|
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
; License for the specific language governing rights and limitations
|
|
|
|
; under the License.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Original Code is ip65.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Initial Developer of the Original Code is Per Olofsson,
|
|
|
|
; MagerValp@gmail.com.
|
|
|
|
; Portions created by the Initial Developer are Copyright (C) 2009
|
2013-12-27 13:57:56 +00:00
|
|
|
; Per Olofsson. All Rights Reserved.
|
2013-12-13 21:24:03 +00:00
|
|
|
; -- LICENSE END --
|