| Routines

6F44: 'Q' pressed - up

The address of this routine is found in the table of keypress handling routines at E550. It is called from the main loop at F6EA when 'Q' or '7' is pressed.
6F44 | CALL $6E50 | Check whether ERIC is on a staircase
6F47 | LD L,$00 | Point HL at byte 0x00 of ERIC's buffer
6F49 | JR C,$6F99 | Jump if ERIC's on a staircase
6F4B | BIT 7,(HL) | Check the 'direction' bit of ERIC's animatory state
6F4D | LD A,D | A=ERIC's y-coordinate
6F4E | JR Z,$6F7C | Jump if ERIC's facing left
6F50 | CP $0A | Is ERIC on the middle floor?
6F52 | JR Z,$6F77 | Jump if so
6F54 | CP $0E | Is ERIC on the assembly hall stage?
6F56 | JR Z,$6F72 | Jump if so
6F58 | CP $11 | Is ERIC on the bottom floor?
6F5A | JP NZ,$6F21 | Move ERIC one space to the right if not
6F5D | LD A,E | A=ERIC's x-coordinate
6F5E | CP $B0 | This is the x-coordinate of the bottom of the stairs leading up to the middle floor of the girls' skool
6F60 | JR NZ,$6F5A | Jump if ERIC is not at that point
This entry point is used by the routines at 6E9B, 6F14 and 6F2C.
6F62 | DEC D | Up a stair
6F63 | LD B,D | B=ERIC's post-midstride y-coordinate
This entry point is used by the routine at 6FA0.
6F64 | LD A,($D200) | A=ERIC's animatory state
6F67 | LD C,E | C=ERIC's current x-coordinate
6F68 | BIT 7,A | Is ERIC facing left?
6F6A | JR Z,$6F6E | Jump if so
6F6C | INC C |
6F6D | INC C |
6F6E | DEC C | C=ERIC's post-midstride x-coordinate
6F6F | JP $6DD2 | Put ERIC midstride
ERIC is on the assembly hall stage, facing right.
6F72 | LD A,E | A=ERIC's x-coordinate
6F73 | CP $51 | This is the x-coordinate of the bottom of the stairs leading up from the stage to the middle floor
6F75 | JR $6F60 | Move ERIC up a stair if he's here
ERIC is on the middle floor, facing right.
6F77 | LD A,E | A=ERIC's x-coordinate
6F78 | CP $13 | This is the x-coordinate of the bottom of the stairs leading up to the Revision Library
6F7A | JR $6F60 | Move ERIC up a stair if he's here
ERIC is facing left.
6F7C | CP $0A | Is ERIC on the middle floor?
6F7E | JR NZ,$6F8C | Jump if not
6F80 | LD A,E | A=ERIC's x-coordinate
6F81 | CP $5B | This is the x-coordinate of the bottom of the stairs leading up to the head's study
6F83 | JR Z,$6F62 | Move ERIC up a stair if he's here
6F85 | CP $BA | This is the x-coordinate of the bottom of the stairs leading up to the top floor of the girls' skool
6F87 | JP NZ,$6F39 | Move ERIC one space left if he's not here
6F8A | JR $6F62 | Otherwise move him up a stair
6F8C | CP $11 | Is ERIC on the bottom floor?
6F8E | JR NZ,$6F87 | Jump if not
6F90 | LD A,E | A=ERIC's x-coordinate
6F91 | CP $16 | 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
6F93 | JR Z,$6F62 | Move ERIC up a stair if he's here
6F95 | CP $53 | This is the x-coordinate of the bottom of the stairs leading up to the assembly hall stage
6F97 | JR $6F87 | Move ERIC up a stair if he's here
ERIC is on a staircase.
6F99 | XOR (HL) | Set the carry flag if ERIC is facing the wrong way to ascend the stairs
6F9A | RLA
6F9B | JP C,$6E38 | Turn ERIC round if he's facing the wrong way
6F9E | JR $6F62 | Make ERIC go up a stair otherwise