DrGary
11-12-2006, 06:26 AM
Here's the comment about the screen memory in the TV driver:
''· tv_screen
''
''··· pointer to words which define screen contents (left-to-right, top-to-bottom)
''····· number of words must be tv_ht * tv_vt
''····· each word has two bitfields: a 6-bit colorset ptr and a 10-bit pixelgroup ptr
''······· bits 15..10: select the colorset* for the associated pixel tile
''······· bits 9..0: select the pixelgroup** address %ppppppppppcccc00 (p=address, c=0..15)
''
''······ * colorsets are longs which each define four 8-bit colors
''
''····· ** pixelgroups are <tileheight> longs which define (left-to-right, top-to-bottom) the 2-bit
''········ (four color) pixels that make up a 16x16 or a 32x32 pixel tile
The screen is laid out in words with each word identifying the tile ("pixelgroup") and the colorset at the given location.
For tiles, you can have 2^10 tiles that you put in the 192 (16x12) screen locations. The tile index the the lower 10 bits of the screen word.
For colorsets, you can have 2^6 colorsets. The colorset index is the upper 6 bits of the screen word. Each colorset can have 4 colors, for a total of 256 colors on screen.
So what does this comment mean?
·············· address %ppppppppppcccc00 (p=address, c=0..15)
······
Why are two highest order bits 0? In the demo code, graphics.spin, the colorset value is bit-anded with $3F, ie, six 1s.
Also, why are the bits drawn in reverse order? Propeller chip words are stored in little-endian order, so if this is showing the in-memory representation, shouldn't it be:
···· pppppppp ccccccpp
····
?
''· tv_screen
''
''··· pointer to words which define screen contents (left-to-right, top-to-bottom)
''····· number of words must be tv_ht * tv_vt
''····· each word has two bitfields: a 6-bit colorset ptr and a 10-bit pixelgroup ptr
''······· bits 15..10: select the colorset* for the associated pixel tile
''······· bits 9..0: select the pixelgroup** address %ppppppppppcccc00 (p=address, c=0..15)
''
''······ * colorsets are longs which each define four 8-bit colors
''
''····· ** pixelgroups are <tileheight> longs which define (left-to-right, top-to-bottom) the 2-bit
''········ (four color) pixels that make up a 16x16 or a 32x32 pixel tile
The screen is laid out in words with each word identifying the tile ("pixelgroup") and the colorset at the given location.
For tiles, you can have 2^10 tiles that you put in the 192 (16x12) screen locations. The tile index the the lower 10 bits of the screen word.
For colorsets, you can have 2^6 colorsets. The colorset index is the upper 6 bits of the screen word. Each colorset can have 4 colors, for a total of 256 colors on screen.
So what does this comment mean?
·············· address %ppppppppppcccc00 (p=address, c=0..15)
······
Why are two highest order bits 0? In the demo code, graphics.spin, the colorset value is bit-anded with $3F, ie, six 1s.
Also, why are the bits drawn in reverse order? Propeller chip words are stored in little-endian order, so if this is showing the in-memory representation, shouldn't it be:
···· pppppppp ccccccpp
····
?