![]() |
Routines |
| Prev: 59045 | Up: Map | Next: 59118 |
|
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 119. 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 70 (yellow). The byte is also stored in byte 6 of the record.
|
||||||||||||||||||
| Build_Stalactite | 59070 | PUSH BC | Stash the byte that describes the stalactite and the smallest x position. | |||||||||||||||
| 59071 | LD C,A | Copy the template number to C. | ||||||||||||||||
| 59072 | LD B,0 | Clear the high byte of the offset. | ||||||||||||||||
| 59074 | ADD HL,BC | Point HL at the pointer to the template. | ||||||||||||||||
| 59075 | LD A,(HL) | Fetch the low byte of the pointer. | ||||||||||||||||
| 59076 | INC HL | Move on to the high byte. | ||||||||||||||||
| 59077 | LD H,(HL) | Fetch the high byte of the pointer. | ||||||||||||||||
| 59078 | LD L,A | Make HL point at the template. | ||||||||||||||||
| 59079 | LD BC,16 | Set the number of bytes to copy to 16. | ||||||||||||||||
| 59082 | PUSH DE | Stash the address of the stalactite record. | ||||||||||||||||
| 59083 | LDIR | Copy the template to the stalactite record. | ||||||||||||||||
| 59085 | POP HL | Restore the address of the stalactite record to HL. | ||||||||||||||||
| 59086 | POP BC | Restore the byte that describes the stalactite to B and the smallest x position to C. | ||||||||||||||||
| 59087 | LD A,B | Copy the byte that describes the stalactite to A. | ||||||||||||||||
| 59088 | INC HL | Move on to the x position. | ||||||||||||||||
| 59089 | AND %00110000 | Keep only bits 4 and 5. | ||||||||||||||||
| 59091 | ADD A,C | Add the smallest x position. | ||||||||||||||||
| 59092 | LD (HL),A | Set the x position. | ||||||||||||||||
| 59093 | INC HL | Move on to the room x. | ||||||||||||||||
| 59094 | LD A,(IX+2) | Fetch the room x. | ||||||||||||||||
| 59097 | LD (HL),A | Set the room x. | ||||||||||||||||
| 59098 | INC HL | Move on to the y position. | ||||||||||||||||
| 59099 | LD A,B | Fetch the byte that describes the stalactite. | ||||||||||||||||
| 59100 | RRA | Move bits 6 and 7 into bits 4 and 5. | ||||||||||||||||
| 59101 | RRA | |||||||||||||||||
| 59102 | AND %00110000 | Keep only bits 4 and 5. | ||||||||||||||||
| 59104 | ADD A,119 | Add 119. | ||||||||||||||||
| 59106 | LD (HL),A | Set the y position. | ||||||||||||||||
| 59107 | INC HL | Move on to the room y. | ||||||||||||||||
| 59108 | LD A,(IX+4) | Fetch the room y. | ||||||||||||||||
| 59111 | LD (HL),A | Set the room y. | ||||||||||||||||
| 59112 | INC HL | Move on to the attribute. | ||||||||||||||||
| 59113 | LD (HL),70 | Set the attribute to 70 (yellow). | ||||||||||||||||
| 59115 | INC HL | Move on to byte 6. | ||||||||||||||||
| 59116 | LD (HL),B | Store the byte that describes the stalactite. | ||||||||||||||||
| 59117 | RET | Return. | ||||||||||||||||
| Prev: 59045 | Up: Map | Next: 59118 |