![]() |
Routines |
| Prev: 27026 | Up: Map | Next: 27127 |
|
Used by the routine at Run_Game_Frame.
Processes one frame of the main game loop. Clears all sprite frame IDs, then calls the various game handlers for Percy, hazards and level-specific logic. Resets the lives backup flag and restores the border colour before returning.
|
||||
| Run_Main_Loop_Body | 27047 | DI | Disable interrupts. | |
| 27048 | PUSH IX | Stash IX and IY on the stack. | ||
| 27050 | PUSH IY | |||
|
Clear the sprite frame IDs for: Sprite01_3Wide_Frame_ID, Sprite02_3Wide_Frame_ID, Sprite03_3Wide_Frame_ID, Sprite04_3Wide_Frame_ID, Sprite05_3Wide_Frame_ID, Sprite06_3Wide_Frame_ID and Sprite07_3Wide_Frame_ID (the eight 3-wide sprites).
|
||||
| 27052 | LD B,7 | Set the sprite counter to 7 in B. | ||
| 27054 | LD HL,56007 | Point HL at Sprite01_3Wide_Frame_ID (first 3-wide sprite frame ID). | ||
| 27057 | LD C,0 | Set the clear value in C to 0. | ||
| Clear_3Wide_Frames_Loop | 27059 | LD (HL),C | Write 0 to the sprite frame ID at *HL. | |
| 27060 | INC HL | Advance HL by four bytes to the next sprite entry. | ||
| 27061 | INC HL | |||
| 27062 | INC HL | |||
| 27063 | INC HL | |||
| 27064 | DJNZ Clear_3Wide_Frames_Loop | Decrease the counter and loop back to Clear_3Wide_Frames_Loop until all seven 3-wide sprite frame IDs are cleared. | ||
|
Clear the sprite frame IDs for: Sprite01_2WideFrame_ID, Sprite02_2WideFrame_ID, Sprite03_2WideFrame_ID, Sprite04_2WideFrame_ID, Sprite05_2WideFrame_ID and Sprite06_2WideFrame_ID (the six 2-wide sprites).
|
||||
| 27066 | LD HL,56043 | Point HL at Sprite01_2WideFrame_ID (first 2-wide sprite frame ID). | ||
| 27069 | LD B,6 | Set the sprite counter to 6 in B. | ||
| Clear_2Wide_Frames_Loop | 27071 | LD (HL),C | Write 0 to the sprite frame ID at *HL. | |
| 27072 | INC HL | Advance HL by four bytes to the next sprite entry. | ||
| 27073 | INC HL | |||
| 27074 | INC HL | |||
| 27075 | INC HL | |||
| 27076 | DJNZ Clear_2Wide_Frames_Loop | Decrease the counter and loop back to Clear_2Wide_Frames_Loop until all six 2-wide sprite frame IDs are cleared. | ||
|
Call the game handlers.
|
||||
| 27078 | LD A,(24510) | Call ResetRedBird if *Lives_Backup is non-zero. | ||
| 27081 | OR A | |||
| 27082 | CALL NZ,ResetRedBird | |||
| 27085 | CALL Handler_RedBird | Call Handler_RedBird. | ||
| 27088 | CALL Handler_Cars | Call Handler_Cars. | ||
| 27091 | CALL RoomHandlerDispatch | Call RoomHandlerDispatch. | ||
| 27094 | LD A,(24517) | Call Handler_Frogs if *CurrentRoom is equal to 4. | ||
| 27097 | CP 4 | |||
| 27099 | CALL Z,Handler_Frogs | |||
| 27102 | LD A,(24493) | Call UpdateEnergyBar_Refill if *LandedOnPlatformFlag (worm Y adjustment flag) is set. | ||
| 27105 | OR A | |||
| 27106 | CALL NZ,UpdateEnergyBar_Refill | |||
|
Tidy up at end of frame.
|
||||
| 27109 | LD A,(24499) | Copy *LivesDisplayCharacter to *Lives_Display_Previous. | ||
| 27112 | LD (27843),A | |||
| 27115 | XOR A | Write 0 to *Lives_Backup. | ||
| 27116 | LD (24510),A | |||
| 27119 | INC A | Set border to BLUE. | ||
| 27120 | OUT (254),A | |||
| 27122 | POP IY | Restore IY and IX from the stack. | ||
| 27124 | POP IX | |||
| 27126 | RET | Return. | ||
| Prev: 27026 | Up: Map | Next: 27127 |