Prev: 98C8 Up: Map Next: 9904
98D2: Put three of the keys, and the mummy, in rooms chosen for this game
Used by the routine at START_GAME.
Writes into INITIAL_STATE before START_GAME copies it: the rooms of GREEN_KEY, RED_KEY and CYAN_KEY, each one of eight from RANDOM_ROOMS_ONE, RANDOM_ROOMS_TWO and RANDOM_ROOMS_THREE, chosen from the frame counter. The running values at $5E12 and $5E13 are added in too, but they have just been cleared, so green and red use the same index. The mummy goes into the same room as the red key. The yellow key's room is not touched.
PLACE_KEYS 98D2 LD A,($5C78)
98D5 LD HL,RANDOM_ROOMS_ONE
98D8 CALL TABLE_LOOKUP_3BIT
98DB LD ($603E),A GREEN_KEY+1: the green key's room
98DE LD A,($5C78)
98E1 LD C,A
98E2 LD A,($5E12)
98E5 ADD A,C
98E6 LD HL,RANDOM_ROOMS_TWO
98E9 CALL TABLE_LOOKUP_3BIT
98EC LD ($6046),A RED_KEY+1: the red key's room...
98EF LD ($640E),A ...and MUMMY+1, the mummy's
98F2 LD A,($5C79)
98F5 LD C,A
98F6 LD A,($5E13)
98F9 ADD A,C
98FA LD HL,RANDOM_ROOMS_THREE
98FD CALL TABLE_LOOKUP_3BIT
9900 LD ($604E),A CYAN_KEY+1: the cyan key's room
9903 RET
Prev: 98C8 Up: Map Next: 9904