Prev: 5FF1 Up: Map Next: 6052
600F: Prepare New Game
Used by the routine at GameLoop.
Clears the screen, forgets the previous command and copies the initial object locations and state into place.
The text window sits on rows 16 and 17 until a location description moves it.
PrepareGame 600F LD A,$17 Write 17 to BottomRow.
6011 LD ($5B97),A
6014 LD A,$16 Write 16 to PrintRow.
6016 LD ($5B89),A
6019 CALL HomeRow Call HomeRow.
601C XOR A Write 00 to PrintColumn.
601D LD ($5B8A),A
6020 CALL ClearScreen Call ClearScreen.
Forget the verb, the noun and the three counters.
6023 LD HL,$5B7F Point at the five command bytes at Verb.
6026 LD B,$05 Five bytes: the verb, the noun and the three counters.
Clear the command bytes.
PrepareGame_ClearCommand 6028 LD (HL),$00 Write 00.
602A INC HL Advance.
602B DJNZ PrepareGame_ClearCommand Jump to PrepareGame_ClearCommand until the five bytes are done.
602D XOR A Write 00 to Continuation.
602E LD ($5B85),A
A new game starts in room 0 with empty flags, then the authored state is copied in.
6031 LD HL,$5D87 Point at the state and flag area at CurrentRoom.
6034 LD B,$41 41 bytes, through the last flag.
Clear the state and flags.
PrepareGame_ClearState 6036 LD (HL),$00 Write 00.
6038 INC HL Advance.
6039 DJNZ PrepareGame_ClearState Jump to PrepareGame_ClearState until the state is cleared.
603B LD HL,$B6A8 Point HL at InitialObjects.
603E LD DE,$5DCA Point DE at ObjectLocations.
6041 LD BC,$0100 0100 bytes.
6044 LDIR Copy them.
6046 LD HL,$6052 Point HL at InitialState.
6049 LD DE,$5D88 Point DE at Darkness.
604C LD BC,$0006 0006 bytes.
604F LDIR Copy them.
6051 RET Return.
Prev: 5FF1 Up: Map Next: 6052