Haha...only took a day. I'm stuck. Well, not in code, but in understanding. The background colors...here goes.
Oh boy, I thought I had it all down, then I went to try and change colors to the cloud (background) and came to a unfortunate conclusion that I may be missing something fundamental in how the 4 colors are assigned to the pixels in the chr file as well.
So I'm messing around with this, trying to understand the attribute table and coloring of the background pixels. so here goes.
According to bunnyboy in the first post, the first color in the 4bytes (of 16 total) is the "transparent color". SO first question, what are the next 3 colors in the 4 bytes? For example, in my example.asm, the sprite palette has $21 in each of the 4 bytes (1st color) to ensure that the minimario sprite "looks" like minimario in the sky regardless of which set of colors is used by filling in the blank pixels with sky color($21) , okay, got it. Each of the colors changes a different part of mario as I go through the chr file palette selection and select a different set of 4 colors (same as assigning the sprite attribute to $00, $01, $02, or $03), okay, got it...
But I'm not understanding how the assembler "knows for any given set of 4 bytes of the color palette that is set to be used (see below example), which pixels will receive which of the four colors". In otherwords, how does it know that marios hat is all color $16, while his eyes are $18, skin $27, and area around him is the "transparent area" in this case color $21?
I'm assuming as you make the chr file you assign "sets of pixels" to the first color, then the next "set of pixels" are assigned the second color, so on until all 4 colors are used and all pixels have been assigned to one of the 4 "sets of pixels".
Once I understand this, I'll probably understand how the attributes apply to the background, but it is much different since 8 bytes of attributes are assigned to background vice 1 byte for a sprite. Just outta curiosity, why are there 8 bytes of attributes for colors for background, but only 1 byte for the attribute of a sprite? Not sure I'm understanding the setting of background colors like I thought...
My hunch is there are 32 tiles total, so 8 tiles x 4 rows = 32 tiles. And 1 byte of background attribute dictates the colors of 4 tiles, so you need the 8 bytes for the 32 tiles total.... And even if thats right, how does 1 attribute dictate the color of 4 tiles, each with there "4 sets of pixels"?
--Sprite palette CODE
...
palette: ;first set, second, set, third set, fourth set
.db $22,$29,$1A,$0F, $22,$36,$17,$0F, $22,$30,$21,$0F, $22,$27,$17,$0F ;;background palette
.db $21,$16,$27,$18, $21,$02,$38,$3C, $21,$1C,$15,$14, $21,$02,$38,$3C ;;sprite palette data
....
sprites: ;minimario
;vert tile attr horiz
.db $80, $32, $00, $80 ;sprite 0 Attr $00 means use the first set of 4 colors in sprite palette, $01 use second set, etc.
.db $80, $33, $00, $88 ;sprite 1
.db $88, $34, $00, $80 ;sprite 2
.db $88, $35, $00, $88 ;sprite 3
...
--END sprite palette CODe
--START Background palette CODE
...
background:
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 ;;row 1 (not visible)
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 ;;all sky
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 ;;row 2
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 ;;all sky
.db $24,$24,$24,$24,$45,$45,$24,$24,$45,$45,$45,$45,$45,$45,$24,$24 ;;row 3
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$53,$54,$24,$24 ;;some brick tops
.db $24,$24,$24,$24,$47,$47,$24,$24,$47,$47,$47,$47,$47,$47,$24,$24 ;;row 4
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$55,$56,$24,$24 ;;brick bottoms
; why 8 bytes here?
attribute:
.db %00000000, %00010000, %01010000, %00010000, %00000000, %00000000, %00000000, %00110000
...
--End Background palette CODE
And all this started cuz I wanted a grey cloud (which I still cant figure out)... well its raining now aint it? lol
OS
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin