Another colors/tiles question
sccoupe
Posts: 118
The following init colors will display a purple screen with the TV driver.
repeat·i·from·0·to·63
··colors[noparse][[/noparse] i ]·:=·$78787878
The following init colors will display a black screen with a 16 pixel wide, purple·horizontal line all of the way across the screen about half way down.
repeat i from 0 to 63
· colors [noparse][[/noparse] i ] := $02020202
colors [noparse][[/noparse]·8 ] := $78787878
Now im pretty sure that I understand how these work, but what if I only wanted that purple stripe to go half way across the screen? It seems that setting the colors from colors[noparse][[/noparse]0] to colors[noparse][[/noparse]15] sets the 4 colors for the tiles a row at a time. How do I set this for an individual tile? If 0 to 15 seems to set the colors for the whole screen, why repeat the color init from 0 to 63?
Thanks all.
Jason
repeat·i·from·0·to·63
··colors[noparse][[/noparse] i ]·:=·$78787878
The following init colors will display a black screen with a 16 pixel wide, purple·horizontal line all of the way across the screen about half way down.
repeat i from 0 to 63
· colors [noparse][[/noparse] i ] := $02020202
colors [noparse][[/noparse]·8 ] := $78787878
Now im pretty sure that I understand how these work, but what if I only wanted that purple stripe to go half way across the screen? It seems that setting the colors from colors[noparse][[/noparse]0] to colors[noparse][[/noparse]15] sets the 4 colors for the tiles a row at a time. How do I set this for an individual tile? If 0 to 15 seems to set the colors for the whole screen, why repeat the color init from 0 to 63?
Thanks all.
Jason
Comments
Depending on the I/O driver, the color table can apply to each character (tile) or it can apply to an entire line of text. For the TV driver, the color table is applied on a per character basis or per tile (for graphics).
For the TV text driver, there's a control character followed by a color # that sets the color table entry to be used until it's changed. For the graphics driver, I think it uses a color table entry for each row of tiles on the display (12 rows). You could probably add a call to the graphics driver that would change the tile pointers to use other color table entries, but that's the way the tile pointers are currently initialized.
The initialization routine is:
You'd need to change the "(dy & $3F)" term to something else depending on what you want.
That looks a littel more complicated than I figured it would be, but its all mysterious until one really understands it. What does the "dy & $3F" signify? If the graphics driver assigns colors a row at a time, that explains what I understand so far. The code that you have here, that is pointing the graphics driver to the TV color setup?
The (dy & $3F) << 10 just sets the upper 6 bits of the tile pointer to the row number (dy).
Just to confuse things, the VGA drivers use a different format for the tile pointer. There the lower 6 bits contain the color table entry number.