H | Character number (if entering at 28242) |
28240 | 26D2 | LD H,210 | 210=ERIC |
28242 | 2E01 | LD L,1 | |
28244 | 5E | LD E,(HL) | E=character's x-coordinate |
28245 | 2C | INC L | |
28246 | 56 | LD D,(HL) | D=character's y-coordinate |
28247 | 7A | LD A,D | |
28248 | FE03 | CP 3 | Is the character on the top floor? |
28250 | C8 | RET Z | Return with carry reset if so |
28251 | FE0A | CP 10 | Is the character on the middle floor? |
28253 | C8 | RET Z | Return with carry reset if so |
28254 | FE11 | CP 17 | Is the character on the bottom floor? |
28256 | C8 | RET Z | Return with carry reset if so |
28257 | FE0E | CP 14 | The stage has y-coordinate 14 |
28259 | 2008 | JR NZ,28269 | Jump if the character's y-coordinate doesn't match that |
28261 | 7B | LD A,E | |
28262 | FE52 | CP 82 | 81 is the x-coordinate of the right-hand edge of the stage |
28264 | 3003 | JR NC,28269 | Jump if the character's to the right of this |
28266 | FE4C | CP 76 | 76 is the x-coordinate of the left-hand edge of the stage |
28268 | D0 | RET NC | Return with the carry flag reset if the character's on the stage |
28269 | 7A | LD A,D | |
28270 | FE0A | CP 10 | Is the character somewhere between the middle and bottom floors? |
28272 | 300D | JR NC,28287 | Jump if so |
28274 | 7B | LD A,E | |
28275 | FE40 | CP 64 | Is the character on the stairs leading up to the revision library? |
28277 | 3804 | JR C,28283 | Jump if so |
28279 | 3E00 | LD A,0 | Signal: character is on an up-and-to-the-left staircase |
28281 | 37 | SCF | Signal: character's on a staircase |
28282 | C9 | RET | Return with carry set and A=0 |
28283 | 3E80 | LD A,128 | Signal: character is on an up-and-to-the-right staircase |
28285 | 37 | SCF | Signal: character's on a staircase |
28286 | C9 | RET | Return with carry set and A=128 |
28287 | FE0F | CP 15 | |
28289 | 7B | LD A,E | |
28290 | 3806 | JR C,28298 | Jump if the character on or above the level of the stage |
28292 | FE80 | CP 128 | Is the character on either the stairs leading down from the stage or the stairs leading down from the toilets in the boys' skool? |
28294 | 38EF | JR C,28279 | Jump if so |
28296 | 18F1 | JR 28283 | The character is on the stairs leading down to the bottom floor in the girls' skool |
28298 | FE40 | CP 64 | Is the character on either the stairs leading down to the stage or the stairs leading down to the bottom floor in the girls' skool? |
28300 | 30ED | JR NC,28283 | Jump if so |
28302 | 3E00 | LD A,0 | Signal: character is on an up-and-to-the-left staircase (the one leading down from the toilets in the boys' skool, in fact) |
28304 | C9 | RET | Return with carry set |