Hello again, ChaseHQ85. I'm glad to see that you found your problem. I'm providing an untested re-write of your source, in the hopes of showing you a different way of attacking the specific task you posted. I think that I understood what you were doing with your code, with the exception of your mention of the number "2820" in your comments.
When it is possible to do so, it can be of benefit to fill from higher to lower addresses on the 65xx, especially if the fill area is not an integer multiple of 256, and this is the technique I have employed here. The accumulator and Y register don't have to be initialized inside the loops, because they already have the "correct" value when the loop-backs occur. Not only is the static instruction count lower, but the nested loops execute far fewer instructions, with the net result being a more efficient system.
Code:
PROCESSOR 6502
;-------------------------------------------------
;-------------DANI-I-SYSTEM-ROM-------------------
;-------------------------------------------------
;-------------EQUATES-----------------------------
VRAM: EQU $8000
VRAM_H: EQU $80
VRAM_L: EQU $00
VRAM_CMD: EQU VRAM + $F00
VRAM_CHARSLOC: EQU VRAM + $F10
VRAM_CHARSBUF: EQU VRAM + $F20
;-------------EO-EQUATES--------------------------
ORG $C000
RESET:
LDX #$FF ; Initialize the Stack Pointer
TXS ; Transfer X to Stack
SETUP_BLANKCHAR:
LDA #$00 ; Store Null in Accu
LDX #$07 ; Set X to 7
LOOP_BLANKSTORE:
STA VRAM_CHARSBUF,X ; Store Accu into VRAM_CHARSBUF+X
DEX ; (filling high to low is more efficient)
BPL LOOP_BLANKSTORE
STA VRAM_CHARSLOC ; Set the Character Store Location
LDA #$01 ; Set the Character Store Command
STA VRAM_CMD
CHECK_CMDCOMPLETE:
LDA VRAM_CMD ; Check VRAM_CMD to see if VGA picked up char
BNE CHECK_CMDCOMPLETE ; Keep checking until it resets to 00
BLANKOUT_START:
LDA #VRAM_L ; Load Low Byte of VRAM address
STA $05 ; Store it in Zero Page 5
LDY #$B0 ; Last page is only partially filled
LDA #$00 ; Set Accu To 0 (fill byte)
LDX #VRAM_H+4 ; Init X to last VRAM page number
LOOP_BL_OUTER:
STX $06 ; Store it in Zero Page 6
LOOP_BL_INNER:
DEY ; (filling high to low is more efficient)
STA ($05),Y ; Store the fill byte
BNE LOOP_BL_INNER ; ... down to the bottom of the page
DEX ; Prepare to fill next-lower page
CPX #VRAM_H ; Is X < VRAM_H?
BCS LOOP_BL_OUTER ; No: fill the next page
LOOP_DONE:
JMP LOOP_DONE ; Done: "halt" in an infinite loop
VECTORS:
ORG $FFFA ; 6502 Starts reading its vectors here
.word LOOP_DONE ; NMI
.word RESET ; RESET
.word LOOP_DONE ; BRK
END
If I messed up anywhere, please let me know, and I'll revise.
Mike B.
Quick question to make sure i understand fully what's happening. Wouldn't i need to make the only partially filled page start at B1 instead of B0 because of the DEY prior to the store?