| Routines

63668: Adjust the game mode

Used by the routines at 26880 (to prepare the shields and safe for a new game), 28143 (when the last shield has just been flashed or unflashed) and 63270 (when ERIC has opened the safe).
63668 | PUSH HL |
63669 | LD HL,32747 | 32747 holds the shield counter
63672 | LD (HL),15 | Restore the shield counter to 15
63674 | DEC L | HL=32746 (game mode indicator)
63675 | INC (HL) | A=1 if the game has just started, 2 if the 15th shield was just flashed, 3 if the safe was just opened, or 4 if the 15th shield was just unflashed
63676 | LD A,(HL)
63677 | LD HL,(32708) | HL=score
63680 | CP 4 | Was the 15th shield just unflashed?
63682 | JR NZ,63704 | Jump if not
ERIC has just hit the 15th shield and made it unflash.
63684 | LD DE,500 | Add 5000 to the score and print it
63687 | ADD HL,DE
63688 | CALL 62705
63691 | LD HL,65248 | 65248='WELL DONE! GO UP A YEAR'
63694 | CALL 63919 | Print this in the lesson box
63697 | LD A,12 | Set the MSB of the lesson clock to 12
63699 | LD (32760),A
63702 | LD A,1 | Ensure that the 'DEC A' below sets the zero flag
63704 | DEC A | Was the 15th shield just flashed or the safe just opened?
63705 | JR NZ,63718 | Jump if so
Either the game has just started, or the 15th shield was just unflashed.
63707 | CALL 63573 | Generate a new safe combination code, and a new random birth year for MR CREAK
63710 | CALL 63242 | Unflash the safe and all the shields
63713 | CALL 32400 | Play the theme tune
63716 | POP HL |
63717 | RET |
ERIC has just hit the 15th shield and made it flash (A=1), or just opened the safe (A=2).
63718 | LD DE,100 | Add 1000 to the score
63721 | ADD HL,DE
63722 | DEC A | Was the safe just opened?
63723 | JR NZ,63726 | Jump if so
63725 | ADD HL,DE | Add 1000 more to the score if the 15th shield was hit
63726 | CALL 62705 | Print the new score
63729 | CALL 32406 | Play the 'Got all the shields' tune
63732 | POP HL |
63733 | RET |