Prev: 00703 Up: Map Next: 00819
00798: THE 'K-TEST' SUBROUTINE
Used by the routines at KEYBOARD and S_INKEY.
The key value is tested and a return made if 'no-key' or 'shift-only'; otherwise the 'main code' for that key is found.
Input
D Shift key pressed (24 or 39), or 255 if no shift key pressed
E Other key pressed (0 to 39), or 255 if no other key pressed
Output
A Main code (from the main key table)
F Carry flag reset if an invalid combination of keys is pressed
K_TEST 00798 LD B,D Copy the shift byte.
00799 LD D,0 Clear the D register for later.
00801 LD A,E Move the key number.
00802 CP 39 Return now if the key was 'CAPS SHIFT' only or 'no-key'.
00804 RET NC
00805 CP 24 Jump forward unless the E key was SYMBOL SHIFT.
00807 JR NZ,K_MAIN
00809 BIT 7,B However accept SYMBOL SHIFT and another key; return with SYMBOL SHIFT only.
00811 RET NZ
The 'main code' is found by indexing into the main key table.
K_MAIN 00812 LD HL,517 The base address of the main key table.
00815 ADD HL,DE Index into the table and fetch the 'main code'.
00816 LD A,(HL)
00817 SCF Signal 'valid keystroke' before returning.
00818 RET
Prev: 00703 Up: Map Next: 00819