After much deliberation, I finally managed to get the memory clear/fill function debugged.
; ; FILL PAGES MACRO ; ; %1 = beginning page to fill ; %2 = number of pages to fill (should be - 1) ; %3 = byte to fill with (e.g. $00) ; ; $CC = 00 for top of page boundary ; $CD = page currently being filled ; $D5 = corresponding to ending page ; .MACRO CLRP STCL LDA %1 STA $CD LDA #00 STA $CC LDY #0 LDA $CD ADC #%2 STA $D5 CRLP LDA %3 DEY STA ($CC),Y BNE CRLP INC $CD LDA $CD CMP $D5 BEQ CRLP BCC CRLP .ENDM
So, what do you guys think? How can I make this so that it can fill regions of memory that don't end on nice page boundaries? Should I need to do that?