![]() |
Routines |
| H | Character number of teacher (163-166) |
| 31996 | LD DE,62063 | BC=62050 (TURN TO PAGE 123 OF YOUR BOOKS...); DE=62063 (address of '123' in this message) |
| 31999 | LD C,98 | |
| 32001 | LD B,D | |
| 32002 | CALL 24993 | A=random number |
| 32005 | RLCA | This jump (which decides between the message at 62050 and the message at 62109) is performed half the time |
| 32006 | JR C,32012 | |
| 32008 | LD E,186 | BC=62109 (ANSWER THE QUESTIONS ON PAGE 123 OF YOUR LOVELY TEXTBOOK); DE=62138 (address of '123' in this message) |
| 32010 | LD C,157 | |
| 32012 | SCF | A=128-255 (random page number to insert into the message) |
| 32013 | RRA | |
| 32014 | NOP | |
| 32015 | EX DE,HL | Point HL at the slot for the 100s digit of the page number in the message |
| 32016 | LD (HL),47 | Compute and insert the ASCII code for the 100s digit of the page number |
| 32018 | INC (HL) | |
| 32019 | SUB 100 | |
| 32021 | JR NC,32018 | |
| 32023 | INC L | Point HL at the slot for the 10s digit of the page number |
| 32024 | ADD A,100 | Compensate for the trial subtraction of 100 above |
| 32026 | LD (HL),47 | Compute and insert the ASCII code for the 10s digit of the page number |
| 32028 | INC (HL) | |
| 32029 | SUB 10 | |
| 32031 | JR NC,32028 | |
| 32033 | INC L | Point HL at the slot for the units digit of the page number |
| 32034 | ADD A,58 | Compensate for the trial subtraction of 10 above, and add an extra 48 (the ASCII code for '0') |
| 32036 | LD (HL),A | Insert the ASCII code for the units digit of the page number |
| 32037 | EX DE,HL | Restore the teacher's character number to H |
| 32038 | LD L,108 | Place the address of the message into bytes 107 and 108 of the character's buffer |
| 32040 | LD (HL),B | |
| 32041 | DEC L | |
| 32042 | LD (HL),C | |
| 32043 | LD BC,31110 | Place the address of the routine at 31110 (make character speak) into bytes 105 and 106 of the character's buffer and jump to it |
| 32046 | JR 31985 |