Sets the value of a selected group of 4 bits (nibble) into a bitarray to [0-15]
void cpct_set4Bits (void* array, u16 value, u16 index)
(2B DE) array | Pointer to the first byte of the array |
(2B HL) index | Position of the group of 4 bits in the array to be modified |
(2B BC) value | New value [0-15] for the group of 4 bits at the given position. If you call from assembly, you can safely ignore B register and set only C register. |
call cpct_set4Bits_asm
Set the new value of the 4-bits group (nibble) at the given position (index) in the specified array. This function assumes that the array elements have a size of 8 bits and also that the given index is not bigger than the number of nibbles in the array (size of the array multiplied by 2). The value to be set is also assumed to be in the range [0-15] but other values will “work” (just the 4 Least Significant Bits will be used, so value module 16 will be inserted).
AF, BC, DE, HL
C-bindings | 28 bytes |
ASM-bindings | 24 bytes |
Case | microSecs(us) | CPU Cycles ----------------------------------------- Best (1) | 40 | 160 ----------------------------------------- Worst (0) | 45 | 180 ----------------------------------------- Asm saving | -15 | -60 -----------------------------------------