![]() |
Routines |
Prev: 28304 | Up: Map | Next: 28380 |
D | 155 (top floor), 162 (middle floor) or 169 (bottom floor) |
E | x-coordinate of character |
28327 | LD A,E | A=x (character's x-coordinate) |
28328 | LD BC,24576 | B=96, C=0 (maximum and minimum bounds) |
28331 | SUB 10 | Is the character's x-coordinate < 10? |
28333 | JR C,28356 | Jump if so |
28335 | LD C,A | C=x-10 |
28336 | LD A,D | A=floor nearest to the character |
28337 | CP 169 | Is the character nearest the bottom floor? |
28339 | JR Z,28356 | Jump if so |
28341 | CP 162 | 162=middle floor |
28343 | LD A,38 | 38=x-coordinate of the Exam Room wall |
28345 | JR Z,28349 | Jump if the character is nearest the middle floor |
28347 | LD A,57 | 57=x-coordinate of the Map Room wall |
28349 | CP C | Is the character more than 10 paces to the right of a wall? |
28350 | JR C,28356 | Jump if so |
28352 | CP E | Is the character to the left of a wall? |
28353 | JR NC,28356 | Jump if so |
28355 | LD C,A | C=x-coordinate of the wall that the character is within 10 paces to the right of |
Now C holds the lower x-coordinate of the visibility range. Time to calculate the upper x-coordinate.
|
||
28356 | LD A,E | A=x (character's x-coordinate) |
28357 | ADD A,10 | A=x+10 |
28359 | CP B | Is the character within 10 paces of the far right wall? |
28360 | RET NC | Return if so |
28361 | LD B,A | B=x+10 |
28362 | LD A,D | A=floor nearest to the character |
28363 | CP 169 | Is the character nearest the bottom floor? |
28365 | RET Z | Return if so |
28366 | CP 162 | 162=middle floor |
28368 | LD A,37 | 37=x-coordinate of the White Room wall |
28370 | JR Z,28374 | Jump if the character is nearest the middle floor |
28372 | LD A,56 | 56=x-coordinate of the Reading Room wall |
28374 | CP B | Is the character more than 10 paces to the left of a wall? |
28375 | RET NC | Return if so |
28376 | CP E | Is the character to the right of a wall? |
28377 | RET C | Return if so |
28378 | LD B,A | B=x-coordinate of the wall |
28379 | RET |
Prev: 28304 | Up: Map | Next: 28380 |