Prev: 913E Up: Map Next: 9171
9148: Read Kempston Joystick
Used by the routine at Controls.
Output
C Key press input
The response will be:
Byte Meaning
00 Select (fire)
01 Up
02 Down
03 Left
04 Right
FF No input
Controls_ReadKempston 9148 LD B,$3A Set a read counter of 3A.
Controls_ReadKempston_Loop 914A IN A,($1F) Read Kempston Joystick input.
914C DJNZ Controls_ReadKempston_Loop Decrease the read counter by one and loop back to Controls_ReadKempston until the counter is zero.
914E LD C,$00 Return with C being 00 if "fire" has been pressed.
9150 CP $10
9152 RET Z
9153 INC C Return with C being 01 if "up" has been pressed.
9154 CP $04
9156 RET Z
9157 INC C Return with C being 02 if "down" has been pressed.
9158 CP $08
915A RET Z
915B INC C Return with C being 03 if "left" has been pressed.
915C CP $02
915E RET Z
915F INC C Return with C being 04 if "right" has been pressed.
9160 CP $01
9162 RET Z
9163 CALL $02BF Call KEYBOARD.
9166 LD A,($5C08) Jump to QuitGame if LAST-K (last key pressed) is 0E.
9169 CP $0E
916B JP Z,QuitGame
916E LD C,$FF C=FF.
9170 RET Return.
Prev: 913E Up: Map Next: 9171