Prev: 35048 Up: Map Next: 35121
35082: 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 35082 LD L,(IX+1) Fetch the screen column and actor Y.
35085 LD H,(IX+4)
35088 CALL AttributeAddress Call AttributeAddress.
35091 LD A,(DE) Fetch the width and height from the graphic header.
35092 INC DE
35093 LD B,A
35094 LD A,(DE)
35095 INC DE
35096 LD C,A
WriteSpriteAttributes_Loop 35097 PUSH BC Stash the counters and attribute address.
35098 PUSH HL
Write the colours along the row, skipping empty attributes.
WriteSpriteAttributes_WriteInk 35099 LD A,(HL) Jump to WriteSpriteAttributes_NextColumn if this attribute is empty.
35100 AND A
35101 JR Z,WriteSpriteAttributes_NextColumn
35103 LD A,(DE) Write the next colour byte.
35104 LD (HL),A
WriteSpriteAttributes_NextColumn 35105 INC DE Move onto the next colour and attribute column, looping back to WriteSpriteAttributes_WriteInk.
35106 INC L
35107 DJNZ WriteSpriteAttributes_WriteInk
Step up one attribute row and repeat until every row is painted.
35109 POP HL Restore this row and step up one attribute row.
35110 LD BC,32
35113 AND A
35114 SBC HL,BC
35116 POP BC
35117 DEC C Decrease the height and loop back to WriteSpriteAttributes_Loop until every row is painted.
35118 JR NZ,WriteSpriteAttributes_Loop
35120 RET Return.
Prev: 35048 Up: Map Next: 35121