![]() |
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 | Get random number in A |
| 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 message) |
| 32013 | RRA | |
| 32014 | NOP | |
| 32015 | EX DE,HL | HL=address of 100s digit of page number in message |
| 32016 | LD (HL),47 | |
| 32018 | INC (HL) | Insert the ASCII code for the 100s digit of the page number |
| 32019 | SUB 100 | |
| 32021 | JR NC,32018 | |
| 32023 | INC L | HL=address of 10s digit of page number in message |
| 32024 | ADD A,100 | |
| 32026 | LD (HL),47 | |
| 32028 | INC (HL) | Insert the ASCII code for the 10s digit of the page number |
| 32029 | SUB 10 | |
| 32031 | JR NC,32028 | |
| 32033 | INC L | HL=address of units digit of page number in message |
| 32034 | ADD A,58 | Insert the ASCII code for the unit digit of the page number |
| 32036 | LD (HL),A | |
| 32037 | EX DE,HL |
| 32038 | LD L,108 | Place the address of the message in 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 into bytes 105 and 106 of the character's buffer and jump to it |
| 32046 | JR 31985 |