cpct_fw2hw

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

C Definition

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

Input Parameters (3 Bytes)

(2B DE) fw_colour_arrayPointer to an array of firmware colour values (in the range [0-26])
(1B BC) sizeNumber 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

59 bytes (32 bytes code, 27 bytes colour conversion table)

Time Measures

   Case    |   Cycles    |  microSecs (us)
---------------------------------------------
  Best     |  68 + 61*NC |  17.00 + 15.25*NC
  Worst    |  68 + 65*NC |  17.00 + 16.25*NC
---------------------------------------------
Asm saving |     -58     |      24.50
---------------------------------------------
NC= 8      |  556 /  588 |  139.00 / 147.00
NC=16      | 1044 / 1108 |  261.00 / 277.00

NC=Number of colours to convert

Converts an array of firmware colour values into their equivalent hardware colour values.
unsigned char (u8 = unsigned 8-bits, 1 byte )
Close