Prev: 45306 Up: Map Next: 45359
45315: Controls: Cursor Joystick
Used by the routine at HandlerControls.
Output
A Joystick controls
C Joystick controls
Initialise the controls as "none" in C.
ReadCursorJoystick 45315 LD C,0 C=0.
The cusor keys are covered by different ports.
HandleCursorJoystick_Port_F7 45317 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
45319 OUT (253),A
45321 IN A,(254)
Check joystick "LEFT".
ReadCursorJoystick_Left 45323 BIT 4,A Has key "5" been pressed?
45325 JR NZ,HandleCursorJoystick_Port_EF If not jump to HandleCursorJoystick_Port_EF.
45327 SET 0,C Set bit 0 of C.
Handle the other port.
HandleCursorJoystick_Port_EF 45329 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
45331 OUT (253),A
45333 IN A,(254)
Check joystick "DOWN".
ReadCursorJoystick_Down 45335 BIT 4,A Has key "6" been pressed?
45337 JR NZ,ReadCursorJoystick_Up If not jump to ReadCursorJoystick_Up.
45339 SET 3,C Set bit 3 of C.
Check joystick "UP".
ReadCursorJoystick_Up 45341 BIT 3,A Has key "7" been pressed?
45343 JR NZ,ReadCursorJoystick_Right If not jump to ReadCursorJoystick_Right.
45345 SET 2,C Set bit 2 of C.
Check joystick "RIGHT".
ReadCursorJoystick_Right 45347 BIT 2,A Has key "8" been pressed?
45349 JR NZ,ReadCursorJoystick_Fire If not jump to ReadCursorJoystick_Fire.
45351 SET 1,C Set bit 1 of C.
Check joystick "FIRE".
ReadCursorJoystick_Fire 45353 BIT 0,A Has key "0" been pressed?
45355 RET NZ If not then return.
45356 SET 4,C Set bit 4 of C.
45358 RET Return.
Prev: 45306 Up: Map Next: 45359