ever have a value other than 0 or 1?
Heh, I don't know, I haven't seen the rest of the code. Even if the name suggests it only specifies a nametable, I assumed it was the value that's written to $2000 (the lower 2 bits select the nametable, while the upper bits do other things).
After this code is run currNameTable is always 0 right?
The purpose is to clear bit 0, but keep all the others.
Is the ora currNameTable
a waste? X OR False == X ?
(I'm sorry, this is me asking stupid questions.)
OR can be used to set bits. First I cleared the bit (AND 0 always results in 0) and then I OR'ed it with the nametable bit. 0 OR 0 = 0, while 0 OR 1 = 1, so I essentially transferred the bit from one variable (CameraX+1) to the other (currNameTable).
You can do this in many different ways, but the code I wrote is more "compatible" with the one you had before, so I thought it would be easier for you to understand. Honestly I'd rather just do this to set the scroll:
Code: Select all
and #$01 ;keep only the first bit
ora Cur2000Settings ;combine with the other PPU settings
sta $2005 ;set the horizontal scroll
sta $2005 ;set the vertical scroll
This takes care of everything. You just have to put all your $2000 configuration in "Cur2000Settings" and keep the lowest bit clear.