Prev: 70F8 Up: Map Next: 7188
710E: Paint Shape Bytes
Used by the routine at PlotShape.
Copies the expanded shape into the attribute buffer, honouring the FE and FB markers that end or repeat a run.
PaintShape 710E LD HL,($5BBC) Fetch Shape_Pointer.
7111 INC HL Step to the first shape byte.
7112 PUSH HL Stash that pointer on the stack.
7113 LD A,($5BC4) Copy Row_Width into Column_Counter.
7116 LD ($5BC6),A
7119 LD HL,($5BC2) Fetch Picture_Y.
711C LD H,$00 Keep only the low byte.
711E CALL $0E93 Call CL_LINE.
7121 LD A,($5BC1) Copy Picture_X into DE.
7124 LD E,A
7125 LD D,$00
7127 ADD HL,DE Add the X coordinate.
7128 LD DE,($5BC9) Fetch Destination_Base.
712C ADD HL,DE Add it.
712D EX DE,HL Swap the destination into DE.
712E POP HL Restore the shape pointer from the stack.
Paint the next shape byte.
PaintShape_Byte 712F PUSH HL Stash the shape pointer on the stack.
7130 LD A,(HL) Fetch this shape byte.
7131 CP $FB Jump to PaintShape_Markers if it is not FB.
7133 JR NZ,PaintShape_Markers
7135 PUSH DE Stash the destination on the stack.
Fetch the parameter byte.
7136 CALL FetchParameterByte Call FetchParameterByte.
7139 POP DE Restore the destination from the stack.
713A POP BC Replace the shape pointer (using the stack).
713B PUSH HL
The terminator FE ends the shape, and FA copies a parameter block.
PaintShape_Markers 713C CP $FE Jump to AbandonShape if it is the terminator FE.
713E JR Z,AbandonShape
7140 CP $FA Jump to PaintShape_Run if it is not FA.
7142 JR NZ,PaintShape_Run
Copy the parameter block.
7144 PUSH DE Call CopyParameterBlock.
7145 CALL CopyParameterBlock
7148 POP DE
7149 POP AF Drop the old pointer.
714A JR PaintShape_Byte Jump to PaintShape_Byte.
A run-length byte has bit 7 set.
PaintShape_Run 714C BIT 7,A Jump to PaintShape_Write if bit 7 is reset.
714E JR Z,PaintShape_Write
7150 AND %01111111 Keep only bits 0-6.
7152 DEC A Store that in Run_Count.
7153 LD ($5BC0),A
7156 LD A,($5BCB) Fetch Last_Painted_Byte.
Write this attribute byte.
PaintShape_Write 7159 LD (DE),A Write the byte.
715A LD ($5BCB),A Store it in Last_Painted_Byte.
715D INC DE Advance the destination.
715E LD HL,$5BC6 Point HL at Column_Counter.
7161 DEC (HL) Jump to PaintShape_Repeat if this row still has columns left.
7162 JR NZ,PaintShape_Repeat
7164 PUSH HL Stash the column counter on the stack.
7165 LD A,($5BC4) Copy Row_Width into Column_Counter.
7168 LD ($5BC6),A
716B LD L,A 20 minus the columns used.
716C LD A,$20
716E SUB L
716F LD L,A
7170 LD H,$00 Add that gap to the destination.
7172 ADD HL,DE
7173 EX DE,HL
7174 POP HL Restore the column counter from the stack.
Repeat the last byte for the remaining run count.
PaintShape_Repeat 7175 LD A,($5BC0) Jump to PaintShape_Next if Run_Count has reached 00.
7178 OR A
7179 JR Z,PaintShape_Next
717B DEC A Decrement Run_Count.
717C LD ($5BC0),A
717F LD A,($5BCB) Fetch Last_Painted_Byte.
7182 JR PaintShape_Write Jump to PaintShape_Write.
Step on to the next shape byte.
PaintShape_Next 7184 POP HL Restore the shape pointer from the stack.
7185 INC HL Advance it.
7186 JR PaintShape_Byte Jump to PaintShape_Byte.
Prev: 70F8 Up: Map Next: 7188