Back to Skool Routines
29178: Collect offset from keypress table
Used by the routines at 29278, 29462, 62483 and 64316. Returns with the zero flag set if no game keys were pressed. Otherwise returns with A holding the offset from the keypress table corresponding to the last key pressed.
29178 CALL 29118 Collect the code of the last key pressed in A
29181 RET Z Return if no key was pressed
29182 SUB 48 We're only interested in keys with codes 48 onwards
29184 JR C,29176 Jump if none of these was pressed
29186 LD L,A Point HL at the relevant entry in the keypress table
29187 LD H,229
29189 LD A,(HL) Pick up the offset from that table
29190 AND A Set the zero flag if the offset is 0 (i.e. not a game key)
29191 RET
The offset from the keypress table (an even number from 80 to 120) points at an entry in the keypress address table at 58704. Each entry in that table is the address of the routine for handling the keypress:
Offset Entry address Routine Purpose
80 58704 28460 Left (fast)
82 58706 28436 Right (fast)
84 58708 28484 Up (fast)
86 58710 28576 Down (fast)
88 58712 28460 Left (slow)
90 58714 28436 Right (slow)
92 58716 28484 Up (slow)
94 58718 28576 Down (slow)
96 58720 0 Unused
98 58722 62423 Sit
100 58724 57637 Catch mouse/frog
102 58726 57893 Release mouse
104 58728 24296 Fire catapult
106 58730 29574 Mount bike
108 58732 28992 Drop stinkbomb
110 58734 63898 Fire water pistol
112 58736 24263 Hit
114 58738 23887 Jump
116 58740 24348 Kiss
118 58742 23863 Throw away water pistol
120 58744 24133 Write