![]() |
Routines |
| Prev: 632D | Up: Map | Next: 637E |
|
Used by the routines at SpawnBonusItem and UpdateBonusItem.
The main game loop. The objects from State_Robbie_Active onwards are 08 bytes each, and the loop calls the update routine for the type of each object in turn (see JumpTable_Main). Every update routine returns to NewActor, which moves on to the next object.
A pass starts here with the flower object at State_Flower and carries on up to the last object (the explosion at State_Explosion), then the next pass is started here again. Whenever the frame counter has changed, FrameUpdate is called to update the first four objects (Robbie, the spray can and the two weapons) once. This means that these are updated on every frame no matter how long a pass through the other objects takes.
|
||||
|
Start a new pass through the objects.
|
||||
| MainLoop_NewPass | 634F | LD SP,$5D00 | SP=5D00. | |
| 6352 | EI | Enable interrupts. | ||
| 6353 | LD IX,$5E8C | IX=State_Flower (the flower object). | ||
| 6357 | XOR A | Write 00 to CurrentBug_ID to reset the enemy counter. | ||
| 6358 | LD ($5E16),A | |||
|
This entry point is used by the routines at FrameUpdate and NewActor.
Check whether the frame counter has changed.
|
||||
| MainLoop | 635B | LD A,($5C78) | Compare FRAMES and LastFrame. | |
| 635E | LD C,A | |||
| 635F | LD A,($5E1F) | |||
| 6362 | CP C | If they are not equal call FrameUpdate to update the fast objects. | ||
| 6363 | CALL NZ,FrameUpdate | |||
|
Every update routine returns to NewActor.
|
||||
| 6366 | LD HL,$7130 | HL=NewActor (the routine which moves onto the next object). | ||
| 6369 | PUSH HL | Stash the return address on the stack. | ||
|
Find the update routine for the type of the object.
|
||||
| 636A | LD HL,$637E | HL=JumpTable_Main. | ||
| 636D | LD A,(IX+$00) | A=*IX+00 (the object state). | ||
| 6370 | RLCA | Rotate A left once. | ||
| 6371 | AND %01111110 | Keep only bits 1-6 (the object type, held in bits 0-5 of the state, multiplied by two). | ||
| PerformJump | 6373 | LD C,A | BC=the offset into the jump table. | |
| 6374 | LD B,$00 | |||
| 6376 | ADD HL,BC | HL=the address of the entry in the jump table. | ||
| 6377 | LD A,(HL) | HL=the address of the update routine from the jump table. | ||
| 6378 | INC HL | |||
| 6379 | LD H,(HL) | |||
| 637A | LD L,A | |||
| 637B | JP IndirectJump | Jump to IndirectJump which does an indirect jump to the jump address. | ||
| Prev: 632D | Up: Map | Next: 637E |