Reading $2007 to increment the address is useful, but usually only for a small number of increments in a row. Each
BIT $2007 is 4 cycles, so that "small number" might be 4 or 5.
In that loop with
DEX/
BNE that's 9 cycles each, so it becomes slower after only 3 loops or so. It's probably a good solution for small code (or simple code), but if you find yourself needing to squeeze more into your vblank it's maybe not going to be the best option.
Alternatives:
If
start is the starting address of your update, you can jump to an arbitrary offset from it in 22 cycles. Consider that you don't have to write this result back to
start: you can do all the skips relative to the start, rather than the current position, which can probably save a few cycles.
Code: Select all
lda start+0
clc ; can potentially omit this for another -2 cycles if careful
adc #<offset
tax
lda start+1
adc #>offset
sta $2006
stx $2006
Also, if you want to increment by 32 specifically you could write to $2000 to switch increment mode then switch back. This seems to cost 16 cycles already, so unless you're looking for 32 or 33 specifically it's probably better to just go through $2006.
Code: Select all
lda #%10000100 ; +32 increment mode
sta $2000
bit $2007 ; skip 32
lda #%10000000 ; +1 increment mode
sta $2000