Hello all. Sorry I've been away for a while.
Recently, I've been doing a lot of programming on the C64 and I've run across a section that I want to optimize in my program.
My initial thoughts tell me I should be using some lookup table but I'm struggling with the implementation.
Let's say, for example, that I have the following:
Code:
lda #240
sta ($10), y
$10 and $11 contain the address of the C64's SCREEN RAM. And, for the sake of example, the Y register contains an offset to some column. In other words, that code above would plot the character #240 roughly in the middle of the screen.
Now, what I want to do next is add 9 more locations (total of 10) that would be something like 16, 40, 56, 80, 96, etc. All 8-bit numbers.
It's easy enough to do something like this:
Code:
lda #16
clc
adc $10
sta $10
lda #00
adc $11
sta $11
...
lda #40
clc
adc $10
sta $10
lda #00
adc $11
sta $11
...
lda #56
clc
adc $10
sta $10
lda #00
adc $11
sta $11
...
etc...
That certainly works. But looks messy. Especially since I need to do it 10 times per frame.
I hope I'm making sense.
So, any tips would be appreciated.
Thanks!!