Checks if there is at least one key pressed. This function does the same as cpct_isAnyKeyPressed but ~73% faster.
call cpct_isAnyKeyPressed_f_asm
<u8> | false (0, no single key is pressed) or true (>0, at least one key is pressed). Take into account that true is not 1, but any non-0 number. Return value is placed in registers A and L (same value for both) |
Checks if at least one key from the keyboard is pressed. 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. If at least one key is pressed, one of the 80-bits representing the keys must be set to 0 (which means that key is pressed right now). This is exactly the same as its brother function cpct_isAnyKeyPressed but using an unrolled version of the loop that makes it ~73% faster. However, it’s counterpart is requiring more space for performing the operation.
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, B, HL
27 bytes
Case | microSecs (us) | CPU Cycles ------------------------------------------- Any | 48 | 192 -------------------------------------------
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]