Due to the poor NES dev documentiation, I am having to decipher what little demo apps there are out there.
I came accross a simple demo that loads the color palette and I am trying to understand the .db directive.
I don't have the code infront of me here at work, but I will try to express the gist of it:
The palette uses .db
Code:
palette:
.db $0F, $0C, $0E ... (etc)
It actually has 32 entries. This makes sense if there are 32 colours to choose from.
The part of the code that calls the palette sub routine looks something like this:
Code:
LDX #$00
LoadPalette:
LDA palette, X
STA $2013 ; store at PPU
CMP #$20 ; compare to decimal 32
BNE LoadPalette ; continue to loop
Like I said, its not 100% accurate.
It seems that using .db is like an array of some sort? Every time you iterate through the loop, you load the accumulator
with the data that is next in the stream. Then you store the PPU with what rests at A?
Hopefully, I'm understanding this right. Could someone elaborate?