<!-- PDF page 109 -->

where *bits* can be **8** or **9**.

The default colour mode of *Layer 1* modes (except *LoRes* and *HiRes*) is the standard *colour attribute display* one. In order to enable the *extended colour attribute display* mode we need to enable the *EnhancedULA* functionality. For this you must use the **PALETTE FORMAT** which takes the form:

**PALETTE FORMAT** *ink_count*

where *ink_count* is a numerical expression specifying the number of inks to be in the palette (0,1,3,7,15,31,63,127 or 255). When the *EnhancedULA* is enabled, **BRIGHT** and **FLASH** are ignored, and **INK** and **PAPER** accept the appropriate new range of values. Note here that although you can specify **INK** and **PAPER** values up to 255 when writing a program, attempting to execute the program in Layer 0 will result into a **K Invalid Colour** error when the *EnhancedULA* is not enabled. To disable the *EnhancedULA* functionality you will need to specify an ink count of **0**. The standard attributes with 8 inks, 8 papers, bright and flash are then once again supported.

As we saw in *Fig. 13* there is an order of display of different layers on screen. Although it is not immediately apparent this means that it's also possible to mix display output from more than one graphical layers. That is achieved by assigning a *global transparency mask* for the regular layers or, in the case of the *Sprites* layer, a *transparency index*, and then colouring the areas or sprites we want to be transparent with the specific colour.

You can set the *transparency colour mask* or *transparency colour index* using the following statement:

**PALETTE OVER** *value*

where *value* is an 8-bit numeric expression which identifies a colour either in R3G3B2 8-bit format (in the case of regular graphics layers) or the index to the 9bit colour value we want to be transparent (in the case of the *Sprites* layer). The default *global transparency mask* and *transparency colour index* is **light magenta / 227** (**11100011** in binary).

To reset all palette data and settings to default, use the **PALETTE CLEAR** statement.

In the *Palette-based hybrid linear bitmapped colour display* section, we first discussed the existence of two palettes per display layer (note here that in this case layer is meant in the memory usage paradigm displayed in *Fig. 13* so *ULA layers* get grouped together).

We can switch between palettes using the compound keyword:

**LAYER PALETTE** *n*

where *n* is the palette to use (**0** or **1**) for the current *memory usage layer* (ie. if you're in any *ULA layer* all of it gets affected but not *Layer 2* etc).

You can point a palette for the current layer to palette data you have previously stored in memory using the following compound command:

**LAYER PALETTE** *number* **BANK** *bank*, *offset*

where *number* is the palette to update (**0** or **1**) for the current *memory usage layer*, *bank* is the memory bank to point to, and *offset* is the offset within that memory bank (For more information about **BANK** see *Chapter 23 – The Memory*).

Palette data should be either 256 double byte colour entries (for 9-bit), or 256 single byte entries (for 8-bit). As per what we discussed earlier in the chapter we need to encode the colour information in an R3G3B2 (for 8-bit) or RGB3 (for 9-bit) with every colour component value describing 8 intensities per colour.

In the double-byte entry method, the second byte in each sequence only has one bit defined for colour: the 3rd blue bit as well as one bit for priority (which only applies to palettes

