# cpct_fw2hw

Converts an array of firmware colour values into their equivalent hardware colour values.

#### C Definition

void cpct_fw2hw (void* <fw_colour_array*, u16 size);

#### Input Parameters (4 Bytes)

(2B DE) fw_colour_array | Pointer to an array of firmware colour values (in the range [0-26])
(2B BC) size | Number of colour values in the array

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

>     call cpct_fw2hw_asm

- BC = size implies that B = 0, C = size

#### Parameter Restrictions

- fw_colour_array must be an array of values in the range [0-26], otherwise, return value will be unexpected.
- size must be the number of elements in the array, and must be at least 1. A size of 0 would make this function overwrite 256 values in memory. Similarly, a value greater than the actual size of the array would result in some values outside the array being overwritten.

#### Details

Converts an array of firmware colour values into their equivalent hardware colour values. It directly modifies the array passed to the function, overwritting the its values with the hardware colour values.

#### Destroyed Register values

AF, BC, DE, HL

#### Required memory

C-bindings | 19 bytes
ASM-bindings | 15 bytes

- 27 bytes colour conversion table

#### Time Measures

>        Case    |  microSecs (us) | CPU Cycles
>     ---------------------------------------------
>       Any      |  16 + 18*NC     |  64 + 72*NC
>     ---------------------------------------------
>     Asm saving |     -13         |    -52
>     ---------------------------------------------
>     NC= 4      |      88         |    352
>     NC=16      |     304         |   1216

NC=Number of colours to convert

Converts an array of firmware colour values into their equivalent hardware colour values.
unsigned int (u16 = unsigned 16-bits, 2 bytes)
Close