![]() |
Routines |
| Prev: EBC0 | Up: Map | Next: EC1C |
|
Used by the routine at Place_Special_Object.
Puts a guardian in the room, unless it has been destroyed already. It is the continuation of Place_Special_Object when the room of Sabreman is that of an entry of the table of guardians at Guardian_Table.
The rock formation is put in the room first (see Place_Rock_Formation). The guardian is made from a copy of the template at Extra_Life_Template. Its type is 80 86 84 or 82 which depends on the number of the entry, and it is placed at the x position 80 and the y position 9F with the attribute 03 (magenta). Byte 06 of the record holds the number of the entry, which Handle_Guardian uses to set the collected flag of the entry when the guardian is destroyed.
The record that is used is the first of the two special object records, First_Special_Object_Record.
|
||||||||||||||
| Place_Guardian | EBDE | EXX | Switch to the alternate registers, to keep the registers that the caller uses. | |||||||||||
| EBDF | CALL Place_Rock_Formation | Put the rock formation in the room. | ||||||||||||
| EBE2 | EXX | Switch back to the main registers. | ||||||||||||
| EBE3 | INC HL | Move on to the collected flag of the entry. | ||||||||||||
| EBE4 | LD A,(HL) | Fetch the collected flag. | ||||||||||||
| EBE5 | AND A | Return if the guardian has been destroyed already. | ||||||||||||
| EBE6 | RET NZ | |||||||||||||
| EBE7 | LD A,B | Fetch the number of the entry, counted from the end of the table. | ||||||||||||
| EBE8 | PUSH DE | Stash the room of Sabreman. | ||||||||||||
| EBE9 | LD HL,$EDB4 | Point HL at Extra_Life_Template. | ||||||||||||
| EBEC | LD DE,$8FBA | Point DE at First_Special_Object_Record. | ||||||||||||
| EBEF | LD BC,$0010 | Set the size of a record in BC. | ||||||||||||
| EBF2 | LDIR | Copy the template to the record. | ||||||||||||
| EBF4 | LD ($8FC0),A | Store the number of the entry in byte 06 of the record. | ||||||||||||
| EBF7 | POP BC | Restore the room of Sabreman into BC. | ||||||||||||
| EBF8 | DI | Disable interrupts. | ||||||||||||
| EBF9 | PUSH IY | Save IY. | ||||||||||||
| EBFB | LD IY,$8FBA | Point IY at First_Special_Object_Record. | ||||||||||||
| EBFF | RLA | Shift the number of the entry left, to double it. | ||||||||||||
| EC00 | AND %00000110 | Keep the result in bits 1 and 2. | ||||||||||||
| EC02 | ADD A,$80 | Add 80 to make the type of the guardian. | ||||||||||||
| EC04 | LD (IY+$00),A | Set the type of the guardian. | ||||||||||||
| EC07 | LD (IY+$02),C | Set the room x of the guardian. | ||||||||||||
| EC0A | LD (IY+$04),B | Set the room y of the guardian. | ||||||||||||
| EC0D | LD (IY+$01),$80 | Set the x position of the guardian to 80. | ||||||||||||
| EC11 | LD (IY+$03),$9F | Set the y position of the guardian to 9F. | ||||||||||||
| EC15 | LD (IY+$05),$03 | Set the attribute of the guardian to 03 (magenta). | ||||||||||||
| EC19 | POP IY | Restore IY. | ||||||||||||
| EC1B | RET | Return. | ||||||||||||
| Prev: EBC0 | Up: Map | Next: EC1C |