Reads the status of keyboard and joysticks and stores it in the 10 bytes reserved as cpct_keyboardStatusBuffer. This function is ~25% faster than standard cpct_scanKeyboard.
void cpct_scanKeyboard_f ()
cpct_keyboardStatusBuffer filled up with pressed / not pressed info about all the 80 available Amstrad CPC’s keys / buttons.
call cpct_scanKeyboard_f_asm
This function disables interrupts while does keyboard scanning. Interrupts are enabled at the end, when scanning has finished.
This function does the same as cpct_scanKeyboard but using an unrolled loop to gain 42 microseconds (~25% performance increase, with a cost of 57 bytes more in memory requirements for code, ~116% increase). This function reads the pressed / not pressed status of the entire set of 80 keys / buttons from the Amstrad CPC and writes this status in cpct_keyboardStatusBuffer. cpct_keyboardStatusBuffer is a 10-bytes buffer (80 bits) that holds 1 bit for each key / button of the Amstrad CPC, meaning 0 = pressed, and 1 = not pressed. This codification is the same as the one returned by the AY-3-8912 chip, which reads the keyboard when Programmable Peripheral Interface (PPI) chip demands it. For more details on how all this process works, check Keyboard topic.
AF, BC, DE, HL
106 bytes
Case | microSecs (us) | CPU Cycles ------------------------------------ Any | 170 | 680 ------------------------------------
This fragment of code is based on a scanKeyboard code issued by CPCWiki. This version of the code is, however, ~60% faster than CPCWiki’s.
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]