Skool Daze Routines
26084: 'Q' pressed - up
Called from the main loop at 26471. Also used by the routines at 26194 and 26282.
B ERIC's animatory state
DE ERIC's coordinates
26084 CALL 25956 Is ERIC sitting or lying down?
26087 RET NZ Return if so
26088 BIT 6,A Bit 6 at 32763 is always reset, so this jump is never made
26090 JR NZ,26067
26092 LD A,D A=ERIC's y-coordinate
26093 CP 155 Is ERIC on the top floor?
26095 JR Z,26067 Jump if so
26097 CP 162 Is ERIC on the middle floor?
26099 JR Z,26147 Jump if so
26101 CP 169 Is ERIC on the bottom floor?
26103 JR Z,26147 Jump if so
ERIC's not on the top, middle or bottom floor, so he must be on a staircase. Should he go up a step, or turn round first?
26105 LD A,E A=ERIC's x-coordinate
26106 CP 48 Set the carry flag if ERIC's on a staircase on the left
26108 BIT 7,B Set the zero flag if ERIC is facing left
26110 JR C,26117 Jump if ERIC's on a staircase on the left
26112 JP Z,25962 Turn ERIC round if he's facing down a staircase on the right
26115 JR 26120
26117 JP NZ,25962 Turn ERIC round if he's facing down a staircase on the left
ERIC's at the bottom of or on a staircase, facing the top of it.
26120 DEC D Up a step
26121 LD H,D Copy ERIC's next coordinates to HL
26122 LD L,E
26123 DEC E One pace to the left
26124 LD B,2 2=ERIC standing, facing left
26126 CP 48 Is ERIC on a staircase on the left side of the skool?
26128 JR C,26134 Jump if so
26130 LD B,130 130=ERIC standing, facing right
26132 INC E One pace to the right (taking into the account the one pace to the left at 26123)
26133 INC E
26134 LD A,B A=2/130
26135 BIT 0,L A=1/129, B=2/130 if ERIC's current x-coordinate is even; A=3/131, B=0/128 if ERIC's current x-coordinate is odd;
26137 JR Z,26141
26139 DEC B
26140 DEC B
26141 ADD A,2
26143 DEC A
26144 JP 25916 Update ERIC's animatory state and location
ERIC is on the middle floor or the top floor.
26147 LD A,E A=ERIC's x-coordinate
26148 CP 19 19=x-coordinate of bottom of staircases at left of skool
26150 JR NZ,26159 Jump unless ERIC is here
26152 BIT 7,B Is ERIC facing right?
26154 JP NZ,26282 Move ERIC right if so
26157 JR 26120 Otherwise send ERIC up a step
26159 CP 70 70=x-coordinate of bottom of staircases at right of skool
26161 JR NZ,26167 Jump unless ERIC is here
26163 BIT 7,B Is ERIC facing right?
26165 JR NZ,26120 Send ERIC up a step if so
26167 BIT 7,B Is ERIC facing left?
26169 JP Z,26194 Move ERIC left if so
26172 JP 26282 Otherwise move ERIC right