| Routines

63662: Prepare for demo mode or a new game

Used by the routine at 61630. Prepares everything for demo mode or a new game and then displays the introductory cutscene.
63662 | CALL 64582 | Generate the table of mirrored values of 0-255 at 32256
Now we initialise the game status buffer.
63665 | INC H | HL=32512
63666 | LD (HL),B | Zero out the first 222 bytes of the game status buffer
63667 | LD C,221
63669 | LD DE,32513
63672 | LDIR
63674 | LD E,224 | DE=32736
63676 | LD HL,65504 | Copy the data at 65504 into the last 32 bytes of the game status buffer
63679 | LD C,32
63681 | LDIR
Next we ensure that all the shop and house doors are closed.
63683 | LD B,32 | There are 32 Z values to check (one for each 8-tile wide segment of the play area)
63685 | LD HL,48384 | Point HL at the first Z value for y-coordinates 30-35 at 48384
63688 | LD A,(HL) | Pick up the Z value
63689 | CP 83 | Jump unless the Z value corresponds to the open door of a shop (80) or house (81 or 82)
63691 | JR NC,63705
63693 | CP 80
63695 | JR C,63705
63697 | SET 2,(HL) | Set bit 2 of the Z value, thus closing the door
63699 | JR NZ,63705 | Jump unless we are dealing with a shop door
63701 | INC H | Update the Z value in the block at 48640 if we are dealing with a shop door
63702 | LD (HL),83
63704 | DEC H | Point HL back at the block of Z values at 48384
63705 | INC L | Point HL at the next Z value
63706 | DJNZ 63688 | Jump back until we've checked every Z value
Next we initialise characters 215-221, the icon panel, the score box, the message line, the phone messages, the event table at 24544 and the object table at 32028.
63708 | CALL 63472 | Initialise the character buffers for character groups 215-221
63711 | CALL 28760 | Initialise the icon panel, score box and message line
63714 | CALL 31458 | Prepare the phone messages, events and objects
Let's not forget about the rope that may be above the roof of no. 19.
63717 | LD HL,2827 | Set the appropriate Z values in the block at 47360 to 11, thus removing the rope (if any) from above the roof of no. 19
63720 | LD (47386),HL
And finally we initialise the main characters (222-230) before displaying the introductory cutscene.
63723 | LD A,(32750) | A=current game mode (0 or 1)
63726 | JR 63733 |
This entry point is used by the routine at 24832.
63728 | LD HL,32750 | 32750 holds the current game mode (0-4)
63731 | INC (HL) | Move to the next game mode
63732 | LD A,(HL) | A=next game mode
63733 | CALL 63614 | Initialise the character buffers for characters 222-230
63736 | DEC H | Point HL at the message number in the set of initialisation parameters for the current game mode for Sam (see 58912)
63737 | DEC L
63738 | LD A,(HL) | Pick up the message number in A
63739 | PUSH AF |
63740 | DEC L | Pick up the new y-coordinate for the topmost row of the play area on screen in D
63741 | LD D,(HL)
63742 | DEC L | Pick up the new x-coordinate for the topmost row of the play area on screen in E
63743 | LD E,(HL)
63744 | DEC L | Pick up the LSB of the address of the screen refresh buffer byte that corresponds to the top row of the cutscene window
63745 | LD A,(HL)
63746 | JP 31451 | Display the cutscene