| Routines

32433: Print the lesson and ring the bell

Used by the routine at 63309. Prints the lesson or 'DEMO.MODE' in the lesson box, and makes the bell sound effect.
32433 | LD HL,32734 | 32734 holds the current game mode
32436 | LD A,(HL) | A=255 if we're in demo mode, 0 otherwise
32437 | INC A | Set the zero flag if we're in demo mode
32438 | LD A,63 | Message 63: DEMO.MODE
32440 | JR Z,32478 | Jump if we're in demo mode
A real game is in progress. First, figure out what to print in the bottom row of the lesson box (the room name, 'LIBRARY', 'PLAYTIME', 'ASSEMBLY' or 'DINNER').
32442 | LD L,224 | HL=32736 (lesson descriptor)
32444 | LD A,(HL) | Pick this up in A
32445 | AND 15 | Keep only the room identifier bits
32447 | LD E,32 | 32 is the ASCII code for SPACE
32449 | ADD A,126 | D=message number for the text to go on the bottom row of the lesson box
32451 | LD D,A
32452 | CP 131 | Is it PLAYTIME (128), ASSEMBLY (129) or DINNER (130)?
32454 | JR C,32470 | Jump if so
32456 | LD E,135 | Message 135: REVISION
32458 | JR Z,32470 | Jump if it's REVISION LIBRARY (D=131: LIBRARY)
Next, figure out what to print (if anything) in the top row of the lesson box (the teacher's name, or 'REVISION').
32460 | LD A,(HL) | A=lesson descriptor
32461 | AND 240 | Keep only the teacher-identifying bits and push them into bits 0-3
32463 | RLCA
32464 | RLCA
32465 | RLCA
32466 | RLCA
32467 | ADD A,20 | E=22, 23 or 24 (teacher's name)
32469 | LD E,A
Now we can construct message 16 (teacher/room) ready for printing.
32470 | LD L,136 | Place the teacher message number (or ASCII code for SPACE) in 32648
32472 | LD (HL),E
32473 | LD L,138 | Place the room message number in 32650
32475 | LD (HL),D
32476 | LD A,16 | Message 16: teacher/room
This entry point is used by the routine at 23907.
32478 | LD DE,23216 | DE=base display file address for the lesson box
32481 | LD C,87 | INK 7: PAPER 2: BRIGHT 1
32483 | CALL 27462 | Print the lesson
And finally, ring the bell. Your browser doesn't support HTML5 audio. Here is a link to the audio instead.
32486 | LD BC,32784 | Set the parameters for the bell sound effect
32489 | LD D,C
32490 | LD A,1
32492 | JP 29836 | Ring the bell