emailler/ip65/copymem.s

72 lines
1.4 KiB
ArmAsm
Raw Normal View History

2013-12-13 21:24:03 +00:00
; utility routine to copy memory
.include "zeropage.inc"
.export copymem
.exportzp copy_src = ptr1
.exportzp copy_dest = ptr2
2013-12-13 21:24:03 +00:00
.bss
2013-12-13 21:24:03 +00:00
end: .res 1
2013-12-13 21:24:03 +00:00
.code
2013-12-13 21:24:03 +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
; outputs: none
2013-12-13 21:24:03 +00:00
copymem:
sta end
ldy #0
2013-12-13 21:24:03 +00:00
cpx #0
beq @tail
2013-12-13 21:24:03 +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:
lda end
beq @done
2013-12-13 21:24:03 +00:00
: lda (copy_src),y
sta (copy_dest),y
iny
cpy end
bne :-
2013-12-13 21:24:03 +00:00
@done:
rts
2013-12-13 21:24:03 +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-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-13 21:24:03 +00:00
; The Original Code is ip65.
;
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
; Per Olofsson. All Rights Reserved.
2013-12-13 21:24:03 +00:00
; -- LICENSE END --