![]() |
Routines |
| Prev: CA5D | Up: Map | Next: CA9E |
|
Used by the routine at InitialiseGame.
Sets up the copy of the player at the start of the game. The player appears in a room that is picked at random from four rooms.
|
||||
|
Copy the sparkle and pick a start room.
|
||||
| InitialisePlayer | CA6D | LD HL,$CA5D | Point HL at InitialPlayerData. | |
| CA70 | LD DE,$CA1D | Point DE at PlayerCopy. | ||
| CA73 | LD BC,$0008 | Set BC to 0008. | ||
| CA76 | LDIR | Copy the bottom half. | ||
| CA78 | LD DE,$CA3D | Point DE at PlayerCopy_TopHalf. | ||
| CA7B | LD BC,$0008 | Set BC to 0008. | ||
| CA7E | LDIR | Copy the top half. | ||
| CA80 | LD A,$16 | Write 16 to CA2D. | ||
| CA82 | LD ($CA2D),A | |||
| CA85 | LD A,$26 | Write 26 to CA4D. | ||
| CA87 | LD ($CA4D),A | |||
| CA8A | LD A,($5B00) | Fetch RandomSeed1. | ||
| CA8D | AND %00000011 | Keep only bits 0 and 1. | ||
| CA8F | LD L,A | Copy it to L. | ||
| CA90 | LD H,$00 | Set H to 00. | ||
| CA92 | LD BC,$CA9E | Point BC at StartRooms. | ||
| CA95 | ADD HL,BC | Add BC to HL. | ||
| CA96 | LD A,(HL) | Fetch the start room. | ||
| CA97 | LD ($CA25),A | Set CA25. | ||
| CA9A | LD ($CA45),A | Set CA45. | ||
| CA9D | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: CA5D | Up: Map | Next: CA9E |