| Routines

7940: Print the lesson

Used by the routine at F9A5. Prints the lesson (or DINNER or PLAYTIME) in the lesson box.
7940 | LD A,($7FF4) | Pick up the lesson descriptor from 7FF4
7943 | AND $07 | Keep only the 'room' bits (bits 0-2)
7945 | CP $05 | Set the zero flag if this period is REVISION LIBRARY, and set the carry flag if this is a classroom period
7947 | LD DE,$ED30 | Point DE at the appropriate spot in the lesson box graphic buffer (at ED00) for the first line of text
794A | LD HL,$DA89 | DA89=' ' (single space)
794D | JR NZ,$7951 | Jump if this period is not REVISION LIBRARY
794F | LD L,$80 | HL=DA80: 'REVISION'
7951 | JR NC,$7964 | Jump if this is REVISION LIBRARY, DINNER or PLAYTIME
This period takes place in a classroom. With which teacher?
7953 | LD A,($7FF4) | Pick up the lesson descriptor from 7FF4
7956 | AND $F0 | Keep only the 'teacher' bits (bits 4-7)
7958 | LD L,A | Point HL at the appropriate teacher's name: D9B8 (MR WACKER), D9C6 (MR ROCKITT), D9D4 (MR WITHIT), or D9E2 (MR CREAK)
7959 | RRCA
795A | RRCA
795B | RRCA
795C | LD H,A
795D | LD A,L
795E | SUB H
795F | ADD A,$B8
7961 | LD L,A
7962 | LD H,$D9
7964 | CALL $755A | Write the first line of text (' ', 'REVISION' or the teacher's name) into the lesson box graphic buffer
7967 | LD A,($7FF4) | Pick up the lesson descriptor from 7FF4
796A | AND $07 | Keep only the 'room' bits (bits 0-2)
796C | ADD A,A | Point HL at the appropriate room name: DA90 (READING ROOM), DAA0 (MAP ROOM), DAB0 (WHITE ROOM), DAC0 (EXAM ROOM), DAE0 (DINNER), or DAF0 (PLAYTIME)
796D | ADD A,A
796E | ADD A,A
796F | ADD A,A
7970 | ADD A,$80
7972 | LD L,A
7973 | LD H,$DA
This entry point is also used by the routine at F9A5.
7975 | LD DE,$ED80 | Point DE at the appropriate spot in the lesson box graphic buffer (at ED00) for the second line of text
7978 | CALL $755A | Write the second line of text into the buffer
797B | LD HL,$ED00 | Point HL at the start of the lesson box graphic buffer
797E | LD DE,$5AAC | Set DE to the attribute file address for the lesson box
7981 | JP $7519 | Copy the lesson box graphic buffer to the screen