Routines

63309: Change lesson


This routine is called from the main loop at 63210

HL 32740

63309 3610 LD (HL),16 Reset the MSB of the lesson time counter
63311 CD58F8 CALL 63576 Clear 32640 to 32647
63314 2EDF LD L,223 HL=32735
63316 7E LD A,(HL) A=current lesson number (192-255)
63317 3C INC A
63318 F6C0 OR 192
63320 77 LD (HL),A
63321 5F LD E,A E=next lesson number
63322 16B5 LD D,181
63324 1A LD A,(DE) Pick up the lesson type in A
63325 5F LD E,A
63326 16D2 LD D,210 The lesson identifiers are in ERIC's buffer
63328 1A LD A,(DE) Pick up the lesson identifier
63329 2C INC L HL=32736
63330 77 LD (HL),A Store it here
63331 15 DEC D D=209 (HAYLEY)

We now enter a loop to transfer the address of a table of A&P into each character's buffer.
63332 62 LD H,D
63333 1A LD A,(DE) A=table of A&P number from character's timetable
63334 D9 EXX
63335 26E8 LD H,232
63337 6F LD L,A
63338 7E LD A,(HL) A=LSB of start address of table of A&P
63339 2C INC L
63340 D9 EXX
63341 2E1B LD L,27
63343 77 LD (HL),A This goes into byte 27 of the character's buffer
63344 2C INC L
63345 D9 EXX
63346 7E LD A,(HL) A=MSB of start address of table of A&P
63347 D9 EXX
63348 77 LD (HL),A Place this into byte 28 of the character's buffer
63349 2C INC L L=29
63350 CBC6 SET 0,(HL) Signal: restart table of A&P at next available opportunity
63352 7C LD A,H
63353 FEC6 CP 198 Are we dealing with one of the characters 198-209?
63355 3026 JR NC,63395 Jump if so
63357 CBDE SET 3,(HL) Signal to 25134: move this character straight to first destination in table of A&P if appropriate
63359 D9 EXX
63360 0601 LD B,1
63362 67 LD H,A
63363 3AFF7F LD A,(32767) A=column of play area at far left of screen
63366 FE50 CP 80 Characters 183 (little girl no. 1) to 197 (little boy no. 8) get special treatment. If they are off-screen when the bell rings, and the first routine address in their new table of A&P is 25700 (the Go to... routine), they are moved immediately to the destination that follows in the third and fourth bytes of the table.
63368 3005 JR NC,63375
63370 7C LD A,H
63371 FEBE CP 190
63373 1810 JR 63391
63375 FE78 CP 120
63377 7C LD A,H
63378 3008 JR NC,63388
63380 FEC1 CP 193
63382 300A JR NC,63394
63384 FEBA CP 186
63386 1802 JR 63390
63388 FEBE CP 190
63390 3F CCF
63391 DC2E62 CALL C,25134
63394 D9 EXX
63395 15 DEC D Next character
63396 7A LD A,D
63397 FEB6 CP 182
63399 20BB JR NZ,63332 Jump back unitl all characters have been done
63401 C3B17E JP 32433 Print lesson and ring bell