| Routines

28576: 'A' pressed - down

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 'A' or '6' is pressed.
28576 | CALL 28240 | Check whether ERIC is on a staircase
28579 | LD L,0 | Point HL at byte 0 of ERIC's buffer
28581 | JR C,28650 | Jump if ERIC's on a staircase
28583 | BIT 7,(HL) | Check the 'direction' bit of ERIC's animatory state
28585 | LD A,D | A=ERIC's y-coordinate
28586 | JR Z,28625 | Jump if ERIC is facing left
28588 | CP 3 | Is ERIC on the top floor?
28590 | JR Z,28616 | Jump if so
28592 | CP 10 | Is ERIC on the middle floor?
28594 | JR Z,28611 | Jump if so
28596 | CP 14 | Is ERIC on the assembly hall stage?
28598 | JP NZ,28449 | Move ERIC one space to the right if not
28601 | LD A,E | A=ERIC's x-coordinate
28602 | CP 80 | This is the x-coordinate of the top of the stairs leading from the stage to the bottom floor
28604 | JR NZ,28598 | Jump if ERIC is not here
This entry point is used by the routines at 28315, 28436 and 28460.
28606 | LD B,D | B=ERIC's post-midstride y-coordinate (down a stair)
28607 | INC B
28608 | JP 28516 | Move ERIC one space right or left too
ERIC is on the middle floor, facing right.
28611 | LD A,E | A=ERIC's x-coordinate
28612 | CP 15 | This is the x-coordinate of the top of the stairs leading down to the bottom floor at the far left of the boy's skool
28614 | JR 28604 | Move ERIC down a stair if he's here
ERIC is on the top floor, facing right.
28616 | LD A,E | A=ERIC's x-coordinate
28617 | CP 84 | This is the x-coordinate of the top of the stairs just outside the head's study
28619 | JR Z,28606 | Move ERIC down a stair if he's here
28621 | CP 179 | This is the x-coordinate of the top of the stairs leading down to the middle floor in the girls' skool
28623 | JR 28604 | Move ERIC down a stair if he's here
ERIC is facing left.
28625 | CP 10 | Is ERIC on the middle floor?
28627 | JR Z,28641 | Jump if so
28629 | CP 3 | Is ERIC on the top floor?
28631 | JP NZ,28473 | Move ERIC one space left if not
28634 | LD A,E | A=ERIC's x-coordinate
28635 | CP 26 | This is the x-coordinate of the top of the stairs leading down from the Revision Library
28637 | JR NZ,28631 | Move ERIC one space left if he's not here
28639 | JR 28606 | Otherwise move him down a stair
ERIC is on the middle floor, facing left.
28641 | LD A,E | A=ERIC's x-coordinate
28642 | CP 85 | This is the x-coordinate of the top of the stairs leading down to the stage
28644 | JR Z,28606 | Move ERIC down a stair if he's here
28646 | CP 183 | This is the x-coordinate of the top of the stairs leading down to the bottom floor in the girls' skool
28648 | JR 28637 | Move ERIC down a stair if he's here
ERIC is on a staircase.
28650 | XOR (HL) | Reset the carry flag if ERIC is facing the wrong way to descend the stairs
28651 | RLA
28652 | JP NC,28216 | Turn ERIC round if he's facing the wrong way
28655 | JR 28606 | Otherwise move him down a stair