Prev: 88E8 Up: Map Next: 8931
890A: Write Sprite Attributes
Paint a rectangle of colours into the attribute buffer, taking one colour byte from the grid at DE for every cell the actor's sprite covers and leaving empty cells alone.
Input
DE Colour grid
IX Actor slot
Paint the actor colour rectangle into the attribute buffer.
WriteSpriteAttributes 890A LD L,(IX+$01) Fetch the screen column and actor Y.
890D LD H,(IX+$04)
8910 CALL AttributeAddress Call AttributeAddress.
8913 LD A,(DE) Fetch the width and height from the graphic header.
8914 INC DE
8915 LD B,A
8916 LD A,(DE)
8917 INC DE
8918 LD C,A
WriteSpriteAttributes_Loop 8919 PUSH BC Stash the counters and attribute address.
891A PUSH HL
Write the colours along the row, skipping empty attributes.
WriteSpriteAttributes_WriteInk 891B LD A,(HL) Jump to WriteSpriteAttributes_NextColumn if this attribute is empty.
891C AND A
891D JR Z,WriteSpriteAttributes_NextColumn
891F LD A,(DE) Write the next colour byte.
8920 LD (HL),A
WriteSpriteAttributes_NextColumn 8921 INC DE Move onto the next colour and attribute column, looping back to WriteSpriteAttributes_WriteInk.
8922 INC L
8923 DJNZ WriteSpriteAttributes_WriteInk
Step up one attribute row and repeat until every row is painted.
8925 POP HL Restore this row and step up one attribute row.
8926 LD BC,$0020
8929 AND A
892A SBC HL,BC
892C POP BC
892D DEC C Decrease the height and loop back to WriteSpriteAttributes_Loop until every row is painted.
892E JR NZ,WriteSpriteAttributes_Loop
8930 RET Return.
Prev: 88E8 Up: Map Next: 8931