cpct_getHWColour

Converts a firmware colour value into its equivalent hardware one.

C Definition

u8 cpct_getHWColour (u8 firmware_colour)

Input Parameters (1 Bytes)

(1B BC) 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
  • BC = firmware_colour implies that B = 0 and C = firmware_colour

Parameter Restrictions

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

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

BC, HL

Required memory

40 bytes (13 bytes code, 27 bytes colour conversion table)

Time Measures

    Case   | Cycles  | microSecs (us)
---------------------------------------
    Any    |   63    |   15.75
---------------------------------------
Asm saving |  -32    |   -8.00
---------------------------------------
unsigned char (u8 = unsigned 8-bits, 1 byte )
Converts a firmware colour value into its equivalent hardware one.
Changes the hardware palette colour values (selecting new ones).
Close