| Routines

F05D: Make a teacher tell the class what to do

Used by the routine at F100. Makes the teacher choose between messages 0x59, 0x5A and 0x5B (in a lesson without ERIC and EINSTEIN, or a lesson with no question-and-answer session).
Input
H | Teacher's character number (0xC9-0xCC)
F05D | CALL $6291 | A=random number
F060 | CP $F0 | Set the carry flag if A<0xF0, and set the zero flag if A<0x80
F062 | BIT 7,A
F064 | LD E,$5B |
F066 | JR NC,$F06C | Jump if it's essay time (A>=0xF0)
F068 | JR Z,$F06B | Jump if it's book-reading time (A<0x80)
F06A | DEC E | It's revision time (0x80<=A<0xF0)
F06B | DEC E |
Now E holds the appropriate message number:
E | Message
--- | ---
0x59 | START REVISING FOR YOUR EXAMS
0x5A | START READING AT THE NEXT CHAPTER IN YOUR BOOKS
0x5B | WRITE AN ESSAY TITLED 'WHY I LOVE SCHOOL'
F06C | LD BC,$6A08 | Redirect control to the routine at 6A08 (make character speak), then return control to the calling routine
F06F | JP $639F