I was analyzing my code to see what routines were using the most cycles overall. I was surprised to see that one of my most cycle hungry routines was just a simple loop I was using to clear out my shadow OAM before reloading sprite data into it:
Code: Select all
LDX #0
LDA #$FE
.Loop:
STA spriteTable, X
INX
BNE .Loop
RTS
Code: Select all
LDX #31
LDA #$FE
.Loop:
STA spriteTable, X
STA spriteTable + 32, X
STA spriteTable + 64, X
STA spriteTable + 96, X
STA spriteTable + 128, X
STA spriteTable + 160, X
STA spriteTable + 192, X
STA spriteTable + 224, X
DEX
BPL .Loop
RTS
I know this is probably old-hat to many of you, but I'm excited about it. it's enough of a difference to visibly reduce lag in some areas, and I'm very pleased with it.