# cpct_getHWColour

Converts a firmware colour value into its equivalent hardware one.

#### C Definition

u8 cpct_getHWColour (u16 firmware_colour)

#### Input Parameters (2 Bytes)

(2B HL) firmware_colour | [0-26] Firmware colour value to be converted (Similar to BASIC’s INK value)

#### Assembly call (Input parameters on registers)

>     call cpct_getHWColour_asm

#### Parameter Restrictions

- firmware_colour must be in the range [0-26], otherwise, return value will be undefined.

#### Return Value

<u8> | [0-31] Hardware colour value corresponding to firmware_colour provided.

#### Details

Uses the firmware_colour as index in a conversion table to get its equivalent hardware value. You can find this equivalences in the table 1 of the cpct_setPalette explanation.

#### Destroyed Register values

HL, DE

#### Required memory

6 bytes

- 27 bytes cpct_firmware2hw_colour conversion table

#### Time Measures

>         Case   | microSecs(us) | CPU Cycles
>     -----------------------------------------
>         Any    |      11       |     44
>     -----------------------------------------

unsigned char (u8 = unsigned 8-bits, 1 byte )
Converts a firmware colour value into its equivalent hardware one.
unsigned int (u16 = unsigned 16-bits, 2 bytes)
Changes the hardware palette colour values (selecting new ones).
Close