Back to Skool Routines
25554: Return play area region identifier in A
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 left study door in boys' skool
190 Middle floor, left of far wall of science lab storeroom
191 Anywhere on bottom floor (or in mid-air!)
192 Assembly hall stage
193 Near middle-floor window in boys' skool
194 Top floor, right of left study door in 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 boys' skool outside classrooms
3 Assembly hall
4 Dining hall
5 Revision library, just outside 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.
D y-coordinate of play area
E x-coordinate of play area
25554 CALL 28067 Divert back to the calling routine with 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 D contains the 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
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 region entry in one of the tables below (C=61, 63, 65, 67, 69 or 71)
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=value in range 189-196 or 0-8 (see tables above)
25580 RET
The value picked up from (BC) can be determined from the tables below. The x-coordinate compared with that in E is shown in the column labelled "x", and the value returned (the first one such that E<=(BC)) is shown in the column labelled "ID".
C=60 C=62 C=64 C=66 C=68
x ID x ID x ID x ID x ID
B=183 72 189 96 194 159 191 224 196 top floor
B=184 63 190 76 191 96 193 159 191 224 195 middle floor
B=185 224 191 bottom floor
C=60 C=62 C=64 C=66 C=68 C=70
x ID x ID x ID x ID x ID x ID
B=186 23 7 29 2 40 5 63 8 224 0 top floor
B=187 30 2 53 6 224 0 middle floor
B=188 42 2 63 4 77 3 96 2 159 1 224 0 bottom floor