Prev: 41143 Up: Map Next: 41196
41170: Draw Attributes Moving Down-Right
The attribute routine for an entity which has moved down and right. Each row of cells under the entity is set to the attribute of the entity, and the cell to the left of it is put back to the attribute of the room. So is the row above the entity, from one cell to the left of the entity.
Input
B The width of the sprite in cells
C The number of rows of cells
D The attribute of the entity
E The attribute of the room
AttrDrawMovingDownRight 41170 POP HL Restore the attribute address from the stack.
AttrDrawMovingDownRight_Row 41171 PUSH BC Stash the width and the number of rows on the stack.
41172 PUSH HL Stash the attribute address on the stack.
41173 DEC L Move to the cell on the left.
41174 LD (HL),E Write the attribute of the room to the cell.
41175 INC L Move back to the first cell.
AttrDrawMovingDownRight_Cell 41176 LD (HL),D Write the attribute of the entity to the cell.
41177 INC L Move to the next cell.
41178 DJNZ AttrDrawMovingDownRight_Cell Decrease the width by one and loop back to AttrDrawMovingDownRight_Cell until the row is done.
41180 POP HL Restore the attribute address from the stack.
41181 LD BC,32 BC=0032.
41184 AND A Move up a row.
41185 SBC HL,BC
41187 POP BC Restore the width and the number of rows from the stack.
41188 DEC C Decrease the number of rows by one and loop back to AttrDrawMovingDownRight_Row until all of the rows have been set.
41189 JR NZ,AttrDrawMovingDownRight_Row
41191 DEC L Move to the cell on the left in the row above.
41192 LD (HL),E Write the attribute of the room to the cell.
41193 INC L Move back to the first cell.
41194 JR AttrDrawMovingDown_Above Jump to AttrDrawMovingDown_Above to put the row above back to the attribute of the room.
Prev: 41143 Up: Map Next: 41196