![]() |
Routines |
| Prev: 50285 | Up: Map | Next: 50346 |
|
Used by the routine at InitialiseGame.
Chooses the objects in SpecialObjectsTable at the start of a game. Each is given a graphic number from 96 to 103 taken from a number made from the random number seed and the refresh register. The starting position of each entry is copied to the current position.
|
||||
|
Stir the seed and fill the table.
|
||||
| InitialiseSpecialObjects | 50302 | LD HL,28658 | Point HL at the first special object, SpecialObjectsTable. | |
| 50305 | LD A,(23456) | Fetch the first random seed from RandomSeed1. | ||
| 50308 | LD E,A | Keep it in E. | ||
| 50309 | LD A,R | Fetch the refresh register. | ||
| 50311 | ADD A,E | Add the seed to it. | ||
| 50312 | LD E,A | Keep the result in E. | ||
| InitialiseSpecialObjects_Next | 50313 | LD A,E | Copy the number to A. | |
| 50314 | AND %00000111 | Keep bits 0 to 2. | ||
| 50316 | OR %01100000 | Make it a graphic number from 96 to 103. | ||
| 50318 | LD (HL),A | Set the graphic number of the object. | ||
| 50319 | INC HL | Move on to the starting position. | ||
| 50320 | INC E | Change the number, for the next object. | ||
| 50321 | PUSH DE | Stash the number on the stack. | ||
| 50322 | EX DE,HL | Swap the entry pointer into DE. | ||
| 50323 | LD HL,4 | Set HL to 0004. | ||
| 50326 | ADD HL,DE | Add it to the starting position. | ||
| 50327 | EX DE,HL | Swap the pointers back. | ||
| 50328 | LD BC,4 | Set BC to 0004. | ||
| 50331 | LDIR | Copy the starting position and room. | ||
| 50333 | EX DE,HL | Point HL at the next object. | ||
| 50334 | PUSH HL | Stash the next entry on the stack. | ||
| 50335 | LD BC,28946 | Point BC at SpriteTable. | ||
| 50338 | AND A | Subtract SpriteTable from HL. | ||
| 50339 | SBC HL,BC | |||
| 50341 | POP HL | Restore the address of the next object from the stack. | ||
| 50342 | POP DE | Restore the number from the stack. | ||
| 50343 | JR C,InitialiseSpecialObjects_Next | Jump to InitialiseSpecialObjects_Next until every object has been done. | ||
| 50345 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 50285 | Up: Map | Next: 50346 |