Prev: 56828 Up: Map Next: 57098
56865: GET_PLAYER_INPUT
Used by the routine PLAY_GAME.
GET_PLAYER_INPUT 56865 LD A,(59648)
56868 CP 32
56870 JP Z,GET_PLAYER_INPUT_0
56873 JP C,GET_PLAYER_INPUT_1
56876 CP 40
56878 RET C
56879 RRA
56880 RET NC
56881 LD DE,(59649) Load DE with PLAYER_X_COORD and PLAYER_Y_COORD
56885 SRL D
56887 SRL E
56889 INC E
56890 INC D
56891 JP L56342
GET_PLAYER_INPUT_0 56894 LD BC,65535
56897 CALL DELAY_0
56900 CALL DELAY_0
56903 LD A,(59661)
56906 DEC A
56907 LD (59661),A
56910 RET NZ
56911 CALL L56194
56914 LD SP,(59662) Restore SP from SP_STORAGE
56918 LD HL,59654 Point HL at L59654
56921 RET
GET_PLAYER_INPUT_1 56922 LD A,(59664) Get CONTROL_METHOD
56925 CP 0
56927 JP Z,GET_KEYBOARD_INPUT Get keyboard input
56930 CP 1
56932 JP Z,GET_KEMPSTON_INPUT Get Kempston input
56935 CP 2
56937 JP Z,GET_CURSOR_INPUT Get Cursor input
56940 JP GET_SINCLAIR_INPUT Get Sinclair input
GET_KEYBOARD_INPUT 56943 LD C,0 Reset C register - this will record the keyboard inputs in bits 0-4 (0: Fire, 1: Up, 2: Down, 3: Right, 4: Left)
GET_KEY_RIGHT 56945 LD A,223
56947 IN A,(254) Read keys P-Y
56949 BIT 0,A Check key P
56951 JR NZ,GET_KEY_LEFT
56953 SET 3,C P is pressed, set bit 3
GET_KEY_LEFT 56955 LD A,223
56957 IN A,(254) Read keys P-Y
56959 BIT 1,A Check key O
56961 JR NZ,GET_KEY_DOWN
56963 SET 4,C O is pressed, set bit 4
GET_KEY_DOWN 56965 LD A,253
56967 IN A,(254) Read keys A-G
56969 BIT 0,A Check key A
56971 JR NZ,GET_KEY_UP
56973 SET 2,C A is pressed, set bit 2
GET_KEY_UP 56975 LD A,251
56977 IN A,(254) Read keys Q-T
56979 BIT 0,A Check key Q
56981 JR NZ,GET_KEY_FIRE
56983 SET 1,C Q is pressed, set bit 1
GET_KEY_FIRE 56985 LD A,127
56987 IN A,(254) Read keys Space-B
56989 BIT 2,A Check key M
56991 JR NZ,GET_PLAYER_INPUT_2
56993 SET 0,C M is pressed, set bit 0
GET_PLAYER_INPUT_2 56995 LD A,C
56996 JP STORE_PLAYER_INPUT Store player input
GET_KEMPSTON_INPUT 56999 IN A,(31) Read Kempston joystick input
57001 LD B,A
57002 LD C,0
57004 RR B
57006 RR B
57008 RL C
57010 RRA
57011 RL C
57013 RRA
57014 RRA
57015 RL C
57017 RRA
57018 RL C
57020 RRA
57021 RL C
57023 LD A,C
57024 JP STORE_PLAYER_INPUT Store player input
GET_CURSOR_INPUT 57027 LD A,239
57029 IN A,(254) Read keys 0-6 (Sinclair 1)
57031 LD C,0
57033 RRA
57034 JR C,GET_CURSOR_INPUT_1 Jump to 57038 if 0 not pressed
57036 SET 0,C Set fire input bit
GET_CURSOR_INPUT_1 57038 RRA
57039 RRA
57040 JR C,GET_CURSOR_INPUT_2 Jump to 57044 if 8 not pressed
57042 SET 3,C Set right input bit
GET_CURSOR_INPUT_2 57044 RRA
57045 JR C,GET_CURSOR_INPUT_3 Jump to 57049 if 7 not pressed
57047 SET 1,C Set up input bit
GET_CURSOR_INPUT_3 57049 RRA
57050 JR C,GET_CURSOR_INPUT_4 Jump to 57054 if 6 not pressed
57052 SET 2,C Set down input bit
GET_CURSOR_INPUT_4 57054 LD A,247
57056 IN A,(254) Read keys 1-5 (Sinclair 2)
57058 BIT 4,A Check key 5 (left
57060 JR NZ,GET_CURSOR_INPUT_5
57062 SET 4,C Set left input bit
GET_CURSOR_INPUT_5 57064 LD A,C
57065 JP STORE_PLAYER_INPUT Store player input
GET_SINCLAIR_INPUT 57068 LD A,239
57070 IN A,(254) Read keys 0-6 (Sinclair 1)
57072 CPL A=255-A
STORE_PLAYER_INPUT 57073 AND 31 Make sure we're only looking at the first 5 bits of the input byte
57075 PUSH AF
57076 LD B,A Copy input byte to B register
57077 LD A,(59652)
57080 AND B Another AND 31?
57081 LD (59651),A Store the input byte in PLAYER_INPUT_DATA
57084 POP AF
57085 BIT 0,A
57087 LD A,30
57089 JP NZ,GET_PLAYER_INPUT_3
57092 LD A,31 Never called?
GET_PLAYER_INPUT_3 57094 LD (59652),A Store 31 in (59652)
57097 RET
Prev: 56828 Up: Map Next: 57098