![]() |
Routines |
Prev: 63488 | Up: Map |
Used by the routine at 63668. Generates a new safe combination code, sets a new random birth year for MR CREAK, and adjusts the game mode (so that all the shields need to be flashed again).
|
|||||||||
63573 | LD HL,32696 | Clear the safe combination code (stored at 32671), the teachers' combination letters (stored at 32675), and the blackboard contents buffers (at 32680, 32686 and 32692) | |||||||
63576 | LD B,25 | ||||||||
63578 | LD (HL),A | ||||||||
63579 | DEC L | ||||||||
63580 | DJNZ 63578 | ||||||||
63582 | LD D,A | DE=0 | |||||||
63583 | LD E,A | ||||||||
63584 | LD C,4 | There are four letters in the combination | |||||||
63586 | CALL 24993 | A=random number | |||||||
63589 | AND 15 | 0<=A<=15 | |||||||
63591 | JR 63612 | Store MR WACKER's safe combination letter first (at 32671) | |||||||
63593 | LD L,159 | HL=32671 (first letter of the safe combination code) | |||||||
63595 | ADD HL,BC | HL=32671+C (1<=C<=3) | |||||||
63596 | CALL 24993 | A=random number | |||||||
63599 | LD E,B | E=0 | |||||||
63600 | RRCA | Get a random number between 0 and 3 in E | |||||||
63601 | RL E | ||||||||
63603 | RRCA | ||||||||
63604 | RL E | ||||||||
63606 | AND 31 | Is A between 0 and 25? | |||||||
63608 | CP 26 | ||||||||
63610 | JR NC,63596 | Jump back if not | |||||||
63612 | ADD A,65 | A=ASCII code of an upper case letter | |||||||
63614 | LD (HL),A | Store this in one of the slots at 32671 | |||||||
63615 | LD L,163 | Point HL at a random teacher's safe combination letter | |||||||
63617 | ADD HL,DE | ||||||||
63618 | BIT 6,(HL) | Has this letter already been decided? | |||||||
63620 | JR NZ,63593 | Jump if so | |||||||
63622 | LD (HL),A | Store the ASCII code in one of the four slots at 32675 | |||||||
63623 | DEC C | Next combination letter | |||||||
63624 | JR NZ,63593 | Jump back until all four combination letters are done | |||||||
The safe combination code has been generated. Now for MR CREAK's birth year.
|
|||||||||
63626 | LD L,154 | HL=32666 (which holds the identifier for CREAK's birth year battle) | |||||||
63628 | CALL 24993 | Get a random number between 0 and 20 in A | |||||||
63631 | CP 21 | ||||||||
63633 | JR NC,63628 | ||||||||
63635 | ADD A,A | A=random odd number between 213 and 253 | |||||||
63636 | ADD A,213 | ||||||||
63638 | LD (HL),A | Store this battle identifier at 32666 | |||||||
63639 | SUB 129 | Set HL to the address of the battle year message corresponding to this battle identifier | |||||||
63641 | LD E,A | ||||||||
63642 | LD H,D | ||||||||
63643 | LD L,D | ||||||||
63644 | ADD HL,DE | ||||||||
63645 | ADD HL,DE | ||||||||
63646 | ADD HL,DE | ||||||||
63647 | ADD HL,HL | ||||||||
63648 | ADD HL,HL | ||||||||
63649 | LD A,H | ||||||||
63650 | ADD A,223 | ||||||||
63652 | LD H,A | ||||||||
63653 | LD DE,32667 | Store the digits of CREAK's birth year at 32667 | |||||||
63656 | LD C,4 | ||||||||
63658 | LDIR | ||||||||
Finally, adjust the game mode.
|
|||||||||
63660 | LD A,1 | Set the game mode indicator at 32746 to 1, indicating that the shields need to be flashed | |||||||
63662 | LD (32746),A | ||||||||
63665 | RET |
Prev: 63488 | Up: Map |