![]() |
Routines |
| Prev: 938B | Up: Map | Next: 93BE |
|
Used by the routine at ReadControls.
Reads the cursor keys in the same way as the controls from ReadControls are returned. Bit 0 is right (8), bit 1 is left (5), bit 2 is down (6), bit 3 is up (7) and bit 4 is fire (0). A bit is reset when the key is pressed.
|
||||||||||||||||||||
| ReadCursorKeys | 9398 | LD A,$EF | Read from the keyboard;
|
|||||||||||||||||
| 939A | OUT ($FD),A | |||||||||||||||||||
| 939C | IN A,($FE) | |||||||||||||||||||
| 939E | LD C,A | Keep the keys in C. | ||||||||||||||||||
| 939F | AND %00001000 | Keep only bit 3 (up). | ||||||||||||||||||
| 93A1 | LD E,A | Keep up in E. | ||||||||||||||||||
| 93A2 | LD A,C | Fetch the keys. | ||||||||||||||||||
| 93A3 | RRCA | Rotate A right twice. | ||||||||||||||||||
| 93A4 | RRCA | |||||||||||||||||||
| 93A5 | AND %01000101 | Keep only bits 0, 2 and 6 (right, down and fire). | ||||||||||||||||||
| 93A7 | OR E | Combine right, down and fire with up. | ||||||||||||||||||
| 93A8 | LD E,A | Keep the keys so far in E. | ||||||||||||||||||
| 93A9 | RRCA | Rotate A right twice, which moves fire to bit 4. | ||||||||||||||||||
| 93AA | RRCA | |||||||||||||||||||
| 93AB | AND %00010000 | Keep only bit 4. | ||||||||||||||||||
| 93AD | OR E | Combine fire with the keys so far. | ||||||||||||||||||
| 93AE | AND %00011111 | Keep only bits 0-4. | ||||||||||||||||||
| 93B0 | LD E,A | Keep the keys so far in E. | ||||||||||||||||||
| 93B1 | LD A,$F7 | Read from the keyboard;
|
||||||||||||||||||
| 93B3 | OUT ($FD),A | |||||||||||||||||||
| 93B5 | IN A,($FE) | |||||||||||||||||||
| 93B7 | RRA | Rotate A right three times, which moves left (5) to bit 1. | ||||||||||||||||||
| 93B8 | RRA | |||||||||||||||||||
| 93B9 | RRA | |||||||||||||||||||
| 93BA | AND %00000010 | Keep only bit 1. | ||||||||||||||||||
| 93BC | OR E | Combine left with the keys so far. | ||||||||||||||||||
| 93BD | RET | Return. | ||||||||||||||||||
| Prev: 938B | Up: Map | Next: 93BE |