![]() |
Routines |
| Prev: D09C | Up: Map | Next: D12A |
|
Used by the routine at ReadControls.
Reads the controls from the keyboard. Left is Z, C, M or B, right is X, V, symbol shift or N, walking forward is any key of the rows A to G and H to ENTER, jumping is any key of the rows Q to T and Y to P, and picking up and dropping an object is any key of the rows 1 to 5 and 6 to 0.
|
||||||||||||||||||||
|
Left and right from the bottom row.
|
||||||||||||||||||||
| ReadKeyboard | D0C8 | LD A,$FE | Read from the keyboard;
|
|||||||||||||||||
| D0CA | CALL ReadKeyboardPort | |||||||||||||||||||
| D0CD | RRCA | Move Z into bit 0. | ||||||||||||||||||
| D0CE | LD C,A | Stash the keys in C. | ||||||||||||||||||
| D0CF | AND %00000011 | Keep Z and X. | ||||||||||||||||||
| D0D1 | SRL C | Move C and V into bits 0 and 1. | ||||||||||||||||||
| D0D3 | SRL C | |||||||||||||||||||
| D0D5 | OR C | Combine them with Z and X. | ||||||||||||||||||
| D0D6 | AND %00000011 | Keep the left and right bits. | ||||||||||||||||||
| D0D8 | LD C,A | Stash them in C. | ||||||||||||||||||
| D0D9 | LD A,$7F | Read from the keyboard;
|
||||||||||||||||||
| D0DB | CALL ReadKeyboardPort | |||||||||||||||||||
| D0DE | BIT 1,A | Set the right control if symbol shift is pressed. | ||||||||||||||||||
| D0E0 | JR Z,ReadKeyboard_TestM | |||||||||||||||||||
| D0E2 | SET 1,C | |||||||||||||||||||
| ReadKeyboard_TestM | D0E4 | BIT 2,A | Set the left control if M is pressed. | |||||||||||||||||
| D0E6 | JR Z,ReadKeyboard_TestN | |||||||||||||||||||
| D0E8 | SET 0,C | |||||||||||||||||||
| ReadKeyboard_TestN | D0EA | BIT 3,A | Set the right control if N is pressed. | |||||||||||||||||
| D0EC | JR Z,ReadKeyboard_TestB | |||||||||||||||||||
| D0EE | SET 1,C | |||||||||||||||||||
| ReadKeyboard_TestB | D0F0 | BIT 4,A | Set the left control if B is pressed. | |||||||||||||||||
| D0F2 | JR Z,ReadKeyboard_WalkKeys | |||||||||||||||||||
| D0F4 | SET 0,C | |||||||||||||||||||
| ReadKeyboard_WalkKeys | D0F6 | LD A,$BD | Read from the keyboard;
|
|||||||||||||||||
| D0F8 | CALL ReadKeyboardPort | |||||||||||||||||||
| D0FB | JR Z,ReadKeyboard_JumpKeys | Set the walk control if any of them is pressed. | ||||||||||||||||||
| D0FD | SET 2,C | |||||||||||||||||||
| ReadKeyboard_JumpKeys | D0FF | LD A,$DB | Read from the keyboard;
|
|||||||||||||||||
| D101 | CALL ReadKeyboardPort | |||||||||||||||||||
| D104 | JR Z,ReadKeyboard_PickUpKeys | Set the jump control if any of them is pressed. | ||||||||||||||||||
| D106 | SET 3,C | |||||||||||||||||||
| ReadKeyboard_PickUpKeys | D108 | LD A,$E7 | Read from the keyboard;
|
|||||||||||||||||
| D10A | CALL ReadKeyboardPort | |||||||||||||||||||
| D10D | JR Z,ReadControls_Finish | Set the pick up control if any of them is pressed. | ||||||||||||||||||
| D10F | SET 4,C | |||||||||||||||||||
|
This entry point is used by the routines at ReadControls, ReadInterface2Joystick, ReadKempstonJoystick and ReadCursorJoystick.
Reads the keys that pick up and drop an object when a joystick with directional control is in use. The keys that count are Z, X, C, V, A to G, H to ENTER, Q to T and Y to P.
|
||||||||||||||||||||
| ReadControls_Finish | D111 | LD A,$7E | Read from the keyboard;
|
|||||||||||||||||
| D113 | CALL ReadKeyboardPort | |||||||||||||||||||
| D116 | AND %00011110 | Keep the keys Z, X, C, V, symbol shift, M, N and B. | ||||||||||||||||||
| D118 | PUSH BC | Stash BC on the stack. | ||||||||||||||||||
| D119 | LD B,A | Stash the keys in B. | ||||||||||||||||||
| D11A | LD A,$99 | Read the keys SHIFT to V, 1 to 5, 6 to 0 and SPACE to B. | ||||||||||||||||||
| D11C | CALL ReadKeyboardPort | |||||||||||||||||||
| D11F | OR B | Combine the keys. | ||||||||||||||||||
| D120 | POP BC | Restore BC from the stack. | ||||||||||||||||||
| D121 | JR Z,ReadControls_Store | Jump to ReadControls_Store if no key is pressed. | ||||||||||||||||||
| D123 | SET 5,C | Set the directional pick up control. | ||||||||||||||||||
| ReadControls_Store | D125 | LD A,C | Fetch the controls. | |||||||||||||||||
| D126 | LD ($5BB5),A | Store them at ControlsPressed. | ||||||||||||||||||
| D129 | RET | Return. | ||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||
| Prev: D09C | Up: Map | Next: D12A |