| Routines

28484: 'Q' pressed - up

The address of this routine is found in the table of keypress handling routines at 58704. It is called from the main loop at 63210 when 'Q' or '7' is pressed.
28484 | CALL 28240 | Check whether ERIC is on a staircase
28487 | LD L,0 | Point HL at byte 0 of ERIC's buffer
28489 | JR C,28569 | Jump if ERIC's on a staircase
28491 | BIT 7,(HL) | Check the 'direction' bit of ERIC's animatory state
28493 | LD A,D | A=ERIC's y-coordinate
28494 | JR Z,28540 | Jump if ERIC's facing left
28496 | CP 10 | Is ERIC on the middle floor?
28498 | JR Z,28535 | Jump if so
28500 | CP 14 | Is ERIC on the assembly hall stage?
28502 | JR Z,28530 | Jump if so
28504 | CP 17 | Is ERIC on the bottom floor?
28506 | JP NZ,28449 | Move ERIC one space to the right if not
28509 | LD A,E | A=ERIC's x-coordinate
28510 | CP 176 | This is the x-coordinate of the bottom of the stairs leading up to the middle floor of the girls' skool
28512 | JR NZ,28506 | Jump if ERIC is not at that point
This entry point is used by the routines at 28315, 28436 and 28460.
28514 | DEC D | Up a stair
28515 | LD B,D | B=ERIC's post-midstride y-coordinate
This entry point is used by the routine at 28576.
28516 | LD A,(53760) | A=ERIC's animatory state
28519 | LD C,E | C=ERIC's current x-coordinate
28520 | BIT 7,A | Is ERIC facing left?
28522 | JR Z,28526 | Jump if so
28524 | INC C |
28525 | INC C |
28526 | DEC C | C=ERIC's post-midstride x-coordinate
28527 | JP 28114 | Put ERIC midstride
ERIC is on the assembly hall stage, facing right.
28530 | LD A,E | A=ERIC's x-coordinate
28531 | CP 81 | This is the x-coordinate of the bottom of the stairs leading up from the stage to the middle floor
28533 | JR 28512 | Move ERIC up a stair if he's here
ERIC is on the middle floor, facing right.
28535 | LD A,E | A=ERIC's x-coordinate
28536 | CP 19 | This is the x-coordinate of the bottom of the stairs leading up to the Revision Library
28538 | JR 28512 | Move ERIC up a stair if he's here
ERIC is facing left.
28540 | CP 10 | Is ERIC on the middle floor?
28542 | JR NZ,28556 | Jump if not
28544 | LD A,E | A=ERIC's x-coordinate
28545 | CP 91 | This is the x-coordinate of the bottom of the stairs leading up to the head's study
28547 | JR Z,28514 | Move ERIC up a stair if he's here
28549 | CP 186 | This is the x-coordinate of the bottom of the stairs leading up to the top floor of the girls' skool
28551 | JP NZ,28473 | Move ERIC one space left if he's not here
28554 | JR 28514 | Otherwise move him up a stair
28556 | CP 17 | Is ERIC on the bottom floor?
28558 | JR NZ,28551 | Jump if not
28560 | LD A,E | A=ERIC's x-coordinate
28561 | CP 22 | This is the x-coordinate of the bottom of the stairs leading up to the middle floor at the far left of the boys' skool
28563 | JR Z,28514 | Move ERIC up a stair if he's here
28565 | CP 83 | This is the x-coordinate of the bottom of the stairs leading up to the assembly hall stage
28567 | JR 28551 | Move ERIC up a stair if he's here
ERIC is on a staircase.
28569 | XOR (HL) | Set the carry flag if ERIC is facing the wrong way to ascend the stairs
28570 | RLA
28571 | JP C,28216 | Turn ERIC round if he's facing the wrong way
28574 | JR 28514 | Make ERIC go up a stair otherwise