Difference between revisions of "Enhanced ULA Palette Extension"

From SpecNext official Wiki
Jump to: navigation, search
(Fixing read/write vs index auto increment description, thanks to Garry help on Facebook to identify the mistake)
(updated to 78a6ee50)
 
(4 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
|Readable=Yes
 
|Readable=Yes
 
|Writable=Yes
 
|Writable=Yes
|ShortDesc=Use to set 9-bit (2-byte) colours of the ULANext palette, or to read second byte of colour.
+
|ShortDesc=Use to set 9-bit (2-byte) colours of the Enhanced ULA palette, or to read second byte of colour.
 
}}
 
}}
 
Two consecutive writes are needed to write the 9 bit colour:
 
Two consecutive writes are needed to write the 9 bit colour:
Line 11: Line 11:
 
(to detect whether first or second write is expected, one can read bit 7 of {{NextRegNo|$03}}, in case your code is not aware of current state)
 
(to detect whether first or second write is expected, one can read bit 7 of {{NextRegNo|$03}}, in case your code is not aware of current state)
  
If writing the Layer 2 palette colour, in the second byte, bit 7 is "priority" bit. Priority colour will be always on top (drawn above Sprites), even on an "SLU" priority arrangement. If you need the exact same colour with priority and non priority, you will need to program the same colour twice changing bit 7 to 0 for the non priority colour variant.
+
If writing the Layer 2 palette colour, in the second byte, bit 7 is "priority" bit. Priority colour will be always on top (drawn above all other layers), even on a priority arrangement like "USL" . If you need the exact same colour with priority and non priority, you will need to program the same colour twice, changing bit 7 to 0 for the non priority colour alternative.
  
 
After the write of second byte, the palette index is auto-incremented, if the auto-increment is enabled by {{NextRegNo|$43}}.
 
After the write of second byte, the palette index is auto-incremented, if the auto-increment is enabled by {{NextRegNo|$43}}.
  
 
The read will always read the second byte of colour (%p000000B) and it will not modify the index.
 
The read will always read the second byte of colour (%p000000B) and it will not modify the index.
 +
 +
Writes to nextreg 0x40, 0x41, 0x43 reset to the 1st write.
  
 
The modified palette remains until a Hard Reset.
 
The modified palette remains until a Hard Reset.

Latest revision as of 11:38, 3 November 2024

Number $44
Readable Yes
Writable Yes
Short Description Use to set 9-bit (2-byte) colours of the Enhanced ULA palette, or to read second byte of colour.

Two consecutive writes are needed to write the 9 bit colour:

  • 1st write: bits 7-0 = RRRGGGBB
  • 2nd write: bits 7-1 are reserved, must be 0 (except bit 7 for Layer 2), bit 0 = lsb B

(to detect whether first or second write is expected, one can read bit 7 of Machine Type Register ($03), in case your code is not aware of current state)

If writing the Layer 2 palette colour, in the second byte, bit 7 is "priority" bit. Priority colour will be always on top (drawn above all other layers), even on a priority arrangement like "USL" . If you need the exact same colour with priority and non priority, you will need to program the same colour twice, changing bit 7 to 0 for the non priority colour alternative.

After the write of second byte, the palette index is auto-incremented, if the auto-increment is enabled by Enhanced ULA Control Register ($43).

The read will always read the second byte of colour (%p000000B) and it will not modify the index.

Writes to nextreg 0x40, 0x41, 0x43 reset to the 1st write.

The modified palette remains until a Hard Reset.