Prev: 41123 Up: Map Next: 41170
41143: Draw Attributes Moving Down
The attribute routine for an entity which has moved down. Each row of cells under the entity is set to the attribute of the entity, and the row just above it (which the entity has left) is put back to the attribute of the room.
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
AttrDrawMovingDown 41143 POP HL Restore the attribute address from the stack.
AttrDrawMovingDown_Row 41144 PUSH BC Stash the width and the number of rows on the stack.
41145 PUSH HL Stash the attribute address on the stack.
AttrDrawMovingDown_Cell 41146 LD (HL),D Write the attribute of the entity to the cell.
41147 INC L Move to the next cell.
41148 DJNZ AttrDrawMovingDown_Cell Decrease the width by one and loop back to AttrDrawMovingDown_Cell until the row is done.
41150 POP HL Restore the attribute address from the stack.
41151 LD BC,32 BC=0032.
41154 AND A Move up a row.
41155 SBC HL,BC
41157 POP BC Restore the width and the number of rows from the stack.
41158 DEC C Decrease the number of rows by one and loop back to AttrDrawMovingDown_Row until all of the rows have been set.
41159 JR NZ,AttrDrawMovingDown_Row
This entry point is used by the routines at AttrDrawMovingDownRight and AttrDrawMovingDownLeft.
Put the row above the entity back to the attribute of the room, unless it is above the start of the attributes.
AttrDrawMovingDown_Above 41161 LD A,H Fetch the high byte of the attribute address.
41162 CP 88 Return if the row is above the start of the attributes.
41164 RET C
AttrDrawMovingDown_Restore 41165 LD (HL),E Write the attribute of the room to the cell.
41166 INC L Move to the next cell.
41167 DJNZ AttrDrawMovingDown_Restore Decrease the width by one and loop back to AttrDrawMovingDown_Restore until the row is done.
41169 RET Return.
Prev: 41123 Up: Map Next: 41170