Prev: 25534 Up: Map Next: 25581
25554: Get the play area region identifier for a given location
Used by the routines at 25700, 25843 and 32379. The value returned in A (corresponding to the location in DE) is as follows:
ID Region
189 Top floor, left of the left study door in the boys' skool
190 Middle floor, left of the far wall of the Science Lab storeroom
191 Anywhere on the bottom floor (or in mid-air!)
192 Assembly hall stage
193 Near the middle-floor window in the boys' skool
194 Top floor, right of the left study door in the boys' skool
195 Middle floor, girls' skool
196 Top floor, girls' skool
Or if the entry point at 25557 is used (for ERIC's location):
ID Region
0 None of the places below (ERIC is never allowed here)
1 Playground
2 Various places in the boys' skool outside classrooms
3 Assembly hall
4 Dining hall
5 Revision Library, outside the Yellow Room door
6 Science Lab
7 Blue Room
8 Yellow Room
The carry flag is set upon return to the caller of this routine if the coordinates in DE correspond to a location on a staircase.
Input
D y-coordinate of the play area (3-17)
E x-coordinate of the play area (0-190)
25554 CALL 28067 Divert back to the calling routine with A=192 and the carry flag reset if the character is on the assembly hall stage; otherwise return here with B=182 and C=59
This entry point is used by the routine at 32000 with ERIC's coordinates in DE, B=185, and C=59.
25557 LD A,D A=y-coordinate
25558 INC B Set B to 183 (186) if D<=6 (top floor), 184 (187) if 7<=D<=13 (middle floor), or 185 (188) if 14<=D<=18 (bottom floor)
25559 SUB 7
25561 JR NC,25558
Now BC will be used to index one of the skool region tables that contain the location identifiers:
Address Region
46908 Top floor
47164 Middle floor
47420 Bottom floor
47676 Top floor (ERIC)
47932 Middle floor (ERIC)
48188 Bottom floor (ERIC)
25563 CP 252 Does D=3, 10 or 17 (top, middle, bottom floor)?
25565 JR Z,25571 Jump if so
25567 SCF Signal: D does not correspond exactly to the top, middle or bottom floor
25568 NOP
25569 NOP
25570 NOP
25571 PUSH AF Save the carry flag temporarily
25572 INC C Point BC at the appropriate entry in one of the region tables
25573 LD A,(BC)
25574 INC C
25575 CP E
25576 JR C,25572
25578 POP AF Restore the carry flag (reset if D=3, 10 or 17; set otherwise)
25579 LD A,(BC) A=region identifier (189-196 or 0-8; see the tables above)
25580 RET
Prev: 25534 Up: Map Next: 25581