Prev: D04F Up: Map Next: D082
D063: Paint Two Columns
Paints two attribute cells in each of the rows going up the screen, but only the cells inside the area of the terrain.
Input
B Number of rows
C Attribute value
DE 20
HL Attribute address of the bottom left cell
PaintTwoColumns D063 CALL TestAttributeAddress Call TestAttributeAddress.
D066 JR Z,PaintTwoColumns_Next Jump to PaintTwoColumns_Next if the zero flag is set.
D068 LD A,L A=L.
D069 AND %00011111 Keep the bits of A that are set in 1F.
D06B DEC A Step A back.
D06C CP $1C Jump to PaintTwoColumns_Second if A is 1C or more.
D06E JR NC,PaintTwoColumns_Second
D070 LD (HL),C Write C where HL points.
PaintTwoColumns_Second D071 INC HL Advance HL.
D072 LD A,L A=L.
D073 AND %00011111 Keep the bits of A that are set in 1F.
D075 DEC A Step A back.
D076 CP $1C Jump to PaintTwoColumns_Restore if A is 1C or more.
D078 JR NC,PaintTwoColumns_Restore
D07A LD (HL),C Write C where HL points.
PaintTwoColumns_Restore D07B DEC HL Step HL back.
PaintTwoColumns_Next D07C AND A Is A zero?
D07D SBC HL,DE Subtract DE and the carry from HL.
D07F DJNZ PaintTwoColumns Decrease B and jump to PaintTwoColumns until none remain.
D081 RET Return.
Prev: D04F Up: Map Next: D082