cpct_isKeyPressed_asm

Assembly callable version of cpct_isKeyPressed (only callable from ASM)

Input Parameters (2 Bytes)

(2B BC) keyIdA 16-bit value containing a Matrix Line(1B, C) and a Bit Mask(1B, B).

Assembly call (Input parameters on registers)

call cpct_isKeyPressed_asm

Parameter Restrictions

  • keyID (BC) must be a valid cpct_keyID, containing a Matrix Line (1st byte, 0-9) and a Bit Mask (2nd byte, only 1 bit enabled).  All keyID values are defined in cpct_keyID enum.  Giving any other value is possible, but returned value would be meaningless.  If given value asks for a Matrix Line greater than 9, unexpected results may happen.

Return value

Afalse (0, if not pressed) or true (>0, if pressed).  Take into account that true is not 1, but any non-0 number.

Details

Performs the same operation as cpct_isKeyPressed but is designed to be called from assembly code only.  It receives a cpct_keyID value on BC register and checks if that key was pressed at the last keyboard scan.  A register holds return value, with a 0 if key was not pressed, and a value different than 0 (not necessary 1) if the key was pressed.

Destroyed Register values

A, BC, D, HL

Required memory

11 bytes

Time Measures

Case | Cycles | microSecs (us)
-------------------------------
Any  |   47   |    11.75
-------------------------------
Checks if a concrete key is pressed or not.
Enumerated type with symbols for all the 80 possible Key/Joy definitions.
Close