![]() |
Routines |
| Prev: 37771 | Up: Map | Next: 37822 |
|
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 | 37784 | LD A,239 | Read from the keyboard;
|
|||||||||||||||||
| 37786 | OUT (253),A | |||||||||||||||||||
| 37788 | IN A,(254) | |||||||||||||||||||
| 37790 | LD C,A | Keep the keys in C. | ||||||||||||||||||
| 37791 | AND %00001000 | Keep only bit 3 (up). | ||||||||||||||||||
| 37793 | LD E,A | Keep up in E. | ||||||||||||||||||
| 37794 | LD A,C | Fetch the keys. | ||||||||||||||||||
| 37795 | RRCA | Rotate A right twice. | ||||||||||||||||||
| 37796 | RRCA | |||||||||||||||||||
| 37797 | AND %01000101 | Keep only bits 0, 2 and 6 (right, down and fire). | ||||||||||||||||||
| 37799 | OR E | Combine right, down and fire with up. | ||||||||||||||||||
| 37800 | LD E,A | Keep the keys so far in E. | ||||||||||||||||||
| 37801 | RRCA | Rotate A right twice, which moves fire to bit 4. | ||||||||||||||||||
| 37802 | RRCA | |||||||||||||||||||
| 37803 | AND %00010000 | Keep only bit 4. | ||||||||||||||||||
| 37805 | OR E | Combine fire with the keys so far. | ||||||||||||||||||
| 37806 | AND %00011111 | Keep only bits 0-4. | ||||||||||||||||||
| 37808 | LD E,A | Keep the keys so far in E. | ||||||||||||||||||
| 37809 | LD A,247 | Read from the keyboard;
|
||||||||||||||||||
| 37811 | OUT (253),A | |||||||||||||||||||
| 37813 | IN A,(254) | |||||||||||||||||||
| 37815 | RRA | Rotate A right three times, which moves left (5) to bit 1. | ||||||||||||||||||
| 37816 | RRA | |||||||||||||||||||
| 37817 | RRA | |||||||||||||||||||
| 37818 | AND %00000010 | Keep only bit 1. | ||||||||||||||||||
| 37820 | OR E | Combine left with the keys so far. | ||||||||||||||||||
| 37821 | RET | Return. | ||||||||||||||||||
| Prev: 37771 | Up: Map | Next: 37822 |