Changes one colour value of the Palette, similarly to BASIC’s INK instruction.
void cpct_setPALColour (u8 pen, u8 hw_ink)
(1B L) pen | [0-16] Index of the palette colour to change. Similar to PEN Number in BASIC. |
(1B H) hw_ink | [0-31] New hardware colour value for the given palette index. |
call cpct_setPALColour_asm
This function requires the CPC firmware to be DISABLED. Otherwise, it may not work, as firmware tends to restore palette colour values to its own selection.
This function modifies changes one concrete palette registers to set the hardware value of one of the available colours. This process is similar to the one that does the BASIC’s INK command. However, this function does it giving a direct command to the PAL chip (which is inside the Gate Array). The PAL chip contains the 17 registers that hold the colour values for the 16 available colours of the Amstrad CPC (PENs), and the screen border colour.
Gate Array (GA) is accessed through the port 0x7F. PENR and INKR commands are used to select the register that will be modified and then sending the new hardware colour value to set. It is important to remember that this commands are processed by the PAL chip and it requires hardware colour values for INKR, which are different from firmware colour values (which are used by BASIC’s INK command).
F, BC, HL
C-bindings | 12 bytes |
ASM-bindings | 10 bytes |
Case | microSecs (us) | CPU Cycles ------------------------------------------ Any | 25 | 100 ------------------------------------------ ASM-Saving | -9 | -36 ------------------------------------------
This function has been constructed with great help from the documentation at Grimware about the Gate Array.
http://www.grimware.org