![]() |
Routines |
| Prev: D17C | Up: Map | Next: D206 |
|
Used by the routines at ReadInterface2Joystick, ReadKempstonJoystick, ReadCursorJoystick and ReadKeyboard.
Sets bit 5 of the controls if Z or SYMBOL SHIFT is pressed, then makes a copy in B in which left and right are never both set, and bits 2 and 3 are never both set.
|
||||||||||||||||||||
|
Read the key which rotates the view.
|
||||||||||||||||||||
| ReadControls_Rotate | D1BE | LD A,$7E | Read from the keyboard;
|
|||||||||||||||||
| D1C0 | CALL ReadKeyboardPort | |||||||||||||||||||
| D1C3 | BIT 1,A | Jump to ReadControls_Resolve if neither Z nor SYMBOL SHIFT is pressed. | ||||||||||||||||||
| D1C5 | JR Z,ReadControls_Resolve | |||||||||||||||||||
| D1C7 | SET 5,C | Set bit 5. | ||||||||||||||||||
|
Make B from the controls so that left and right are never both set, and bits 2 and 3 are never both set.
|
||||||||||||||||||||
| ReadControls_Resolve | D1C9 | PUSH DE | Stash DE on the stack. | |||||||||||||||||
| D1CA | LD A,($A247) | Fetch LastControls. | ||||||||||||||||||
| D1CD | LD E,A | |||||||||||||||||||
| D1CE | LD A,C | Fetch the controls. | ||||||||||||||||||
| D1CF | AND %00000011 | Keep left and right. | ||||||||||||||||||
| D1D1 | CP $03 | Jump to ReadControls_BothHorizontal if both are set. | ||||||||||||||||||
| D1D3 | JR Z,ReadControls_BothHorizontal | |||||||||||||||||||
| D1D5 | LD B,A | Keep them in B. | ||||||||||||||||||
| D1D6 | LD A,E | Fetch the last controls. | ||||||||||||||||||
| D1D7 | AND %11111100 | Clear their bits for left and right. | ||||||||||||||||||
| D1D9 | OR B | Put in the new ones. | ||||||||||||||||||
| D1DA | LD E,A | Keep them in E. | ||||||||||||||||||
|
Do the same for bits 2 and 3.
|
||||||||||||||||||||
| ReadControls_Vertical | D1DB | LD A,C | Fetch the controls. | |||||||||||||||||
| D1DC | AND %00001100 | Keep bits 2 and 3. | ||||||||||||||||||
| D1DE | CP $0C | Jump to ReadControls_BothVertical if both are set. | ||||||||||||||||||
| D1E0 | JR Z,ReadControls_BothVertical | |||||||||||||||||||
| D1E2 | LD D,A | Keep them in D. | ||||||||||||||||||
| D1E3 | OR B | Add them to B. | ||||||||||||||||||
| D1E4 | LD B,A | Keep them in B. | ||||||||||||||||||
| D1E5 | LD A,E | Fetch the last controls. | ||||||||||||||||||
| D1E6 | AND %11110011 | Clear their bits for the two controls. | ||||||||||||||||||
| D1E8 | OR D | Put in the new ones. | ||||||||||||||||||
| D1E9 | LD E,A | Keep them in E. | ||||||||||||||||||
|
Store LastControls and add bit 4 to B.
|
||||||||||||||||||||
| ReadControls_Store | D1EA | LD A,E | Fetch the last controls. | |||||||||||||||||
| D1EB | LD ($A247),A | Set LastControls. | ||||||||||||||||||
| D1EE | POP DE | Restore DE from the stack. | ||||||||||||||||||
| D1EF | LD A,C | Fetch the controls. | ||||||||||||||||||
| D1F0 | AND %00010000 | Keep bit 4, for down. | ||||||||||||||||||
| D1F2 | OR B | Add it to B. | ||||||||||||||||||
| D1F3 | LD B,A | Keep it in B. | ||||||||||||||||||
| D1F4 | RET | Return. | ||||||||||||||||||
|
Both left and right are set, so use the one which was not set last time.
|
||||||||||||||||||||
| ReadControls_BothHorizontal | D1F5 | LD A,E | Fetch the last controls. | |||||||||||||||||
| D1F6 | AND %00000011 | Keep left and right. | ||||||||||||||||||
| D1F8 | XOR %00000011 | Turn the bits round. | ||||||||||||||||||
| D1FA | LD B,A | Keep them in B. | ||||||||||||||||||
| D1FB | JR ReadControls_Vertical | Jump to ReadControls_Vertical. | ||||||||||||||||||
|
Bits 2 and 3 are both set, so use the one which was not set last time.
|
||||||||||||||||||||
| ReadControls_BothVertical | D1FD | LD A,E | Fetch the last controls. | |||||||||||||||||
| D1FE | AND %00001100 | Keep bits 2 and 3. | ||||||||||||||||||
| D200 | XOR %00001100 | Turn the bits round. | ||||||||||||||||||
| D202 | OR B | Add the horizontal controls. | ||||||||||||||||||
| D203 | LD B,A | Keep them in B. | ||||||||||||||||||
| D204 | JR ReadControls_Store | Jump to ReadControls_Store. | ||||||||||||||||||
| Prev: D17C | Up: Map | Next: D206 |