Prev: A0B7 Up: Map Next: A0EC
A0D2: 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 A0D2 POP HL Restore the attribute address from the stack.
AttrDrawMovingDownRight_Row A0D3 PUSH BC Stash the width and the number of rows on the stack.
A0D4 PUSH HL Stash the attribute address on the stack.
A0D5 DEC L Move to the cell on the left.
A0D6 LD (HL),E Write the attribute of the room to the cell.
A0D7 INC L Move back to the first cell.
AttrDrawMovingDownRight_Cell A0D8 LD (HL),D Write the attribute of the entity to the cell.
A0D9 INC L Move to the next cell.
A0DA DJNZ AttrDrawMovingDownRight_Cell Decrease the width by one and loop back to AttrDrawMovingDownRight_Cell until the row is done.
A0DC POP HL Restore the attribute address from the stack.
A0DD LD BC,$0020 BC=0020.
A0E0 AND A Move up a row.
A0E1 SBC HL,BC
A0E3 POP BC Restore the width and the number of rows from the stack.
A0E4 DEC C Decrease the number of rows by one and loop back to AttrDrawMovingDownRight_Row until all of the rows have been set.
A0E5 JR NZ,AttrDrawMovingDownRight_Row
A0E7 DEC L Move to the cell on the left in the row above.
A0E8 LD (HL),E Write the attribute of the room to the cell.
A0E9 INC L Move back to the first cell.
A0EA JR AttrDrawMovingDown_Above Jump to AttrDrawMovingDown_Above to put the row above back to the attribute of the room.
Prev: A0B7 Up: Map Next: A0EC