![]() |
Routines |
| Prev: 91B0 | Up: Map | Next: 921A |
|
Used by the routine at Select_Game_Options.
Starts a new game and then runs the main loop forever.
The loop at Main_Loop goes through the object records one at a time. Byte 00 of a record is the type of the object, which is used as an index into the Object_Handler_Table handler table. The handler is run with IX pointing at the record and with Finish_Object_Pass stacked as its return address, so every handler ends by returning to Finish_Object_Pass which moves on to the next record.
|
||||
|
Start a new game: empty the room table, clear the workspace and the objects, and clear the screen.
|
||||
| Run_Game | 91C0 | CALL Reset_Room_Table | Empty the room visit table. | |
| 91C3 | CALL Clear_Workspace | Clear the sprite workspace, the score and the other variables. | ||
| 91C6 | CALL Clear_Object_Records | Clear all of the object records except the first two. | ||
| 91C9 | CALL Clear_Attributes | Set every attribute to white ink on black paper. | ||
| 91CC | CALL Clear_Screen | Clear the screen. | ||
| 91CF | CALL Clear_Collected_Flags | Set up the fifth small object record. | ||
|
Set up Sabreman and draw the status panel and the room.
|
||||
| 91D2 | CALL Reset_Sabreman | Copy the template of Sabreman into his object record. | ||
| 91D5 | LD IX,$8F1A | Point at the object record of Sabreman (Sabreman_Record). | ||
| 91D9 | CALL Draw_Lives | Draw the lives icon and the number of lives. | ||
| 91DC | CALL Print_Status_Panel | Print the status panel. | ||
| 91DF | CALL Print_Score_Label | Print the word SCORE and the score. | ||
| 91E2 | CALL Draw_Room | Draw the room. This does not return: it resets the stack and jumps to Main_Loop. | ||
|
This entry point is used by the routine at Finish_Object_Pass.
This is the main loop. The normal pass starts with Sabreman's record, unless his type is from 09 to 1B. Those types are handled with the priority records (see Finish_Object_Pass_Priority_Records), so then the pass starts with the record after his. The first two records are only ever handled as priority records.
|
||||
| Main_Loop | 91E5 | EI | Enable interrupts. | |
| 91E6 | LD IX,$8F1A | Point at the object record of Sabreman (Sabreman_Record). | ||
| 91EA | LD A,($8F1A) | Fetch the type of Sabreman. | ||
| 91ED | CP $1C | Jump to Run_Game_Spawn_Creatures if the type is greater than or equal to 1C. | ||
| 91EF | JR NC,Run_Game_Spawn_Creatures | |||
| 91F1 | CP $09 | Jump to Run_Game_Spawn_Creatures if the type is less than 09. | ||
| 91F3 | JR C,Run_Game_Spawn_Creatures | |||
| 91F5 | LD IX,$8F2A | Point at the record after Sabreman's (Rope_Record). | ||
|
Give the creature spawners a chance to run, then run the handler of the object that IX points at.
|
||||
| Run_Game_Spawn_Creatures | 91F9 | CALL Spawn_Falling_Stalactite | Maybe spawn a stalactite. | |
| 91FC | CALL Spawn_Flying_Creature | Maybe spawn a flying creature. | ||
| 91FF | LD A,($AAAC) | Fetch the room flags from Room_Flags. | ||
| 9202 | AND %00010000 | Keep only bit 4. | ||
| 9204 | CALL Z,Spawn_Bubble | Maybe spawn a bubble if bit 4 is not set. | ||
|
This entry point is used by the routines at Finish_Object_Pass and Draw_Room.
Run the handler of the object that IX points at.
|
||||
| Run_Object_Handler | 9207 | LD HL,$9459 | Point at the return address of the handler (Finish_Object_Pass). | |
|
This entry point is used by the routine at Finish_Object_Pass.
|
||||
| Run_Object_Handler_Stash_Return | 920A | PUSH HL | Stash it on the stack. | |
| 920B | LD BC,$921A | Point at the handler table (Object_Handler_Table). | ||
| 920E | LD L,(IX+$00) | Fetch the type of the object. | ||
|
This entry point is used by the routine at Finish_Object_Pass.
|
||||
| Run_Object_Handler_Look_Up | 9211 | LD H,$00 | Clear H so that HL holds the type. | |
| 9213 | ADD HL,HL | Double the type to get the offset of its handler in the table. | ||
| 9214 | ADD HL,BC | Add the address of the table. | ||
| 9215 | LD A,(HL) | Fetch the low byte of the handler address. | ||
| 9216 | INC HL | Move on to the high byte. | ||
| 9217 | LD H,(HL) | Fetch the high byte of the handler address. | ||
| 9218 | LD L,A | Copy the low byte of the handler address to L. | ||
| 9219 | JP (HL) | Jump to the handler. | ||
| Prev: 91B0 | Up: Map | Next: 921A |