| Routines

63931: Check whether ERIC has 10000 lines

Used by the routine at 30457. The number of lines has just been printed. Has ERIC gone over the limit?
63931 | LD A,(32711) | Collect the MSB of the lines total
63934 | CP 3 | Is the lines total < 7680 (30*256)?
63936 | RET C | Return if so
63937 | JR NZ,63945 | Jump if the MSB > 3 (lines total > 10240)
63939 | LD A,(32710) | So the MSB is 3; collect the LSB from 32710
63942 | CP 232 | Is the lines total < 10000 (=232+256*30)?
63944 | RET C | Return if so
ERIC has 10000 lines or more. The end (of the game) is nigh.
63945 | PUSH HL |
63946 | LD HL,64226 | Point HL at the first of the last two commands in command list 222 ('Find ERIC', and 'Send ERIC home')
63949 | LD (41847),HL | Place this address into bytes 119 and 120 of MR WACKER's buffer, so that these commands become his command list
63952 | LD HL,41850 | Set bit 0 of byte 122 of MR WACKER's buffer, triggering a command list restart
63955 | SET 0,(HL)
63957 | LD HL,32760 | Set the MSB of the lesson clock to 255 (so that the lesson cannot end before MR WACKER has begun looking for ERIC)
63960 | LD (HL),255
63962 | POP HL |
63963 | RET |