2021-11-07 15:10:02 +00:00
|
|
|
SEG zeropageSegment
|
2021-11-07 21:52:31 +00:00
|
|
|
; Generic src/dst copy pointers
|
|
|
|
srcPointer WORD
|
|
|
|
dstPointer WORD
|
|
|
|
dstPointerEnd WORD
|
2021-11-07 15:10:02 +00:00
|
|
|
|
2021-11-07 19:35:46 +00:00
|
|
|
SEG programSegment
|
2021-11-07 15:10:02 +00:00
|
|
|
MACRO MEMSET
|
2021-11-07 21:52:31 +00:00
|
|
|
IF {1} != "D"
|
2021-11-07 15:10:02 +00:00
|
|
|
clc
|
|
|
|
lda <{1}
|
2021-11-07 21:52:31 +00:00
|
|
|
sta dstPointer
|
|
|
|
adc <{3}
|
|
|
|
sta dstPointerEnd
|
2021-11-07 15:10:02 +00:00
|
|
|
lda >{1}
|
2021-11-07 21:52:31 +00:00
|
|
|
sta dstPointer + 1
|
|
|
|
adc >{3}
|
|
|
|
sta dstPointerEnd + 1
|
|
|
|
ELSE
|
|
|
|
clc
|
|
|
|
lda dstPointer
|
|
|
|
adc <{3}
|
|
|
|
sta dstPointerEnd
|
|
|
|
lda dstPointer + 1
|
|
|
|
adc >{3}
|
|
|
|
sta dstPointerEnd + 1
|
|
|
|
ENDIF
|
2021-11-07 15:10:02 +00:00
|
|
|
lda {2}
|
|
|
|
ldy #0
|
|
|
|
.loop:
|
2021-11-07 21:52:31 +00:00
|
|
|
sta (dstPointer),y
|
|
|
|
inc dstPointer
|
2021-11-07 15:10:02 +00:00
|
|
|
bne .skipInc
|
2021-11-07 21:52:31 +00:00
|
|
|
inc dstPointer + 1
|
2021-11-07 15:10:02 +00:00
|
|
|
.skipInc:
|
2021-11-07 21:52:31 +00:00
|
|
|
ldx dstPointer
|
|
|
|
cpx dstPointerEnd
|
2021-11-07 15:10:02 +00:00
|
|
|
bne .loop
|
2021-11-07 21:52:31 +00:00
|
|
|
ldx dstPointer + 1
|
|
|
|
cpx dstPointerEnd + 1
|
2021-11-07 15:10:02 +00:00
|
|
|
bne .loop
|
|
|
|
ENDM
|
2021-11-07 21:52:31 +00:00
|
|
|
|
|
|
|
SEG zeroPageSegment
|
|
|
|
|
|
|
|
SEG programSegment
|
|
|
|
MACRO MEMCPY
|
|
|
|
IF {1} != "D"
|
|
|
|
clc
|
|
|
|
lda <{1}
|
|
|
|
sta dstPointer
|
|
|
|
adc <{3}
|
|
|
|
sta dstPointerEnd
|
|
|
|
lda >{1}
|
|
|
|
sta dstPointer + 1
|
|
|
|
adc >{3}
|
|
|
|
sta dstPointerEnd + 1
|
|
|
|
ELSE
|
|
|
|
clc
|
|
|
|
lda dstPointer
|
|
|
|
adc <{3}
|
|
|
|
sta dstPointerEnd
|
|
|
|
lda dstPointer + 1
|
|
|
|
adc >{3}
|
|
|
|
sta dstPointerEnd + 1
|
|
|
|
ENDIF
|
|
|
|
|
|
|
|
lda <{2}
|
|
|
|
sta srcPointer
|
|
|
|
lda >{2}
|
|
|
|
sta srcPointer + 1
|
|
|
|
|
|
|
|
ldy #$0
|
|
|
|
.loop:
|
|
|
|
lda (srcPointer),y
|
|
|
|
sta (dstPointer),y
|
|
|
|
|
|
|
|
inc dstPointer
|
|
|
|
bne .skipIncDst
|
|
|
|
inc dstPointer + 1
|
|
|
|
.skipIncDst:
|
|
|
|
inc srcPointer
|
|
|
|
bne .skipIncSrc
|
|
|
|
inc srcPointer + 1
|
|
|
|
.skipIncSrc:
|
|
|
|
|
|
|
|
ldx dstPointer
|
|
|
|
cpx dstPointerEnd
|
|
|
|
bne .loop
|
|
|
|
ldx dstPointer + 1
|
|
|
|
cpx dstPointerEnd + 1
|
|
|
|
bne .loop
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
SEG programSegment
|
|
|
|
MACRO MOV_WORD_MEM
|
|
|
|
lda {2}
|
|
|
|
sta {1}
|
|
|
|
lda {2} + 1
|
|
|
|
sta {1} + 1
|
|
|
|
ENDM
|