![]() |
Routines |
| Prev: E239 | Up: Map | Next: E32C |
|
Used by the routine at UPDATE_KNIGHT.
Called once a turn by the knight's controls (UPDATE_KNIGHT). Reads the keyboard or a joystick, by the method in bits 1-2 of CONTROL, into one byte, CONTROLS: bit 0 left, 1 right, 2 up, 3 fire, 4 down, 5 turn the town round -- what each does is the knight's controls' business (UPDATE_KNIGHT). Bits 6 and 7 are never set.
The keyboard: X, V, B and M left, C and N right; the whole of the A-G and H-ENTER rows up; the whole of the Q-T and Y-P rows fire; any number key down. The bottom row is not alternate keys, as Pentagram's is (Z, C, M and B one way, X, V, SYMBOL SHIFT and N the other): here Z and SYMBOL SHIFT are the key that turns the town round, and of the rest X, V, B and M turn one way and C and N the other.
A joystick: the Kempston stick from port 31; the cursor keys, 5 left, 8 right, 7 up, 6 down and 0 fire; Interface II, the 6-0 keys for one stick (6 left, 7 right, 8 down, 9 up, 0 fire) and 1-5 for the other, read together. With any method, Z or SYMBOL SHIFT sets bit 5 (half-rows $7F and $FE read together: bit 1 is either). SPACE and CAPS SHIFT do nothing here: PAUSE reads them for the pause.
Measured in the simulator, a key or a stick direction at a time for each method: every key and direction sets the bits above and nothing else.
|
||||||||
| READ_CONTROLS | E241 | LD A,(CONTROL) | Bits 1-2 of CONTROL: 0 the keyboard, 1 Kempston, 2 the cursor keys, 3 Interface II | |||||
| E244 | RRCA | |||||||
| E245 | AND $03 | |||||||
| E247 | JP Z,READ_CONTROLS_17 | |||||||
| E24A | DEC A | |||||||
| E24B | JR Z,READ_CONTROLS_6 | |||||||
| E24D | DEC A | |||||||
| E24E | JR Z,READ_CONTROLS_12 | |||||||
| E250 | LD A,$F7 | Interface II: the 1-5 half-row, turned end for end so that 5 is bit 0 and 1 bit 4, as 0 and 6 are in the 6-0 half-row | ||||||
| E252 | CALL READ_KEYS | |||||||
| E255 | PUSH BC | |||||||
| E256 | LD B,$05 | |||||||
| READ_CONTROLS_0 | E258 | RRA | ||||||
| E259 | RL C | |||||||
| E25B | DJNZ READ_CONTROLS_0 | |||||||
| E25D | LD A,C | |||||||
| E25E | POP BC | |||||||
| E25F | LD C,A | |||||||
| E260 | LD A,$EF | ...ORed with the 6-0 half-row: bit 0 fire (0 or 5), 1 up (9 or 4), 2 down (8 or 3), 3 right (7 or 2), 4 left (6 or 1) | ||||||
| E262 | CALL READ_KEYS | |||||||
| E265 | OR C | |||||||
| E266 | LD C,$00 | Rearranged into the controls' bits | ||||||
| E268 | BIT 0,A | |||||||
| E26A | JR Z,READ_CONTROLS_1 | |||||||
| E26C | SET 3,C | |||||||
| READ_CONTROLS_1 | E26E | BIT 1,A | ||||||
| E270 | JR Z,READ_CONTROLS_2 | |||||||
| E272 | SET 2,C | |||||||
| READ_CONTROLS_2 | E274 | BIT 2,A | ||||||
| E276 | JR Z,READ_CONTROLS_3 | |||||||
| E278 | SET 4,C | |||||||
| READ_CONTROLS_3 | E27A | BIT 3,A | ||||||
| E27C | JR Z,READ_CONTROLS_4 | |||||||
| E27E | SET 1,C | |||||||
| READ_CONTROLS_4 | E280 | BIT 4,A | ||||||
| E282 | JR Z,READ_CONTROLS_5 | |||||||
| E284 | SET 0,C | |||||||
| READ_CONTROLS_5 | E286 | JP READ_CONTROLS_24 | On to the key that turns the town round | |||||
| READ_CONTROLS_6 | E289 | IN A,($1F) | Kempston: bit 0 right, 1 left, 2 down, 3 up, 4 fire, rearranged | |||||
| E28B | LD C,$00 | |||||||
| E28D | BIT 0,A | |||||||
| E28F | JR Z,READ_CONTROLS_7 | |||||||
| E291 | SET 1,C | |||||||
| READ_CONTROLS_7 | E293 | BIT 1,A | ||||||
| E295 | JR Z,READ_CONTROLS_8 | |||||||
| E297 | SET 0,C | |||||||
| READ_CONTROLS_8 | E299 | BIT 2,A | ||||||
| E29B | JR Z,READ_CONTROLS_9 | |||||||
| E29D | SET 4,C | |||||||
| READ_CONTROLS_9 | E29F | BIT 3,A | ||||||
| E2A1 | JR Z,READ_CONTROLS_10 | |||||||
| E2A3 | SET 2,C | |||||||
| READ_CONTROLS_10 | E2A5 | BIT 4,A | ||||||
| E2A7 | JR Z,READ_CONTROLS_11 | |||||||
| E2A9 | SET 3,C | |||||||
| READ_CONTROLS_11 | E2AB | JP READ_CONTROLS_24 | On to the key that turns the town round | |||||
| READ_CONTROLS_12 | E2AE | LD C,$00 | The cursor keys: 5 left | |||||
| E2B0 | LD A,$F7 | |||||||
| E2B2 | CALL READ_KEYS | |||||||
| E2B5 | BIT 4,A | |||||||
| E2B7 | JR Z,READ_CONTROLS_13 | |||||||
| E2B9 | SET 0,C | |||||||
| READ_CONTROLS_13 | E2BB | LD A,$EF | 0 fire, 7 up, 8 right, 6 down | |||||
| E2BD | CALL READ_KEYS | |||||||
| E2C0 | BIT 0,A | |||||||
| E2C2 | JR Z,READ_CONTROLS_14 | |||||||
| E2C4 | SET 3,C | |||||||
| READ_CONTROLS_14 | E2C6 | BIT 3,A | ||||||
| E2C8 | JR Z,READ_CONTROLS_15 | |||||||
| E2CA | SET 2,C | |||||||
| READ_CONTROLS_15 | E2CC | BIT 2,A | ||||||
| E2CE | JR Z,READ_CONTROLS_16 | |||||||
| E2D0 | SET 1,C | |||||||
| READ_CONTROLS_16 | E2D2 | BIT 4,A | ||||||
| E2D4 | JR Z,READ_CONTROLS_24 | |||||||
| E2D6 | SET 4,C | |||||||
| E2D8 | JR READ_CONTROLS_24 | |||||||
| READ_CONTROLS_17 | E2DA | LD A,$FE | The keyboard: X and V left, C right, from the CAPS SHIFT-V half-row turned two places | |||||
| E2DC | CALL READ_KEYS | |||||||
| E2DF | RRCA | |||||||
| E2E0 | RRCA | |||||||
| E2E1 | BIT 2,A | |||||||
| E2E3 | JR Z,READ_CONTROLS_18 | |||||||
| E2E5 | SET 0,A | |||||||
| READ_CONTROLS_18 | E2E7 | AND $03 | ||||||
| E2E9 | LD C,A | |||||||
| E2EA | LD A,$7F | M and B left, N right | ||||||
| E2EC | CALL READ_KEYS | |||||||
| E2EF | BIT 2,A | |||||||
| E2F1 | JR Z,READ_CONTROLS_19 | |||||||
| E2F3 | SET 0,C | |||||||
| READ_CONTROLS_19 | E2F5 | BIT 3,A | ||||||
| E2F7 | JR Z,READ_CONTROLS_20 | |||||||
| E2F9 | SET 1,C | |||||||
| READ_CONTROLS_20 | E2FB | BIT 4,A | ||||||
| E2FD | JR Z,READ_CONTROLS_21 | |||||||
| E2FF | SET 0,C | |||||||
| READ_CONTROLS_21 | E301 | LD A,$BD | A-G and H-ENTER: up | |||||
| E303 | CALL READ_KEYS | |||||||
| E306 | JR Z,READ_CONTROLS_22 | |||||||
| E308 | SET 2,C | |||||||
| READ_CONTROLS_22 | E30A | LD A,$DB | Q-T and Y-P: fire | |||||
| E30C | CALL READ_KEYS | |||||||
| E30F | JR Z,READ_CONTROLS_23 | |||||||
| E311 | SET 3,C | |||||||
| READ_CONTROLS_23 | E313 | LD A,$E7 | 1-5 and 6-0: down | |||||
| E315 | CALL READ_KEYS | |||||||
| E318 | JR Z,READ_CONTROLS_24 | |||||||
| E31A | SET 4,C | |||||||
| READ_CONTROLS_24 | E31C | LD A,$7E | Every method: Z or SYMBOL SHIFT turns the town round (bit 5) | |||||
| E31E | CALL READ_KEYS | |||||||
| E321 | BIT 1,A | |||||||
| E323 | JR Z,READ_CONTROLS_25 | |||||||
| E325 | SET 5,C | |||||||
| READ_CONTROLS_25 | E327 | LD A,C | Store the controls | |||||
| E328 | LD (CONTROLS),A | |||||||
| E32B | RET | |||||||
| Prev: E239 | Up: Map | Next: E32C |