![]() |
Routines |
| Prev: B0FA | Up: Map | Next: B12F |
|
Used by the routine at HandlerControls.
Reads a Cursor joystick, which is mapped onto the keys "5" to "8" and "0".
|
||||||||||||||||||||
|
Initialise the controls as "none" in C.
|
||||||||||||||||||||
| ReadCursorJoystick | B103 | LD C,$00 | Clear the controls in C. | |||||||||||||||||
|
The cursor keys are covered by different ports.
|
||||||||||||||||||||
| HandleCursorJoystick_Port_F7 | B105 | LD A,$F7 | Read from the keyboard;
|
|||||||||||||||||
| B107 | OUT ($FD),A | |||||||||||||||||||
| B109 | IN A,($FE) | |||||||||||||||||||
|
Check joystick "LEFT".
|
||||||||||||||||||||
| ReadCursorJoystick_Left | B10B | BIT 4,A | Jump to HandleCursorJoystick_Port_EF if "LEFT" (key "5") is not being pressed. | |||||||||||||||||
| B10D | JR NZ,HandleCursorJoystick_Port_EF | |||||||||||||||||||
| B10F | SET 0,C | Set the "LEFT" bit (bit 0) of the controls in C. | ||||||||||||||||||
|
Handle the other port.
|
||||||||||||||||||||
| HandleCursorJoystick_Port_EF | B111 | LD A,$EF | Read from the keyboard;
|
|||||||||||||||||
| B113 | OUT ($FD),A | |||||||||||||||||||
| B115 | IN A,($FE) | |||||||||||||||||||
|
Check joystick "DOWN".
|
||||||||||||||||||||
| ReadCursorJoystick_Down | B117 | BIT 4,A | Jump to ReadCursorJoystick_Up if "DOWN" (key "6") is not being pressed. | |||||||||||||||||
| B119 | JR NZ,ReadCursorJoystick_Up | |||||||||||||||||||
| B11B | SET 3,C | Set the "DOWN" bit (bit 3) of the controls in C. | ||||||||||||||||||
|
Check joystick "UP".
|
||||||||||||||||||||
| ReadCursorJoystick_Up | B11D | BIT 3,A | Jump to ReadCursorJoystick_Right if "UP" (key "7") is not being pressed. | |||||||||||||||||
| B11F | JR NZ,ReadCursorJoystick_Right | |||||||||||||||||||
| B121 | SET 2,C | Set the "UP" bit (bit 2) of the controls in C. | ||||||||||||||||||
|
Check joystick "RIGHT".
|
||||||||||||||||||||
| ReadCursorJoystick_Right | B123 | BIT 2,A | Jump to ReadCursorJoystick_Fire if "RIGHT" (key "8") is not being pressed. | |||||||||||||||||
| B125 | JR NZ,ReadCursorJoystick_Fire | |||||||||||||||||||
| B127 | SET 1,C | Set the "RIGHT" bit (bit 1) of the controls in C. | ||||||||||||||||||
|
Check joystick "FIRE".
|
||||||||||||||||||||
| ReadCursorJoystick_Fire | B129 | BIT 0,A | Return if "FIRE" (key "0") is not being pressed. | |||||||||||||||||
| B12B | RET NZ | |||||||||||||||||||
| B12C | SET 4,C | Set the "FIRE" bit (bit 4) of the controls in C. | ||||||||||||||||||
| B12E | RET | Return. | ||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||
| Prev: B0FA | Up: Map | Next: B12F |