Prev: D01A Up: Map Next: D03E
D022: Read the controls
Used by the routine at player_controls.
Reads whichever control method the menu chose (bits 1 and 2 of $5BA4: 0 keyboard, 1 Kempston, 2 cursor keys, 3 Interface II) into one byte of bits that means the same whichever it came from, and stores it at $5BB5. The legs' handler at upd_player_bottom calls this every frame and also uses the byte as it is returned, in C.
The bits: 0 turn left, 1 turn right, 2 walk forward, 3 jump, 4 pick up or drop, 5 any key but the number keys, Caps Shift and Space. On a joystick with the menu's directional option set (bit 3 of $5BA4), bits 0, 1, 2 and 4 are instead the four directions of the stick, and bit 5 takes over picking up and dropping -- see chk_pickup_drop and handle_left_right. The directional option has no effect with the keyboard method.
While the game is won ($5BC3) or an object is falling into the cauldron ($5BC4) the controls are ignored: the byte is 0 apart from bit 5.
Input
C on exit, the control bits (also at $5BB5)
check_user_input D022 LD A,($5BC3) C = 0; A non-zero if the controls are frozen
D025 LD C,A
D026 LD A,($5BC4)
D029 OR C
D02A LD C,$00
D02C JP NZ,finished_input frozen: straight to the end, where only bit 5 is read
D02F LD A,($5BA4) A = the control method, 0 to 3
D032 RRCA
D033 AND $03
D035 JP Z,keyboard
D038 DEC A
D039 JR Z,kempston
D03B DEC A
D03C JR Z,cursor
Prev: D01A Up: Map Next: D03E