Prev: C713 Up: Map Next: C794
C77D: Poll H Key
Used by the routine at C713.
Reads keyboard port BF bit 4 (the "H" key) on each pass of the inner loop. Key bits are active-low (00 = pressed); if "H" is not pressed, D is decremented, otherwise E is decremented. Called from C713 while handling the attribute bar after the key has been detected.
PollHKey C77D LD D,$15 Initialise D to 15 (down-counter for "H" not pressed).
C77F LD E,$15 Initialise E to 15 (down-counter for "H" pressed).
C781 LD B,$14 Set an inner loop counter to 14 loops.
PollHKey_Loop C783 LD A,$BF Read from the keyboard;
Port Number Bit
0 1 2 3 4
BF ENTER L K J H
C785 IN A,($FE)
C787 AND %00010000 Keep only bit 4 ("H" key).
C789 JP NZ,PollHKey_NotPressed If "H" is not pressed (bit 4 is 1), jump to PollHKey_NotPressed to decrement D.
"H" key was pressed.
C78C DEC E Decrease E by one.
C78D JP PollHKey_Continue Jump to PollHKey_Continue (skip the D decrement).
PollHKey_NotPressed C790 DEC D Decrease D by one.
PollHKey_Continue C791 DJNZ PollHKey_Loop Decrease the inner loop counter and loop back to PollHKey_Loop until it reaches zero.
C793 RET Return.
Prev: C713 Up: Map Next: C794