![]() |
Routines |
| Prev: 51455 | Up: Map | Next: 51540 |
|
Reads the controls from the Interface 2 joysticks, which are the keys 1 to 5 for the first joystick and 6 to 0 for the second joystick. The joysticks use the keys left, right, down, up and fire in that order, so the keys of the first joystick are reversed to put them in the same order as the keys of the second joystick.
|
||||||||||||||||||||
|
Reverse the keys 1 to 5.
|
||||||||||||||||||||
| ReadInterface2Joystick | 51483 | LD A,247 | Read from the keyboard;
|
|||||||||||||||||
| 51485 | CALL ReadKeyboardPort | |||||||||||||||||||
| 51488 | PUSH BC | Stash BC on the stack. | ||||||||||||||||||
| 51489 | LD B,5 | Set B to 5. | ||||||||||||||||||
| ReadInterface2Joystick_Reverse | 51491 | RRA | Rotate A right. | |||||||||||||||||
| 51492 | RL C | Rotate C left. | ||||||||||||||||||
| 51494 | DJNZ ReadInterface2Joystick_Reverse | Jump to ReadInterface2Joystick_Reverse until B is zero. | ||||||||||||||||||
| 51496 | LD A,C | Copy C to A. | ||||||||||||||||||
| 51497 | POP BC | Restore BC from the stack. | ||||||||||||||||||
| 51498 | LD C,A | Copy it to C. | ||||||||||||||||||
|
Merge the keys 6 to 0.
|
||||||||||||||||||||
| 51499 | LD A,239 | Read from the keyboard;
|
||||||||||||||||||
| 51501 | CALL ReadKeyboardPort | |||||||||||||||||||
| 51504 | OR C | Merge C. | ||||||||||||||||||
| 51505 | LD C,0 | Set C to 0. | ||||||||||||||||||
| 51507 | BIT 0,A | Set bit 3 of C if bit 0 of A is set. | ||||||||||||||||||
| 51509 | JR Z,ReadInterface2Joystick_TestUp | |||||||||||||||||||
| 51511 | SET 3,C | |||||||||||||||||||
| ReadInterface2Joystick_TestUp | 51513 | BIT 1,A | Set bit 2 of C if bit 1 of A is set. | |||||||||||||||||
| 51515 | JR Z,ReadInterface2Joystick_TestDown | |||||||||||||||||||
| 51517 | SET 2,C | |||||||||||||||||||
| ReadInterface2Joystick_TestDown | 51519 | BIT 2,A | Set bit 4 of C if bit 2 of A is set. | |||||||||||||||||
| 51521 | JR Z,ReadInterface2Joystick_TestRight | |||||||||||||||||||
| 51523 | SET 4,C | |||||||||||||||||||
| ReadInterface2Joystick_TestRight | 51525 | BIT 3,A | Set bit 1 of C if bit 3 of A is set. | |||||||||||||||||
| 51527 | JR Z,ReadInterface2Joystick_TestLeft | |||||||||||||||||||
| 51529 | SET 1,C | |||||||||||||||||||
| ReadInterface2Joystick_TestLeft | 51531 | BIT 4,A | Set bit 0 of C if bit 4 of A is set. | |||||||||||||||||
| 51533 | JR Z,ReadInterface2Joystick_Finish | |||||||||||||||||||
| 51535 | SET 0,C | |||||||||||||||||||
| ReadInterface2Joystick_Finish | 51537 | JP ReadControls_Finish | Jump to ReadControls_Finish. | |||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||
| Prev: 51455 | Up: Map | Next: 51540 |