|
|
|
|
|
by kazinator
2344 days ago
|
|
Skimming through this, this is the first piece of code that my eyes drilled into more deeply: LCD__clear_video_ram:
pha ; preserve A via stack
tya ; same for Y
pha
ldy #$20 ; set index to 32
.loop:
lda #$20 ; set character to 'space'
sta VIDEO_RAM,Y ; clean video ram
dey ; decrease index
bne .loop ; are we done? no, repea
sta VIDEO_RAM ; yes, write zero'th location manually
pla ; restore Y
tay
pla ; restore A
rts
Surely we don't need to keep loading the space character into A on every iteration?Since Y starts at a hard-coded value that is (well) below $80, this could use "bpl .loop" and drop the "sta VIDEO_RAM" special case. In .select_option, I'd looking into doing a jump table. Ideas here: https://wiki.nesdev.com/w/index.php/Jump_table |
|