Questions about the VGA_Tile_Driver_Demo2 code
retromicro
Posts: 24
Hi
I've been messing around with this code, removing all the Lincoln and mouse stuff and adding my own code so that the Prop displays VGA output from my Z80 homebrew system.
However, there are some questions about the code (and the associated VGA_1280x1024_Tile_Driver_With_Cursor object that it uses).
Issues -
Thanks
I've been messing around with this code, removing all the Lincoln and mouse stuff and adding my own code so that the Prop displays VGA output from my Z80 homebrew system.
However, there are some questions about the code (and the associated VGA_1280x1024_Tile_Driver_With_Cursor object that it uses).
Issues -
- I can see in the code that I can call 'print' with $110 to $11F to specify a foreground text colour. That works fine. However, I'm not sure how to force a different background colour.
- The code uses the constant 'spacetile' = $220 which is used by the clear screen utility (which loads this value into the screen buffer array). However, I'm not actually sure where the $220 comes from. I don't see any fonts being loaded but there's some mention in the library code about the built-in fonts. If you change to say, $222, the screen will fill with some graphic character not shown in the Prop font table. The library code also says that the bottom ten bits hold the base address of a bitmap. However, $220 = 544 which looks greater than the size of the internal fonts.
- The library has a comment stating that the top six bits are used as a pointer to the colour palette. There's also some info about colours with quaternary numbers. I'm not sure if each palette entry refers to both a foreground and background colour.
- The library has a comment stating that the color_ptr should be pointing to a table of 64 longs with the palettes info. However, the example code only defines 24 longs. Just lazy coding ?
Thanks
Comments
value = (tile_pointer >> 6) + (color << 10)
tile_pointer = $200 (<<6 = $8000, beginning of ROM font) + $20 (=32 = space) Each palette entry refers to both a foreground and a background color. Each nibble is a list of four colors, because of how the bitmap font works (read the propeller manual section about the ROM font). Colors can be expressed as quaternary, %%rrggbb00. Each color is one byte in the long. There are two longs for each color - the first has bytes arranged as fbfb and the second is arranged as $ffbb, where f and b stand for foreground and background colors, respectively.
If only the first 24 are ever used, only they have to be defined. If you tell it to use the 25th color, you could get any color, because it was never defined. Defining all 64 would be a waste of RAM if they don't have any real values.
1 arguably the 512x384 bitmap driver being an exception