Routines |
Prev: 62937 | Up: Map | Next: 63055 |
Called from the main loop at 26471. Returns with A holding the ASCII code of the last (actual or simulated) keypress, or the zero flag set if there was no (actual or simulated) keypress.
|
||||
62938 | LD HL,32746 | 32746 holds the game mode indicator | ||
62941 | LD A,(HL) | Are we in demo mode? | ||
62942 | AND A | |||
62943 | JP NZ,26426 | Collect a keypress if not | ||
We're in demo mode.
|
||||
62946 | LD L,199 | Point HL at the MSB of the lines total | ||
62948 | LD B,4 | Reset the score (stored at 32708) and lines total (stored at 32710) to zero | ||
62950 | LD (HL),A | |||
62951 | DEC L | |||
62952 | DJNZ 62950 | |||
62954 | CALL 26426 | Check for input from the keyboard or joystick | ||
62957 | JP NZ,32250 | Exit demo mode if there was input | ||
We're in demo mode and there was no keyboard or joystick input. Time to simulate a keypress to move ERIC.
|
||||
62960 | LD A,(44128) | A=ERIC's animatory state | ||
62963 | CP 5 | 5=ERIC sitting in a chair | ||
62965 | LD HL,32705 | 32705 holds the stand-up delay counter | ||
62968 | JR NZ,62996 | Jump unless ERIC is sitting in a chair | ||
62970 | LD A,(41568) | A=animatory state of little boy no. 11 | ||
62973 | CP 69 | 69=little boy sitting in a chair | ||
62975 | JR Z,62993 | Jump if little boy no. 11 is sitting in a chair | ||
ERIC is sitting in a chair, but little boy no. 11 isn't. ERIC should stand up now or soon.
|
||||
62977 | LD A,(HL) | The stand-up delay counter at 32705 normally holds 0; if little boy no. 11 has just stood up, initialise the delay counter to 29 | ||
62978 | AND A | |||
62979 | JR Z,62990 | |||
62981 | DEC (HL) | Is it time for ERIC to stand up? | ||
62982 | JR NZ,62988 | Jump if not | ||
62984 | LD A,115 | Set A to 115 to simulate 's' (sit/stand) being pressed | ||
62986 | AND A | Return with the zero flag reset to indicate input | ||
62987 | RET | |||
62988 | XOR A | Return with the zero flag set to indicate no input | ||
62989 | RET | |||
62990 | LD (HL),29 | Initialise the stand-up delay counter at 32705 to 29 | ||
62992 | RET | Return with the zero flag set to indicate no input | ||
62993 | LD (HL),0 | Set the stand-up delay counter at 32705 to 0 | ||
62995 | RET | Return with the zero flag set to indicate no input | ||
ERIC isn't sitting in a chair. Is he sitting on the floor or lying on his back?
|
||||
62996 | LD (HL),0 | Set the stand-up delay counter at 32705 to 0 | ||
62998 | LD L,251 | HL=32763 (ERIC's status flags) | ||
63000 | BIT 7,(HL) | Is ERIC sitting on the floor or lying on his back? | ||
63002 | JR NZ,62984 | Simulate 's' to make ERIC stand up if so | ||
ERIC is upright. Seek little boy no. 11 for guidance on where to go next.
|
||||
63004 | LD HL,41569 | Pick up the coordinates of little boy no. 11 in DE | ||
63007 | LD D,(HL) | |||
63008 | INC L | |||
63009 | LD E,(HL) | |||
63010 | LD H,172 | 172=ERIC | ||
63012 | CALL 31452 | Determine ERIC's next move in his pursuit of little boy no. 11 | ||
63015 | AND A | Are ERIC and this boy in the same location? | ||
63016 | JR NZ,63033 | Jump if not | ||
ERIC and little boy no. 11 are in the same location.
|
||||
63018 | LD A,(41568) | A=animatory state of little boy no. 11 | ||
63021 | CP 69 | Is little boy no. 11 sitting in a chair? | ||
63023 | JR NZ,62988 | Jump if not (without simulating a keypress) | ||
63025 | LD A,(44128) | A=ERIC's animatory state | ||
63028 | RLCA | Is ERIC facing left? | ||
63029 | JR NC,62984 | Simulate 's' (sit down) if so | ||
63031 | LD A,3 | Otherwise set A=3: ERIC should go left (i.e. turn round) | ||
Now A=1 if ERIC should go up, 2 if down, 3 if left, or 4 if right (to follow little boy no. 11).
|
||||
63033 | LD B,81 | 81=ASCII code for 'Q' (up) | ||
63035 | DEC A | Should ERIC go up? | ||
63036 | JR Z,63046 | Jump if so | ||
63038 | LD B,65 | 65=ASCII code for 'A' (down) | ||
63040 | DEC A | Should ERIC go down? | ||
63041 | JR Z,63046 | Jump if so | ||
63043 | ADD A,78 | B=79 ('O') or 80 ('P') | ||
63045 | LD B,A | |||
Now B holds the ASCII code of the simulated keypress: Q, A, O or P. Decide whether to switch to lower case (slow).
|
||||
63046 | LD A,(23672) | 23672=LSB of the FRAMES system variable | ||
63049 | AND 128 | A=32 (lower case, slow) or 0 (upper case, fast) | ||
63051 | RRCA | |||
63052 | RRCA | |||
63053 | ADD A,B | A=simulated keycode | ||
63054 | RET | Return with the zero flag reset to indicate input |
Prev: 62937 | Up: Map | Next: 63055 |