Prev: 53347 Up: Map Next: 53420
53378: 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 32
HL Attribute address of the bottom left cell
PaintThreeColumns 53378 CALL TestAttributeAddress Call TestAttributeAddress.
53381 JR Z,PaintThreeColumns_Next Jump to PaintThreeColumns_Next if the zero flag is set.
53383 LD A,L A=L.
53384 AND %00011111 Keep the bits of A that are set in 31.
53386 DEC A Step A back.
53387 CP 28 Jump to PaintThreeColumns_Second if A is 28 or more.
53389 JR NC,PaintThreeColumns_Second
53391 LD (HL),C Write C where HL points.
PaintThreeColumns_Second 53392 INC HL Advance HL.
53393 LD A,L A=L.
53394 AND %00011111 Keep the bits of A that are set in 31.
53396 DEC A Step A back.
53397 CP 28 Jump to PaintThreeColumns_Third if A is 28 or more.
53399 JR NC,PaintThreeColumns_Third
53401 LD (HL),C Write C where HL points.
PaintThreeColumns_Third 53402 INC HL Advance HL.
53403 LD A,L A=L.
53404 AND %00011111 Keep the bits of A that are set in 31.
53406 DEC A Step A back.
53407 CP 28 Jump to PaintThreeColumns_Restore if A is 28 or more.
53409 JR NC,PaintThreeColumns_Restore
53411 LD (HL),C Write C where HL points.
PaintThreeColumns_Restore 53412 DEC HL Step HL back.
53413 DEC HL Step HL back.
PaintThreeColumns_Next 53414 AND A Is A zero?
53415 SBC HL,DE Subtract DE and the carry from HL.
53417 DJNZ PaintThreeColumns Decrease B and jump to PaintThreeColumns until none remain.
53419 RET Return.
Prev: 53347 Up: Map Next: 53420