![]() |
Routines |
| Prev: 60060 | Up: Map | Next: 60153 |
|
Used by the routine at Draw_Room.
Copies the four decorations of the room that Sabreman is in from the table at Room_Decoration_Table into the four object records that start at Object_Record_8. It is used for the special rooms (a room y below 16), where the decorations are the furniture and the pictures.
The table has eight bytes for each room, and 128 bytes for each row of 16 rooms. A pair of bytes describes each decoration. The first byte is the sprite id, which becomes the type of the object. The high nibble of the second byte is the x position in units of 16 pixels and the low nibble is the y position in units of 8 pixels.
The records are set up with the attribute 69 (cyan) and bit 0 of the redraw flags set, so that the decorations are drawn when they are first handled (by Handle_Plain_Decoration or Handle_Coloured_Decoration).
|
||||||||
| Load_Room_Decorations | 60066 | LD H,(IX+4) | Fetch the room y of Sabreman into H. | |||||
| 60069 | LD L,(IX+2) | Fetch the room x of Sabreman into L. | ||||||
| 60072 | SLA L | Multiply the room x by eight, as there are eight bytes in an entry. | ||||||
| 60074 | SLA L | |||||||
| 60076 | SLA L | |||||||
| 60078 | XOR A | Clear A and halve the room y, with the lowest bit going into bit 7 of A. This makes the offset of the row of rooms (128 bytes for each room y). | ||||||
| 60079 | SRL H | |||||||
| 60081 | RRA | |||||||
| 60082 | ADD A,L | Add the offset for the room x. | ||||||
| 60083 | LD L,A | HL is now the offset of the entry in the table. | ||||||
| 60084 | LD DE,26624 | Point DE at Room_Decoration_Table. | ||||||
| 60087 | ADD HL,DE | Make HL point at the entry of the room. | ||||||
| 60088 | DI | Disable interrupts. | ||||||
| 60089 | PUSH IY | Save IY. | ||||||
| 60091 | LD IY,36730 | Point IY at Object_Record_8. | ||||||
| 60095 | LD DE,16 | Set the size of an object record in DE. | ||||||
| 60098 | LD B,4 | Set the number of decorations to load to 4. | ||||||
| Load_Room_Decorations_Loop | 60100 | LD A,(HL) | Fetch the sprite id of the decoration. | |||||
| 60101 | LD (IY+0),A | Store it as the type of the object. | ||||||
| 60104 | INC HL | Move on to the position byte. | ||||||
| 60105 | LD A,(HL) | Fetch the position byte. | ||||||
| 60106 | AND %11110000 | Keep the high nibble. | ||||||
| 60108 | ADD A,8 | Add 8. | ||||||
| 60110 | LD (IY+1),A | Set the x position of the decoration. | ||||||
| 60113 | LD A,(HL) | Fetch the position byte again. | ||||||
| 60114 | RLA | Shift it left three times, which moves the low nibble to bits 3 to 6. | ||||||
| 60115 | RLA | |||||||
| 60116 | RLA | |||||||
| 60117 | AND %01111000 | Keep only those bits. | ||||||
| 60119 | ADD A,63 | Add 63. | ||||||
| 60121 | LD (IY+3),A | Set the y position of the decoration. | ||||||
| 60124 | LD A,(IX+2) | Fetch the room x. | ||||||
| 60127 | LD (IY+2),A | Set the room x of the decoration. | ||||||
| 60130 | LD A,(IX+4) | Fetch the room y. | ||||||
| 60133 | LD (IY+4),A | Set the room y of the decoration. | ||||||
| 60136 | LD (IY+15),1 | Set bit 0 of the redraw flags, as the decoration has not been drawn yet. | ||||||
| 60140 | LD (IY+5),69 | Set the attribute of the decoration to 69 (cyan). | ||||||
| 60144 | INC HL | Move on to the next pair of bytes in the table. | ||||||
| 60145 | ADD IY,DE | Move on to the next object record. | ||||||
| 60147 | DJNZ Load_Room_Decorations_Loop | Loop back until all four decorations have been loaded. | ||||||
| 60149 | POP IY | Restore IY. | ||||||
| 60151 | EI | Enable interrupts. | ||||||
| 60152 | RET | Return. | ||||||
| Prev: 60060 | Up: Map | Next: 60153 |