Prev: B0FA Up: Map Next: B12F
B103: Controls: Cursor Joystick
Used by the routine at HandlerControls.
Output
A Joystick controls
C Joystick controls
Initialise the controls as "none" in C.
ReadCursorJoystick B103 LD C,$00 C=00.
The cusor keys are covered by different ports.
HandleCursorJoystick_Port_F7 B105 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
B107 OUT ($FD),A
B109 IN A,($FE)
Check joystick "LEFT".
ReadCursorJoystick_Left B10B BIT 4,A Has key "5" been pressed?
B10D JR NZ,HandleCursorJoystick_Port_EF If not jump to HandleCursorJoystick_Port_EF.
B10F SET 0,C Set bit 0 of C.
Handle the other port.
HandleCursorJoystick_Port_EF B111 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
B113 OUT ($FD),A
B115 IN A,($FE)
Check joystick "DOWN".
ReadCursorJoystick_Down B117 BIT 4,A Has key "6" been pressed?
B119 JR NZ,ReadCursorJoystick_Up If not jump to ReadCursorJoystick_Up.
B11B SET 3,C Set bit 3 of C.
Check joystick "UP".
ReadCursorJoystick_Up B11D BIT 3,A Has key "7" been pressed?
B11F JR NZ,ReadCursorJoystick_Right If not jump to ReadCursorJoystick_Right.
B121 SET 2,C Set bit 2 of C.
Check joystick "RIGHT".
ReadCursorJoystick_Right B123 BIT 2,A Has key "8" been pressed?
B125 JR NZ,ReadCursorJoystick_Fire If not jump to ReadCursorJoystick_Fire.
B127 SET 1,C Set bit 1 of C.
Check joystick "FIRE".
ReadCursorJoystick_Fire B129 BIT 0,A Has key "0" been pressed?
B12B RET NZ If not then return.
B12C SET 4,C Set bit 4 of C.
B12E RET Return.
Prev: B0FA Up: Map Next: B12F