Help with tile palette selector

Эмуляторы, поддерживающие TS-Conf

Postby chernandezba » Thu, 08.03.2018 19:16:28

Hi

According to the TSConf excel file, the Tile palette selector, TPAL, comes from:
"Tile Palette Selector, bits 0-1. Bits 2-3 are taken from PalSel register bits 6-7 or 4-5, dependently on tiles layer 1 or 0."
So it seems that bits 0,1 come from the tile descriptor, and bits 2-3 comes from the T0Pal or T1Pal bits (register 07AF).

But looking at the same excel file, T1Pal and T0Pal are described as:
T1PAL[7:6] T0PAL[7:6]

So it seems that the final palette selector comes from bits 0-1 of the tile descriptor, but bits 7-6 come from T1Pal or T0Pal (and I suppuse bits 5,4,3,2 are zero)
Even more, looking at unreal sources, seems that it is using t1pal and t0pal as bits 7-6:

comp.ts.tsu.tpal = (comp.ts.tsu.layer ? comp.ts.t1pal : comp.ts.t0pal) << 6; // Prepared Tile palette selector



Or.... maybe the final colour (as I may guess on the unreal sources) is:

Bit 7-6: T1Pal or T0Pal
Bit 5-4: TPAL (from tile descriptor)
Bits 3-0: colour from tile data

??

So... what is the right definition for the final tile palette selector?

Thanks
----

ZEsarUX
ZX Second-Emulator And Released for UniX
https://github.com/chernandezba/zesarux
chernandezba
 
Posts: 119
Joined: Wed, 28.06.2017 17:50:12

Postby TS-Labs » Fri, 09.03.2018 04:14:00

Hi.
CRAM has 256 cells, thus 8 bits in cell address.
Tiles and Sprites can use any of 256 CRAM cells, provided cells are adjacent in a block of 16 colors, e.g. indexes 1-15, 241-255 (indexes with four LSBs set to zero is a special case, see below).
Pixels in tiles generate their color indexes this way:
bits/meaning:
76543210
SSDDPPPP,
where:
- S - palette selector bit from PalSel,
- D - palette selector bit from Tile descriptor,
- P - pixel value (notice, that pixels with values 0 are transparent, so CRAM cells with index xxxx0000 are never displayed in Tile and Sprite layers).
Here TxPAL[7:6] come from.
User avatar
TS-Labs
 
Posts: 5018
Joined: Thu, 26.07.2012 01:29:56

Postby chernandezba » Fri, 09.03.2018 13:01:20

Thanks! So the right definition was my last one :)
----

ZEsarUX
ZX Second-Emulator And Released for UniX
https://github.com/chernandezba/zesarux
chernandezba
 
Posts: 119
Joined: Wed, 28.06.2017 17:50:12


Return to Emulators

Who is online

Users browsing this forum: No registered users and 0 guests

x