Prev: 98C8 Up: Map Next: 9904
98D2: Set Key Positions
Used by the routine at StartGame.
Called when a game starts. Chooses the rooms for three of the keys from the three tables of rooms that follow, using FRAMES and the counter at CounterLow. The green key (Initialisation_Key_Green) uses FRAMES, the red key (Initialisation_Key_Red) uses FRAMES plus the low byte of the counter, and the cyan key (Initialisation_Key_Cyan) uses the high bytes of both. The room of the red key is also given to the mummy (see Initialisation_Mummy). The yellow key does not move.
SetKeyPositions 98D2 LD A,($5C78) Fetch FRAMES.
98D5 LD HL,$990C Point HL at the green key rooms at GreenKeyRooms.
98D8 CALL GetKeyRoom Call GetKeyRoom to get a room.
98DB LD ($603E),A Update the room of the green key.
98DE LD A,($5C78) Fetch FRAMES and keep FRAMES in C.
98E1 LD C,A
98E2 LD A,($5E12) Fetch the counter from CounterLow.
98E5 ADD A,C Add FRAMES to the counter.
98E6 LD HL,$9914 Point HL at the red key rooms at RedKeyRooms.
98E9 CALL GetKeyRoom Call GetKeyRoom to get a room.
98EC LD ($6046),A Update the room of the red key.
98EF LD ($640E),A Update the room of the mummy (offset 01 of Initialisation_Mummy).
98F2 LD A,($5C79) Fetch the second byte of FRAMES and keep it in C.
98F5 LD C,A
98F6 LD A,($5E13) Fetch the high byte of the counter from CounterHigh.
98F9 ADD A,C Add it to the high byte of the counter.
98FA LD HL,$991C Point HL at the cyan key rooms at CyanKeyRooms.
98FD CALL GetKeyRoom Call GetKeyRoom to get a room.
9900 LD ($604E),A Update the room of the cyan key.
9903 RET Return.
Prev: 98C8 Up: Map Next: 9904