Prev: 53327 Up: Map Next: 53378
53347: 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 32
HL Attribute address of the bottom left cell
PaintTwoColumns 53347 CALL TestAttributeAddress Call TestAttributeAddress.
53350 JR Z,PaintTwoColumns_Next Jump to PaintTwoColumns_Next if the zero flag is set.
53352 LD A,L A=L.
53353 AND %00011111 Keep the bits of A that are set in 31.
53355 DEC A Step A back.
53356 CP 28 Jump to PaintTwoColumns_Second if A is 28 or more.
53358 JR NC,PaintTwoColumns_Second
53360 LD (HL),C Write C where HL points.
PaintTwoColumns_Second 53361 INC HL Advance HL.
53362 LD A,L A=L.
53363 AND %00011111 Keep the bits of A that are set in 31.
53365 DEC A Step A back.
53366 CP 28 Jump to PaintTwoColumns_Restore if A is 28 or more.
53368 JR NC,PaintTwoColumns_Restore
53370 LD (HL),C Write C where HL points.
PaintTwoColumns_Restore 53371 DEC HL Step HL back.
PaintTwoColumns_Next 53372 AND A Is A zero?
53373 SBC HL,DE Subtract DE and the carry from HL.
53375 DJNZ PaintTwoColumns Decrease B and jump to PaintTwoColumns until none remain.
53377 RET Return.
Prev: 53327 Up: Map Next: 53378