Routines 
Prev: 6648  Up: Map  Next: 66A4 


6652  CALL $6564  Is ERIC sitting or lying down?  
6655  RET NZ  Return if so  
6656  CALL $6648  Check whether ERIC is on a staircase  
6659  LD A,E  A=ERIC's xcoordinate  
665A  JR Z,$6664  Jump if ERIC's not on a staircase  
665C  CP $30  Is ERIC on a staircase at the right of the skool?  
665E  JP NC,$657F  Move ERIC down a step if so  
6661  JP $65E4  Otherwise move ERIC up a step  
6664  BIT 7,B  Is ERIC facing right?  
6666  JP NZ,$656A  Turn ERIC round if so  
ERIC is facing left, and is not on a staircase.


6669  AND A  Is ERIC standing at the far left side of the skool?  
666A  RET Z  Return if so  
666B  LD A,D  A=ERIC's ycoordinate  
666C  CP $A9  Is ERIC on the bottom floor?  
666E  JR Z,$667A  Jump if so  
6670  CP $9B  Set the zero flag if ERIC is on the top floor  
6672  LD A,$3A  This is the xcoordinate of the wall between the Map and Reading Rooms  
6674  JR Z,$6678  Jump if ERIC's on the top floor  
6676  LD A,$27  This is the xcoordinate of the wall between the Exam and White Rooms  
6678  CP E  Is ERIC facing this wall (from the right side)?  
6679  RET Z  Return if so (ERIC cannot walk through walls)  
There is no wall obstructing ERIC, so it's time to put him midstride.


667A  LD A,$01  A=0x01 (ERIC midstride, facing left)  
667C  LD L,E  L=ERIC's current xcoordinate  
667D  DEC E  E=ERIC's postmidstride xcoordinate  
667E  LD C,A  C=0x01/0x81 (ERIC midstride)  
667F  LD A,($7FFC)  7FFC holds the ASCII code of the last keypress  
6682  BIT 5,A  Was the last keypress upper case (fast)?  
6684  JR Z,$668A  Jump if so  
6686  LD A,C  Clearly these instructions have no effect, but one wonders what they might once have been and done  
6687  ADD A,$00  
6689  LD C,A  
668A  LD A,($7FFB)  Collect ERIC's status flags from 7FFB  
668D  BIT 6,A  Bit 6 is always reset, so this jump is always made  
668F  JR Z,$6695  
6691  LD A,C  Clearly these instructions have no effect, but one wonders what they might once have been and done  
6692  ADD A,$00  
6694  LD C,A  
6695  LD A,C  A=0x01/0x81 (ERIC midstride)  
6696  LD H,D  H=ERIC's current ycoordinate  
6697  LD B,A  B=0x02/0x82 (ERIC standing, phase 3)  
6698  INC B  
6699  BIT 0,L  Is ERIC's current xcoordinate even?  
669B  JR Z,$66A1  Jump if so  
669D  DEC B  Adjust ERIC's midstride animatory state (in A) to 0x03/0x83 and postmidstride animatory state (in B) to 0x00/0x80 if ERIC's current xcoordinate is odd  
669E  DEC B  
669F  ADD A,$02  
66A1  JP $653C  Put ERIC midstride 
Prev: 6648  Up: Map  Next: 66A4 