![]() |
Routines |
| Prev: D12B | Up: Map | Next: D17C |
|
Used by the routine at ReadControls.
Reads a cursor joystick. 5 is left, 8 is right, 7 is up, 6 is down and 0 is fire.
|
||||||||||||||||||||
|
Start with no controls, and read 5 for left.
|
||||||||||||||||||||
| ReadCursorJoystick | D150 | LD C,$00 | Clear the controls. | |||||||||||||||||
| D152 | LD A,$F7 | Read from the keyboard;
|
||||||||||||||||||
| D154 | CALL ReadKeyboardPort | |||||||||||||||||||
| D157 | BIT 4,A | Set bit 0 if 5 is pressed. | ||||||||||||||||||
| D159 | JR Z,ReadCursorJoystick_SecondRow | |||||||||||||||||||
| D15B | SET 0,C | |||||||||||||||||||
|
Read 0, 7, 8 and 6.
|
||||||||||||||||||||
| ReadCursorJoystick_SecondRow | D15D | LD A,$EF | Read from the keyboard;
|
|||||||||||||||||
| D15F | CALL ReadKeyboardPort | |||||||||||||||||||
| D162 | BIT 0,A | Set bit 3 if 0 is pressed. | ||||||||||||||||||
| D164 | JR Z,ReadCursorJoystick_TestUp | |||||||||||||||||||
| D166 | SET 3,C | |||||||||||||||||||
|
Set bit 2 if 7 is pressed.
|
||||||||||||||||||||
| ReadCursorJoystick_TestUp | D168 | BIT 3,A | Set bit 2 if 7 is pressed. | |||||||||||||||||
| D16A | JR Z,ReadCursorJoystick_TestRight | |||||||||||||||||||
| D16C | SET 2,C | |||||||||||||||||||
|
Set bit 1 if 8 is pressed.
|
||||||||||||||||||||
| ReadCursorJoystick_TestRight | D16E | BIT 2,A | Set bit 1 if 8 is pressed. | |||||||||||||||||
| D170 | JR Z,ReadCursorJoystick_TestDown | |||||||||||||||||||
| D172 | SET 1,C | |||||||||||||||||||
|
Set bit 4 if 6 is pressed, and jump to ReadControls_Rotate.
|
||||||||||||||||||||
| ReadCursorJoystick_TestDown | D174 | BIT 4,A | Jump to ReadControls_Rotate if 6 is not pressed. | |||||||||||||||||
| D176 | JR Z,ReadControls_Rotate | |||||||||||||||||||
| D178 | SET 4,C | Set bit 4, and jump to ReadControls_Rotate. | ||||||||||||||||||
| D17A | JR ReadControls_Rotate | |||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||
| Prev: D12B | Up: Map | Next: D17C |