Prev: D063 Up: Map Next: D0AC
D082: Paint Three Columns
Paints three 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
PaintThreeColumns D082 CALL TestAttributeAddress Call TestAttributeAddress.
D085 JR Z,PaintThreeColumns_Next Jump to PaintThreeColumns_Next if the zero flag is set.
D087 LD A,L A=L.
D088 AND %00011111 Keep the bits of A that are set in 1F.
D08A DEC A Step A back.
D08B CP $1C Jump to PaintThreeColumns_Second if A is 1C or more.
D08D JR NC,PaintThreeColumns_Second
D08F LD (HL),C Write C where HL points.
PaintThreeColumns_Second D090 INC HL Advance HL.
D091 LD A,L A=L.
D092 AND %00011111 Keep the bits of A that are set in 1F.
D094 DEC A Step A back.
D095 CP $1C Jump to PaintThreeColumns_Third if A is 1C or more.
D097 JR NC,PaintThreeColumns_Third
D099 LD (HL),C Write C where HL points.
PaintThreeColumns_Third D09A INC HL Advance HL.
D09B LD A,L A=L.
D09C AND %00011111 Keep the bits of A that are set in 1F.
D09E DEC A Step A back.
D09F CP $1C Jump to PaintThreeColumns_Restore if A is 1C or more.
D0A1 JR NC,PaintThreeColumns_Restore
D0A3 LD (HL),C Write C where HL points.
PaintThreeColumns_Restore D0A4 DEC HL Step HL back.
D0A5 DEC HL Step HL back.
PaintThreeColumns_Next D0A6 AND A Is A zero?
D0A7 SBC HL,DE Subtract DE and the carry from HL.
D0A9 DJNZ PaintThreeColumns Decrease B and jump to PaintThreeColumns until none remain.
D0AB RET Return.
Prev: D063 Up: Map Next: D0AC