| Routines

62032: Make MR WACKER put the kids in detention

Used by command list 72. Builds a detention message (using a random noun and verb) and makes MR WACKER deliver it.
Input
H | 200 (MR WACKER)
62032 | LD A,(32767) | A=leftmost column of the play area on screen
62035 | CP 48 | Is the stage off-screen to the right?
62037 | RET C | Return if so
62038 | CP 88 | Is the stage off-screen to the left?
62040 | RET NC | Return if so
62041 | CALL 25233 | A=random number
62044 | LD DE,32652 | Point DE at the first byte of message 10, which will be the verb
62047 | LD L,A | Save the random number in L briefly
62048 | AND 7 | Store the verb message number (144, 145, 146, 147, 148, 149, 150 or 151) at 32652
62050 | ADD A,144
62052 | LD (DE),A
62053 | LD A,L | Restore the random number to A
62054 | RRCA | Set A to another random number from 0 to 7
62055 | RRCA
62056 | RRCA
62057 | AND 7
62059 | LD E,142 | Point DE at the first byte of message 11, which will be the noun
62061 | ADD A,152 | Store the noun message number (152, 153, 154, 155, 156, 157, 158 or 159) at 32654
62063 | LD (DE),A
62064 | LD E,96 | Message 96: YOU'RE ALL IN DETENTION...
62066 | LD BC,27144 | Redirect control to the routine at 27144 (make character speak) and then return to 62072 (below)
62069 | CALL 25503
Control of MR WACKER resumes here when he has finished delivering the detention message.
62072 | EX DE,HL | Save MR WACKER's character number in D briefly
62073 | LD HL,32640 | Reset bit 6 (ERIC no longer has to be in the assembly hall) and bit 7 (the kids can stand up now) at 32640
62076 | RES 7,(HL)
62078 | RES 6,(HL)
62080 | NOP |
62081 | NOP
62082 | NOP
62083 | NOP
62084 | LD L,228 | Set the MSB of the lesson clock to 1 so that the bell will ring soon
62086 | LD (HL),1
62088 | EX DE,HL | Restore MR WACKER's character number (200) to H
62089 | JP 25484 | Move to the next command in the command list