Checks if a concrete key is pressed or not.
u8 cpct_isKeyPressed (cpct_keyID key);
(2B HL) key | A 16-bit value containing a Matrix-Line(1B, L) and a BitMask(1B, H). |
call cpct_isKeyPressed_asm
<u8> | false (0, if not pressed) or true (>0, if pressed). Take into account that true is not 1, but any non-0 number. |
Checks if a concrete key is pressed or not. It does it looking at the cpct_keyboardStatusBuffer, which is an 80-bit array holding the pressed / not pressed status of each of the 80 keys in the CPC keyboard. Matrix Line is used to determine which of the 10 bytes in the buffer contains the bit associated to the key, then Bit Mask is used to get the concrete bit using XOR and AND operations.
The cpct_keyboardStatusBuffer is just an array in memory that must be updated with current key status. To do this, cpct_scanKeyboard routines must be used before calling this function.
A, D, BC, HL
12 bytes
Case | microSecs (us) | CPU Cycles ------------------------------------------- Any | 14 | 56 -------------------------------------------
10-bytes (80-bits) array containing pressed / not pressed status of all the keys / buttons the Amstrad CPC can manage (up to 80).
extern u8 cpct_keyboardStatusBuffer[10]