Routines

28484: 'Q' pressed - up


The address of this routine is found in the keypress table at 58624

28484 CD506E CALL 28240 Is ERIC on a staircase?
28487 2E00 LD L,0
28489 384E JR C,28569 Jump if so
28491 CB7E BIT 7,(HL) Is ERIC facing left?
28493 7A LD A,D
28494 282C JR Z,28540 Jump if so
28496 FE0A CP 10 Is ERIC on the middle floor?
28498 2823 JR Z,28535 Jump if so
28500 FE0E CP 14 Is ERIC on the assembly hall stage?
28502 281A JR Z,28530 Jump if so
28504 FE11 CP 17 Is ERIC on the bottom floor?
28506 C2216F JP NZ,28449 Move ERIC one space to the right if not
28509 7B LD A,E A=ERIC's x-coordinate
28510 FEB0 CP 176 176: Bottom of stairs up to middle floor of girls' skool
28512 20F8 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 15 DEC D Up a stair
28515 42 LD B,D B=ERIC's new y-coordinate

This entry point is used by the routine at 28576:
28516 3A00D2 LD A,(53760) A=ERIC's animatory state
28519 4B LD C,E
28520 CB7F BIT 7,A Is ERIC facing left?
28522 2802 JR Z,28526 Jump if so
28524 0C INC C
28525 0C INC C
28526 0D DEC C C=ERIC's new x-coordinate
28527 C3D26D JP 28114

ERIC is on the assembly hall stage, facing right.
28530 7B LD A,E A=ERIC's x-coordinate
28531 FE51 CP 81 81: Bottom of stairs leading up to middle floor
28533 18E9 JR 28512 Move ERIC up a stair if he's here

ERIC is on the middle floor, facing right.
28535 7B LD A,E A=ERIC's x-coordinate
28536 FE13 CP 19 19: Bottom of stairs leading up to top floor in boys' skool
28538 18E4 JR 28512 Move ERIC up a stair if he's here

ERIC is facing left.
28540 FE0A CP 10 Is ERIC on the middle floor?
28542 200C JR NZ,28556 Jump if not
28544 7B LD A,E A=x-coordinate
28545 FE5B CP 91 91: Bottom of stairs leading up to head's study
28547 28DD JR Z,28514 Move ERIC up a stair if he's here
28549 FEBA CP 186 186: Bottom of stairs leading up to top floor in girls' skool
28551 C2396F JP NZ,28473 Move ERIC one space left if he's not here
28554 18D6 JR 28514 Otherwise move him up a stair
28556 FE11 CP 17 Is ERIC on the bottom floor?
28558 20F7 JR NZ,28551 Jump if not
28560 7B LD A,E A=ERIC's x-coordinate
28561 FE16 CP 22 22: Bottom of stairs leading up to middle floor in boys' skool
28563 28CD JR Z,28514 Move ERIC up a stair if he's here
28565 FE53 CP 83 83: Bottom of stairs leading up to assembly hall stage
28567 18EE JR 28551 Move ERIC up a stair if he's here

ERIC is on a staircase.
28569 AE XOR (HL) Set the carry flag if ERIC is facing the wrong way to ascend the stairs
28570 17 RLA
28571 DA386E JP C,28216 Turn ERIC round if he's facing the wrong way
28574 18C2 JR 28514 Make ERIC go up a stair otherwise