![]() |
Routines |
| Prev: 9489 | Up: Map | Next: 94DD |
|
Used by the routine at StartGame.
Chooses which of the eight sets of rooms in KeyPieceRooms will hold the three entities for the A.C.G. key at Initialisation_Key_ACG, using FRAMES and CounterLow, and writes the three rooms to them.
|
||||
| PlaceKeyPieces | 94B6 | LD A,($5C78) | Fetch FRAMES and keep FRAMES in C. | |
| 94B9 | LD C,A | |||
| 94BA | LD A,($5E12) | Fetch the counter from CounterLow. | ||
| 94BD | ADD A,C | Add FRAMES to the counter. | ||
| 94BE | AND %00000111 | Keep only bits 0-2. | ||
| 94C0 | LD C,A | Keep the number of the set in C. | ||
| 94C1 | ADD A,A | Multiply the number of the set by 03. | ||
| 94C2 | ADD A,C | |||
| 94C3 | LD L,A | Keep the offset of the set in L. | ||
| 94C4 | LD H,$00 | Clear the high byte of the offset. | ||
| 94C6 | LD BC,$94DD | Point BC at the key piece rooms at KeyPieceRooms. | ||
| 94C9 | ADD HL,BC | Add the offset to the table, to find the chosen set. | ||
| 94CA | EX DE,HL | Keep the set of rooms in DE. | ||
| 94CB | LD HL,$6026 | Point HL at the room of the first entity at Initialisation_Key_ACG_Room. | ||
| 94CE | LD BC,$0008 | BC=0008 (the distance between the entities). | ||
| 94D1 | LD A,$03 | A=03 (the number of key pieces to place). | ||
| PlaceKeyPieces_Loop | 94D3 | EX AF,AF' | Save the key piece counter in AF'. | |
| 94D4 | LD A,(DE) | Fetch the next room. | ||
| 94D5 | LD (HL),A | Write it to the entity. | ||
| 94D6 | ADD HL,BC | Move HL on to the next entity. | ||
| 94D7 | INC DE | Move DE on to the next room. | ||
| 94D8 | EX AF,AF' | Restore the key piece counter from AF'. | ||
| 94D9 | DEC A | Decrease the key piece counter by one and loop back to PlaceKeyPieces_Loop until all three have been placed. | ||
| 94DA | JR NZ,PlaceKeyPieces_Loop | |||
| 94DC | RET | Return. | ||
| Prev: 9489 | Up: Map | Next: 94DD |