Skool Daze Routines
62938: Collect or simulate keypresses
Called from the main loop at 26471.
62938 LD HL,32746 32746 holds the shield status
62941 LD A,(HL) Are we in demo mode?
62942 AND A
62943 JP NZ,26426 Jump to collect a keypress if not
We're in demo mode.
62946 LD L,199 HL=32711
62948 LD B,4 Reset the score (stored in 32708/9) and lines (stored in 32710/1) to zero
62950 LD (HL),A
62951 DEC L
62952 DJNZ 62950
62954 CALL 26426 Check for input from keyboard or joystick
62957 JP NZ,32250 Jump 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) keypress
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 29
62995 RET Return with the zero flag set to indicate no input
62996 LD (HL),0 Set the stand-up delay counter at 32705 to 29
62998 LD L,251 HL=32763 (ERIC's status flags)
63000 BIT 7,(HL) Is ERIC sitting or lying on his back?
63002 JR NZ,62984 Simulate 's' to make ERIC stand up if so
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
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
63025 LD A,(44128) A=ERIC's animatory state
63028 RLCA Is ERIC facing left?
63029 JR NC,62984 Jump if so
63031 LD A,3 A=3: ERIC should go left
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
63046 LD A,(23672) 23672=LSB of 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 (Q, A, O or P)
63054 RET Return with the zero flag reset to indicate input