Prev: 25981 Up: Map Next: 26075
25983: 'A' pressed - down
The address of this routine is found in the table of keypress handling routines at 26624. It is called from the main loop at 26471 when 'A' or '6' is pressed, and is also used by the routines at 26194 and 26282.
Input
B ERIC's animatory state
DE ERIC's coordinates
25983 CALL 25956 Is ERIC sitting or lying down?
25986 RET NZ Return if so
25987 BIT 6,A Bit 6 of ERIC's status flags at 32763 is always reset, so this jump (which should be to 26067) is never made
25989 JR NZ,26068
25991 LD A,D A=ERIC's y-coordinate
25992 CP 169 Is ERIC on the bottom floor?
25994 JR Z,26067 Jump forward to move him left or right if so
25996 CP 162 Is ERIC on the middle floor?
25998 JR Z,26047 Jump if so
26000 CP 155 Is ERIC on the top floor?
26002 JR Z,26047 Jump if so
ERIC's not on the top, middle or bottom floor, so he must be on a staircase. Should he go down a step, or turn round first?
26004 LD A,E A=ERIC's x-coordinate
26005 CP 48 Set the carry flag if ERIC's on a staircase at the left of the skool
26007 BIT 7,B Set the zero flag if ERIC is facing left
26009 JR C,26016 Jump if ERIC's on a staircase at the left of the skool
26011 JP NZ,25962 Turn ERIC round if he's facing up a staircase at the right of the skool
26014 JR 26019
26016 JP Z,25962 Turn ERIC round if he's facing up a staircase at the left of the skool
ERIC's at the top of or on a staircase, facing the bottom of it.
26019 LD H,D Copy ERIC's coordinates to HL
26020 LD L,E
26021 NOP
26022 INC D Down a step
26023 DEC E One pace to the left
26024 LD B,2 2=ERIC standing, facing left
26026 CP 48 Is ERIC on a staircase on the right side of the skool?
26028 JR NC,26034 Jump if so
26030 LD B,130 130=ERIC standing, facing right
26032 INC E One pace to the right (taking into the account the one pace to the left made above)
26033 INC E
26034 LD A,B A=2/130
26035 BIT 0,L A=1/129, B=2/130 if ERIC's current x-coordinate is even; A=3/131, B=0/128 if ERIC's current x-coordinate is odd
26037 JR Z,26043
26039 DEC B
26040 DEC B
26041 ADD A,2
26043 DEC A
26044 JP 25916 Update ERIC's animatory state and location
ERIC is on the middle floor or the top floor.
26047 LD A,E A=ERIC's x-coordinate
26048 CP 12 This is the x-coordinate of the tops of the staircases at the left of the skool
26050 JR NZ,26059 Jump unless ERIC is there
26052 BIT 7,B Is ERIC facing left?
26054 JP Z,26194 Move ERIC left if so
26057 JR 26019 Otherwise send ERIC down a step
26059 CP 77 This is the x-coordinate of the tops of the staircases at the right of the skool
26061 JR NZ,26067 Jump unless ERIC is there
26063 BIT 7,B Is ERIC facing left?
26065 JR Z,26019 Send ERIC down a step if so
This entry point is used by the routine at 26084.
26067 BIT 7,B Is ERIC facing left?
26069 JP Z,26194 Move ERIC left if so
26072 JP 26282 Otherwise move ERIC right
Prev: 25981 Up: Map Next: 26075