![]() |
Routines |
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 |
---|
A | Location identifier for ERIC (0-8) |
32062 | AND A | Is ERIC in a forbidden zone? |
32063 | JP Z,32232 | Jump with A=0 (0+62=62: YOU ARE NOT ALLOWED HERE) if so |
32066 | LD B,A | B=ERIC's location identifier (1-8) |
32067 | LD L,251 | HL=32763 (ERIC's status flags) |
32069 | BIT 1,(HL) | Is ERIC on the bike, on a plant, or falling? |
32071 | JR Z,32091 | Jump if not |
32073 | LD L,237 | HL=32749 (ERIC's other status flags) |
32075 | LD A,(HL) | Pick these up in A |
32076 | AND 131 | Check bits 0, 1 and 7 |
32078 | JR Z,32091 | Jump if ERIC's falling |
32080 | AND 2 | A=2 (2+62=64: GET OFF THE PLANTS) if ERIC's standing on a plant or plant pot |
32082 | JP NZ,32232 | Jump if ERIC is (a) standing on a plant or plant pot, or (b) riding or standing on the saddle of the bike inside the boys' skool |
32085 | DEC B | B=0 now if ERIC's in the playground |
32086 | LD A,3 | 3+62=65: DON'T RIDE BIKES IN HERE |
32088 | JR NZ,32082 | Jump if ERIC's riding the bike in the boys' skool |
32090 | INC B | B=ERIC's location identifier (1-8) |
32091 | LD L,224 | HL=32736 (lesson identifier) |
32093 | LD A,(HL) | Pick this up in A |
32094 | AND 15 | Keep only the "room" bits (bits 0-3) |
32096 | LD C,A | Copy the room bits to C |
C | Lesson/location | 2 | Playtime | 3 | Assembly | 4 | Dinner | 5 | Revision library | 6 | Science lab | 7 | Blue room | 8 | Yellow room |
---|
32097 | LD L,128 | HL=32640 (various game status flags) |
32099 | BIT 6,(HL) | Should ERIC be in class, assembly or the dinner hall by now? |
32101 | JR NZ,32167 | Jump if so |
32103 | LD L,228 | Pick up the MSB of the lesson time counter from 32740 |
32105 | LD A,(HL) | |
32106 | CP 12 | Should ERIC by now have left the classroom he was in last period? |
32108 | JR C,32134 | Jump if so |
32110 | LD L,251 | HL=32763 (ERIC's status flags) |
32112 | BIT 2,(HL) | Is ERIC sitting or lying down? |
32114 | RET Z | Return if not |
32115 | LD A,(53760) | A=ERIC's animatory state |
32118 | CP 4 | 4: Is ERIC sitting in a chair? |
32120 | RET Z | Return if so |
32121 | CP 133 | 133: ERIC sitting on the floor facing right |
32123 | LD A,4 | 4+62=66: GET OFF THE FLOOR |
32125 | JP NZ,32232 | Give lines if ERIC's (a) sitting on the floor facing left, or (b) sitting on the floor facing right anywhere outside the assembly hall |
32128 | LD A,B | A=ERIC's location identifier (1-8) |
32129 | CP 3 | Is ERIC in the assembly hall? |
32131 | JR NZ,32123 | Give lines if not |
32133 | RET |
32134 | LD A,5 | Location IDs 6-8 correspond to boys' skool classrooms |
32136 | CP B | Is ERIC in the blue room, yellow room or science lab? |
32137 | JR C,32167 | Jump if so |
32139 | LD A,2 | Is it PLAYTIME? |
32141 | CP C | |
32142 | JR Z,32158 | Jump if so |
32144 | DEC A | A=1 |
32145 | CP B | B=1 if ERIC's in the playground |
32146 | LD A,5 | 5+62=67: GET BACK TO SCHOOL |
32148 | JR Z,32232 | Give lines if ERIC is in the playground |
32150 | LD A,C | Is it ASSEMBLY? |
32151 | CP 3 | |
32153 | JR NZ,32158 | Jump if not |
32155 | CP B | Is ERIC in the assembly hall? |
32156 | JR Z,32182 | Jump if so |
32158 | LD L,251 | HL=32763 (ERIC's status flags) |
32160 | BIT 2,(HL) | Is ERIC sitting or lying down? |
32162 | RET Z | Return if not |
32163 | LD A,4 | 4+62=66: GET OFF THE FLOOR |
32165 | JR 32232 | Give lines |
32167 | LD A,B | A=ERIC's location identifier (1-8) |
32168 | CP C | Compare that with where he should be |
32169 | LD A,6 | 6+62=68: GET ALONG NOW |
32171 | JR NZ,32232 | Give lines if ERIC's not where he should be |
32173 | DEC A | A=5 |
32174 | CP C | C>5 if this lesson is in a classroom |
32175 | JR C,32209 | Jump if this lesson is in a classroom |
32177 | LD A,C | Is it ASSEMBLY? |
32178 | CP 3 | |
32180 | JR NZ,32158 | Jump if not |
32182 | LD L,128 | HL=32640 (various game status flags) |
32184 | BIT 7,(HL) | Bit 7 is set if ERIC should be sitting down now |
32186 | LD A,(53760) | A=ERIC's animatory state |
32189 | JR NZ,32196 | Jump if ERIC should be sitting facing the stage now |
32191 | CP 133 | 133: Is ERIC sitting on the floor facing right? |
32193 | JR NZ,32158 | Jump if not |
32195 | RET |
32196 | CP 133 | 133: Is ERIC sitting on the floor facing right? |
32198 | RET Z | Return if so |
32199 | LD L,251 | HL=32763 (ERIC's status flags) |
32201 | LD A,7 | 7+62=69: SIT FACING THE STAGE |
32203 | BIT 2,(HL) | Is ERIC sitting (facing left) or lying down? |
32205 | JR Z,32232 | Tell ERIC to sit facing the stage if not (this is a bug) |
32207 | JR 32228 | Otherwise tell ERIC to sit down |
32209 | LD A,(53760) | A=ERIC's animatory state |
32212 | CP 4 | 4: Is ERIC sitting in a chair? |
32214 | RET Z | Return if so |
32215 | LD L,251 | HL=32763 (ERIC's status flags) |
32217 | BIT 2,(HL) | Bit 2 is set if ERIC's sitting or lying on the floor |
32219 | LD A,4 | 4+62=66: GET OFF THE FLOOR |
32221 | JR NZ,32232 | Give lines if ERIC's sitting or lying on the floor |
32223 | LD L,128 | HL=32640 (various game status flags) |
32225 | BIT 7,(HL) | Should ERIC be seated by now (bit 7 is set by 61696)? |
32227 | RET Z | Return if not |
32228 | LD A,8 | 8+62=70: NOW SIT DOWN |
32230 | NOP | |
32231 | NOP |
32232 | AND A | Is ERIC in a forbidden zone? |
32233 | JR NZ,32278 | Jump if not |
32235 | LD L,128 | HL=32640 (various game status flags) |
32237 | BIT 5,(HL) | Is MISS TAKE chasing ERIC? |
32239 | JR NZ,32277 | Jump if so |
32241 | LD A,(32736) | A=lesson identifier |
32244 | CP 2 | Is it PLAYTIME? |
32246 | JR Z,32277 | Jump if so |
32248 | LD A,E | A=ERIC's x-coordinate |
32249 | CP 160 | Is ERIC in the girls' skool? |
32251 | JR C,32277 | Jump if not |
32253 | LD HL,52226 | H=204 (MISS TAKE), L=2 |
32256 | LD A,(HL) | A=MISS TAKE's y-coordinate |
32257 | CP D | Are ERIC and MISS TAKE on the same floor? |
32258 | JR NZ,32275 | Jump if not |
32260 | LD L,29 | Set bit 0 of byte 29 of MISS TAKE's character buffer, triggering a restart of her command list (set to 32371 below) |
32262 | SET 0,(HL) | |
32264 | DEC L | Place the address of the command list at 32371 into bytes 27 and 28 of MISS TAKE's buffer; this command list contains a single routine address: 32373 |
32265 | LD (HL),126 | |
32267 | DEC L | |
32268 | LD (HL),115 | |
32270 | LD HL,32640 | 32640 holds various game status flags |
32273 | SET 5,(HL) | Signal: MISS TAKE is chasing ERIC |
32275 | LD H,127 | Point HL at the game status buffer page |
32277 | XOR A | 0+62=62: YOU ARE NOT ALLOWED HERE |
32278 | LD L,247 | HL=32759 (MSB of lines-giving delay counter) |
32280 | DEC (HL) | Reset the zero flag if it's too soon for the teacher who gave ERIC lines last time to give him lines again |
32281 | INC (HL) |
32282 | PUSH AF | Save the lines message ID and the zero flag |
32283 | NOP | |
32284 | NOP | |
32285 | JR Z,32296 | Jump if any teacher (including the one who gave him lines last time) can give ERIC lines now |
32287 | LD L,245 | Collect from 32757 into H the character number of the teacher who last gave ERIC lines |
32289 | LD H,(HL) | |
32290 | LD L,1 | A=this teacher's x-coordinate |
32292 | LD A,(HL) | |
32293 | LD (HL),224 | Set this teacher's x-coordinate to 224 temporarily to take him out of lines-giving range |
32295 | LD L,A | Save the teacher's real x-coordinate in L |
32296 | PUSH HL | |
32297 | CALL 28002 | Find the first adult within lines-giving range of ERIC |
32300 | POP HL | |
32301 | LD D,A | D=character number of this adult, or 0 if there are none in range |
32302 | POP AF | |
32303 | LD B,A | B=lines message ID |
32304 | JR Z,32310 | Jump unless we need to restore the x-coordinate of the teacher who last gave ERIC lines |
32306 | LD A,L | Restore the x-coordinate of the teacher who last gave ERIC lines |
32307 | LD L,1 | |
32309 | LD (HL),A | |
32310 | LD A,D | A=character number of the adult who can see ERIC, or 0 if there are no adults in range |
32311 | CP 205 | Is it ALBERT (and therefore none of the teachers)? |
32313 | RET Z | Return if so (ALBERT doesn't give lines) |
32314 | AND A | Can any adult character see ERIC? |
32315 | RET Z | Return if not |
32316 | LD HL,32640 | 32640 holds various game status flags |
32319 | BIT 1,(HL) | Is MR WACKER chasing ERIC to expel him? |
32321 | RET NZ | Return if so |
32322 | LD L,245 | Store the character number of the lines-giver at 32757 |
32324 | LD (HL),A | |
32325 | LD L,247 | Reset the MSB of the lines-giving delay counter at 32759 to 10 |
32327 | LD (HL),10 | |
32329 | LD A,B | A=lines message ID |
32330 | CP 6 | 6+62=68: GET ALONG NOW |
32332 | JR NZ,32361 | Jump unless ERIC is late for class, dinner or assembly |
32334 | LD A,(32736) | Pick up the lesson identifier in A |
32337 | AND 240 | Keep only the bits relating to ERIC's teacher and shift them into bits 0-3 |
32339 | RLCA | |
32340 | RLCA | |
32341 | RLCA | |
32342 | RLCA | |
32343 | ADD A,199 | Now A=character number of ERIC's teacher (200-203) |
32345 | CP D | Was it that teacher who saw ERIC? |
32346 | JR NZ,32361 | Jump if not |
32348 | LD L,128 | HL=32640 (various game status flags) |
32350 | LD A,16 | Set bit 4 in A |
32352 | LD B,9 | 9+62=71: COME ALONG YOU MONSTER |
32354 | XOR (HL) | Flip bit 4 in 32640, toggling between 71 and 72 |
32355 | LD (HL),A | |
32356 | BIT 4,(HL) | Should ERIC's teacher say "COME ALONG YOU MONSTER" this time (bit 4 set)? |
32358 | JR NZ,32361 | Jump if so |
32360 | INC B | 10+62=72: DON'T KEEP ME WAITING |
32361 | EX DE,HL | Now H=character number of lines-giver |
32362 | LD A,B | B=lines message number |
32363 | ADD A,62 | |
32365 | LD B,A | |
32366 | LD A,210 | 210=ERIC (the lines recipient) |
32368 | JP 29716 | Make the teacher give lines to ERIC |