1
0
mirror of https://github.com/stid/woz64.git synced 2024-06-01 01:41:34 +00:00
woz64/memory.asm

34 lines
845 B
NASM
Raw Normal View History

2019-11-16 22:09:22 +00:00
#importonce
.filenamespace Memory
#import "mem_map.asm"
* = * "Memory Routines"
// move memory down
//
// from = source start address
// to = destination start address
// size = number of bytes to move
//
clone:
ldy #0
2019-11-17 07:41:00 +00:00
ldx MemMap.MEMORY.size
2019-11-16 22:09:22 +00:00
beq md2
2019-11-17 07:41:00 +00:00
md1: lda (MemMap.MEMORY.from),y // move a page at a time
sta (MemMap.MEMORY.to),y
2019-11-16 22:09:22 +00:00
iny
bne md1
2019-11-17 07:41:00 +00:00
inc MemMap.MEMORY.from+1
inc MemMap.MEMORY.to+1
2019-11-16 22:09:22 +00:00
dex
bne md1
2019-11-17 07:41:00 +00:00
md2: ldx MemMap.MEMORY.size+1
2019-11-16 22:09:22 +00:00
beq md4
2019-11-17 07:41:00 +00:00
md3: lda (MemMap.MEMORY.from),y // move the remaining bytes
sta (MemMap.MEMORY.to),y
2019-11-16 22:09:22 +00:00
iny
dex
bne md3
md4: rts