Routines

32062: Continuation of routine at 32032


A Location identifier for ERIC (0-8)

32062 A7 AND A
32063 CAE87D JP Z,32232
32066 47 LD B,A B=ERIC's location identifier
32067 2EFB LD L,251 HL=32763
32069 CB4E BIT 1,(HL) Is ERIC falling, riding the bike, or on a plant?
32071 2812 JR Z,32091 Jump if not
32073 2EED LD L,237 HL=32749
32075 7E LD A,(HL)
32076 E683 AND 131 Check bits 0, 1 and 7
32078 280B JR Z,32091 Jump if ERIC's falling
32080 E602 AND 2 A=2 (2+62=64) if ERIC's standing on a plant or plant pot
32082 C2E87D JP NZ,32232 Jump unless ERIC's riding the bike
32085 05 DEC B B=0 now if ERIC's in the playground
32086 3E03 LD A,3 3+62=65: DON'T RIDE BIKES IN HERE
32088 20F8 JR NZ,32082 Jump unless ERIC's in the playground
32090 04 INC B
32091 2EE0 LD L,224 HL=32736
32093 7E LD A,(HL) A=lesson identifier
32094 E60F AND 15 Keep only bits 0-3 (room)
32096 4F LD C,A
32097 2E80 LD L,128 HL=32640
32099 CB76 BIT 6,(HL)
32101 2040 JR NZ,32167
32103 2EE4 LD L,228 HL=32740
32105 7E LD A,(HL) A=MSB of lesson time counter
32106 FE0C CP 12
32108 3818 JR C,32134
32110 2EFB LD L,251 HL=32763
32112 CB56 BIT 2,(HL) Is ERIC sitting down?
32114 C8 RET Z Return if not
32115 3A00D2 LD A,(53760) A=ERIC's animatory state
32118 FE04 CP 4 4: Is ERIC sitting in a chair?
32120 C8 RET Z Return if so
32121 FE85 CP 133 133: ERIC sitting on the floor facing right
32123 3E04 LD A,4 4+62=66: GET OFF THE FLOOR
32125 C2E87D JP NZ,32232 Jump if ERIC's not sitting on the floor facing right
32128 78 LD A,B A=ERIC's location identifier
32129 FE03 CP 3 Is ERIC in the assembly hall?
32131 20F6 JR NZ,32123 Jump if not
32133 C9 RET
32134 3E05 LD A,5
32136 B8 CP B Is ERIC in a classroom or the revision library?
32137 381C JR C,32167 Jump if not
32139 3E02 LD A,2
32141 B9 CP C Is it PLAYTIME?
32142 280E JR Z,32158 Jump if so
32144 3D DEC A A=1
32145 B8 CP B B=1 if ERIC's in the playground
32146 3E05 LD A,5 5+62=67: GET BACK TO SCHOOL
32148 2852 JR Z,32232 Jump if ERIC is in the playground
32150 79 LD A,C
32151 FE03 CP 3 Is it ASSEMBLY?
32153 2003 JR NZ,32158 Jump if not
32155 B8 CP B Is ERIC in the assembly hall?
32156 2818 JR Z,32182 Jump if so
32158 2EFB LD L,251 HL=32763
32160 CB56 BIT 2,(HL) Is ERIC sitting or lying down?
32162 C8 RET Z Return if not
32163 3E04 LD A,4 4+62=66: GET OFF THE FLOOR
32165 1841 JR 32232
32167 78 LD A,B A=ERIC's location identifier
32168 B9 CP C Compare that with where he should be
32169 3E06 LD A,6 6+62=68: GET ALONG NOW
32171 203B JR NZ,32232 Jump if ERIC's not where he should be
32173 3D DEC A A=5
32174 B9 CP C
32175 3820 JR C,32209 Jump if should be in a classroom, but isn't
32177 79 LD A,C
32178 FE03 CP 3 Is it ASSEMBLY?
32180 20E8 JR NZ,32158 Jump if not
32182 2E80 LD L,128 HL=32640
32184 CB7E BIT 7,(HL)
32186 3A00D2 LD A,(53760) A=ERIC's animatory state
32189 2005 JR NZ,32196
32191 FE85 CP 133 133: Is ERIC sitting on the floor facing right?
32193 20DB JR NZ,32158 Jump if not
32195 C9 RET
32196 FE85 CP 133 133: Is ERIC sitting on the floor facing right?
32198 C8 RET Z Return if so
32199 2EFB LD L,251 HL=32763
32201 3E07 LD A,7 7+62=69: SIT FACING THE STAGE
32203 CB56 BIT 2,(HL) Is ERIC sitting or lying down?
32205 2819 JR Z,32232 Jump if so
32207 1813 JR 32228
32209 3A00D2 LD A,(53760) A=ERIC's animatory state
32212 FE04 CP 4 4: Is ERIC sitting in a chair?
32214 C8 RET Z Return if so
32215 2EFB LD L,251 HL=32763
32217 CB56 BIT 2,(HL)
32219 3E04 LD A,4 4+62=66: GET OFF THE FLOOR
32221 2009 JR NZ,32232 Jump if ERIC's sitting or lying on the floor
32223 2E80 LD L,128 HL=32640
32225 CB7E BIT 7,(HL)
32227 C8 RET Z
32228 3E08 LD A,8 8+62=70: NOW SIT DOWN
32230 00 NOP
32231 00 NOP
32232 A7 AND A
32233 202B JR NZ,32278
32235 2E80 LD L,128 HL=32640
32237 CB6E BIT 5,(HL) Is MISS TAKE chasing ERIC?
32239 2024 JR NZ,32277 Jump if so
32241 3AE07F LD A,(32736) A=lesson identifier
32244 FE02 CP 2 Is it PLAYTIME?
32246 281D JR Z,32277 Jump if so
32248 7B LD A,E A=ERIC's x-coordinate
32249 FEA0 CP 160 Is ERIC in the girls' skool?
32251 3818 JR C,32277 Jump if not
32253 2102CC LD HL,52226 H=204 (MISS TAKE), L=2
32256 7E LD A,(HL) A=MISS TAKE's y-coordinate
32257 BA CP D Are ERIC and MISS TAKE on the same floor?
32258 200F JR NZ,32275 Jump if not
32260 2E1D LD L,29
32262 CBC6 SET 0,(HL) Signal: restart table of A&P (set to 32371 below)
32264 2D DEC L L=28
32265 367E LD (HL),126 Place the address of the table of A&P at 32371 into bytes 27 and 28 of MISS TAKE's buffer
32267 2D DEC L
32268 3673 LD (HL),115
32270 21807F LD HL,32640
32273 CBEE SET 5,(HL) Signal: MISS TAKE is chasing ERIC
32275 267F LD H,127
32277 AF XOR A 0+62=62: YOU ARE NOT ALLOWED HERE
32278 2EF7 LD L,247 HL=32759
32280 35 DEC (HL)
32281 34 INC (HL)

This entry point is used by the routine at 63586:
32282 F5 PUSH AF
32283 00 NOP
32284 00 NOP
32285 2809 JR Z,32296 Jump if we've come here from 63640
32287 2EF5 LD L,245 HL=32757
32289 66 LD H,(HL)
32290 2E01 LD L,1
32292 7E LD A,(HL)
32293 36E0 LD (HL),224
32295 6F LD L,A
32296 E5 PUSH HL
32297 CD626D CALL 28002 Check for teachers nearby
32300 E1 POP HL
32301 57 LD D,A D=character number of adult character who saw ERIC, or 0
32302 F1 POP AF
32303 47 LD B,A
32304 2804 JR Z,32310
32306 7D LD A,L
32307 2E01 LD L,1
32309 77 LD (HL),A
32310 7A LD A,D A=character number of adult character who saw ERIC, or 0
32311 FECD CP 205 Was it ALBERT?
32313 C8 RET Z Return if so (ALBERT doesn't give lines)
32314 A7 AND A Did any adult character see ERIC?
32315 C8 RET Z Return if not
32316 21807F LD HL,32640
32319 CB4E BIT 1,(HL) Is MR WACKER chasing ERIC to expel him?
32321 C0 RET NZ Return if so
32322 2EF5 LD L,245 HL=32757
32324 77 LD (HL),A Store character number of lines-giver here
32325 2EF7 LD L,247 HL=32759
32327 360A LD (HL),10
32329 78 LD A,B
32330 FE06 CP 6 6+62=68: GET ALONG NOW
32332 201B JR NZ,32361
32334 3AE07F LD A,(32736) Pick up the lesson identifier in A
32337 E6F0 AND 240 Keep only the bits relating to ERIC's teacher
32339 07 RLCA
32340 07 RLCA
32341 07 RLCA
32342 07 RLCA
32343 C6C7 ADD A,199 Now A=character number of teacher taking ERIC's lesson
32345 BA CP D Was it that teacher who saw ERIC?
32346 200D JR NZ,32361 Jump if not
32348 2E80 LD L,128 HL=32640
32350 3E10 LD A,16
32352 0609 LD B,9 9+62=71: COME ALONG YOU MONSTER
32354 AE XOR (HL)
32355 77 LD (HL),A
32356 CB66 BIT 4,(HL)
32358 2001 JR NZ,32361
32360 04 INC B 10+62=72: DON'T KEEP ME WAITING
32361 EB EX DE,HL
32362 78 LD A,B
32363 C63E ADD A,62
32365 47 LD B,A Now B=the lines message number
32366 3ED2 LD A,210 210=ERIC
32368 C31474 JP 29716 Make the teacher give lines to ERIC