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: Select all
palette:
.db $0F, $0C, $0E ... (etc)
The part of the code that calls the palette sub routine looks something like this:
Code: Select all
LDX #$00
LoadPalette:
LDA palette, X
STA $2013 ; store at PPU
CMP #$20 ; compare to decimal 32
BNE LoadPalette ; continue to loop
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?