Prev: F87E Up: Map Next: F905
F8AE: Prepare for demo mode or a new game
Used by the routine at F0BE. Prepares everything for demo mode or a new game and then displays the introductory cutscene.
F8AE CALL $FC46 Generate the table of mirrored values of 0x00-0xFF at 7E00
Now we initialise the game status buffer.
F8B1 INC H HL=7F00
F8B2 LD (HL),B Zero out the first 222 bytes of the game status buffer
F8B3 LD C,$DD
F8B5 LD DE,$7F01
F8B8 LDIR
F8BA LD E,$E0 DE=7FE0
F8BC LD HL,$FFE0 Copy the data at FFE0 into the last 32 bytes of the game status buffer
F8BF LD C,$20
F8C1 LDIR
Next we ensure that all the shop and house doors are closed.
F8C3 LD B,$20 There are 32 Z values to check (one for each 8-tile wide segment of the play area)
F8C5 LD HL,$BD00 Point HL at the first Z value for y-coordinates 30-35 at BD00
F8C8 LD A,(HL) Pick up the Z value
F8C9 CP $53 Jump unless the Z value corresponds to the open door of a shop (0x50) or house (0x51 or 0x52)
F8CB JR NC,$F8D9
F8CD CP $50
F8CF JR C,$F8D9
F8D1 SET 2,(HL) Set bit 2 of the Z value, thus closing the door
F8D3 JR NZ,$F8D9 Jump unless we are dealing with a shop door
F8D5 INC H Update the Z value in the block at BE00 if we are dealing with a shop door
F8D6 LD (HL),$53
F8D8 DEC H Point HL back at the block of Z values at BD00
F8D9 INC L Point HL at the next Z value
F8DA DJNZ $F8C8 Jump back until we've checked every Z value
Next we initialise characters 0xD7-0xDD, the icon panel, the score box, the message line, the phone messages, the event table at 5FE0 and the object table at 7D1C.
F8DC CALL $F7F0 Initialise the character buffers for character groups 0xD7-0xDD
F8DF CALL $7058 Initialise the icon panel, score box and message line
F8E2 CALL $7AE2 Prepare the phone messages, events and objects
Let's not forget about the rope that may be above the roof of no. 19.
F8E5 LD HL,$0B0B Set the appropriate Z values in the block at B900 to 11, thus removing the rope (if any) from above the roof of no. 19
F8E8 LD ($B91A),HL
And finally we initialise the main characters (0xDE-0xE6) before displaying the introductory cutscene.
F8EB LD A,($7FEE) A=current game mode (0 or 1)
F8EE JR $F8F5
This entry point is used by the routine at 6100.
F8F0 LD HL,$7FEE 7FEE holds the current game mode (0-4)
F8F3 INC (HL) Move to the next game mode
F8F4 LD A,(HL) A=next game mode
F8F5 CALL $F87E Initialise the character buffers for characters 0xDE-0xE6
F8F8 DEC H Point HL at the message number in the set of initialisation parameters for the current game mode for Sam (see E620)
F8F9 DEC L
F8FA LD A,(HL) Pick up the message number in A
F8FB PUSH AF
F8FC DEC L Pick up the new y-coordinate for the topmost row of the play area on screen in D
F8FD LD D,(HL)
F8FE DEC L Pick up the new x-coordinate for the topmost row of the play area on screen in E
F8FF LD E,(HL)
F900 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
F901 LD A,(HL)
F902 JP $7ADB Display the cutscene
Prev: F87E Up: Map Next: F905