snake6502/src/macro.asm

31 lines
587 B
NASM
Raw Normal View History

2021-11-07 15:10:02 +00:00
SEG zeropageSegment
2021-11-07 17:14:59 +00:00
ptrDstStart WORD
ptrDstEnd WORD
2021-11-07 15:10:02 +00:00
MACRO MEMSET
SEG programSegment
clc
lda <{1}
sta ptrDstStart
adc <({3} + 1)
sta ptrDstEnd
lda >{1}
sta ptrDstStart + 1
adc >({3} + 1)
sta ptrDstEnd + 1
lda {2}
ldy #0
.loop:
sta (ptrDstStart),y
inc ptrDstStart
bne .skipInc
inc ptrDstStart + 1
.skipInc:
ldx ptrDstStart
cpx ptrDstEnd
bne .loop
ldx ptrDstStart + 1
cpx ptrDstEnd + 1
bne .loop
ENDM