![]() |
Routines |
| Prev: 46392 | Up: Map | Next: 46438 |
|
Used by the routine at InitialiseGame.
Changes the order in which the special objects have to be taken to the cauldron. The list of 14 objects at RequiredObjects is rotated by four to seven places, depending on the first random seed.
|
||||
|
Work out how many times to rotate the list.
|
||||
| ShuffleRequiredObjects | 46404 | LD A,(23456) | Fetch RandomSeed1. | |
| 46407 | AND %00000011 | Keep the lowest two bits. | ||
| 46409 | OR %00000100 | Make it four to seven. | ||
| 46411 | LD C,A | Use it as the number of times to rotate the list. | ||
|
Rotate the list one place.
|
||||
| ShuffleRequiredObjects_Loop | 46412 | LD B,13 | Set the number of objects to move. | |
| 46414 | LD IY,49789 | Point IY at RequiredObjects. | ||
| 46418 | LD E,(IY+0) | Keep the first object in E. | ||
| ShuffleRequiredObjects_Move | 46421 | LD A,(IY+1) | Fetch the next object in the list. | |
| 46424 | LD (IY+0),A | Store it one place earlier. | ||
| 46427 | INC IY | Move on to the next object. | ||
| 46429 | DJNZ ShuffleRequiredObjects_Move | Decrease the object counter and loop back to ShuffleRequiredObjects_Move until all of them have moved. | ||
| 46431 | LD (IY+0),E | Put the first object at the end of the list. | ||
| 46434 | DEC C | Decrease the rotation counter and loop back to ShuffleRequiredObjects_Loop until the list has been rotated enough. | ||
| 46435 | JR NZ,ShuffleRequiredObjects_Loop | |||
| 46437 | RET | Return. | ||
| Prev: 46392 | Up: Map | Next: 46438 |