![]() |
Routines |
| Prev: E6A5 | Up: Map | Next: E6EE |
|
Used by the routine at Set_Up_Stalactites.
Makes the object record of one stalactite from a template (see Stalactite_Templates).
The byte that describes the stalactite (one of the two bytes of the entry of the room visit table, see Set_Up_Stalactites) is in B. Bits 1 and 2 of it choose the template. Bits 4 and 5 give the x position, which is that number of sixteen pixels more than C. Bits 6 and 7 give the y position, which is that number of sixteen pixels more than 77. Bit 3 is set if the stalactite has a gem in it (see Handle_Stalactite). Bit 0 tells the first stalactite of a room from the second.
The room x and the room y are those of the object at IX. The attribute is 46 (yellow). The byte is also stored in byte 06 of the record.
|
||||||||||||||||||
| Build_Stalactite | E6BE | PUSH BC | Stash the byte that describes the stalactite and the smallest x position. | |||||||||||||||
| E6BF | LD C,A | Copy the template number to C. | ||||||||||||||||
| E6C0 | LD B,$00 | Clear the high byte of the offset. | ||||||||||||||||
| E6C2 | ADD HL,BC | Point HL at the pointer to the template. | ||||||||||||||||
| E6C3 | LD A,(HL) | Fetch the low byte of the pointer. | ||||||||||||||||
| E6C4 | INC HL | Move on to the high byte. | ||||||||||||||||
| E6C5 | LD H,(HL) | Fetch the high byte of the pointer. | ||||||||||||||||
| E6C6 | LD L,A | Make HL point at the template. | ||||||||||||||||
| E6C7 | LD BC,$0010 | Set the number of bytes to copy to 10. | ||||||||||||||||
| E6CA | PUSH DE | Stash the address of the stalactite record. | ||||||||||||||||
| E6CB | LDIR | Copy the template to the stalactite record. | ||||||||||||||||
| E6CD | POP HL | Restore the address of the stalactite record to HL. | ||||||||||||||||
| E6CE | POP BC | Restore the byte that describes the stalactite to B and the smallest x position to C. | ||||||||||||||||
| E6CF | LD A,B | Copy the byte that describes the stalactite to A. | ||||||||||||||||
| E6D0 | INC HL | Move on to the x position. | ||||||||||||||||
| E6D1 | AND %00110000 | Keep only bits 4 and 5. | ||||||||||||||||
| E6D3 | ADD A,C | Add the smallest x position. | ||||||||||||||||
| E6D4 | LD (HL),A | Set the x position. | ||||||||||||||||
| E6D5 | INC HL | Move on to the room x. | ||||||||||||||||
| E6D6 | LD A,(IX+$02) | Fetch the room x. | ||||||||||||||||
| E6D9 | LD (HL),A | Set the room x. | ||||||||||||||||
| E6DA | INC HL | Move on to the y position. | ||||||||||||||||
| E6DB | LD A,B | Fetch the byte that describes the stalactite. | ||||||||||||||||
| E6DC | RRA | Move bits 6 and 7 into bits 4 and 5. | ||||||||||||||||
| E6DD | RRA | |||||||||||||||||
| E6DE | AND %00110000 | Keep only bits 4 and 5. | ||||||||||||||||
| E6E0 | ADD A,$77 | Add 77. | ||||||||||||||||
| E6E2 | LD (HL),A | Set the y position. | ||||||||||||||||
| E6E3 | INC HL | Move on to the room y. | ||||||||||||||||
| E6E4 | LD A,(IX+$04) | Fetch the room y. | ||||||||||||||||
| E6E7 | LD (HL),A | Set the room y. | ||||||||||||||||
| E6E8 | INC HL | Move on to the attribute. | ||||||||||||||||
| E6E9 | LD (HL),$46 | Set the attribute to 46 (yellow). | ||||||||||||||||
| E6EB | INC HL | Move on to byte 06. | ||||||||||||||||
| E6EC | LD (HL),B | Store the byte that describes the stalactite. | ||||||||||||||||
| E6ED | RET | Return. | ||||||||||||||||
| Prev: E6A5 | Up: Map | Next: E6EE |