Prev: 56137 Up: Map Next: 56201
56155: Fill Edge Row Pair
Used by the routines at FillTwoEdgeRows and FillFourEdgeRows.
Stores the pattern in D and E in two pixel rows, one above the other, for each of the C cells across, but only the cells inside the area of the terrain. The pixel row in SegmentRow goes up by two and the screen address moves up a row and along by the column step.
Input
C Number of cells
DE Pattern for the two rows
HL Screen address
FillEdgeRowPair 56155 LD A,(52804) The segment row.
56158 CP 184 Jump to FillEdgeRowPair_Up if A is 184 or more.
56160 JR NC,FillEdgeRowPair_Up
56162 CP 24 Jump to FillEdgeRowPair_Up if A is less than 24.
56164 JR C,FillEdgeRowPair_Up
56166 LD B,C B=C.
56167 PUSH HL Stash HL on the stack.
FillEdgeRowPair_Cell 56168 LD A,L A=L.
56169 AND %00011111 Keep the bits of A that are set in 31.
56171 DEC A Step A back.
56172 CP 28 Jump to FillEdgeRowPair_Next if A is 28 or more.
56174 JR NC,FillEdgeRowPair_Next
56176 LD (HL),D Write D where HL points.
56177 DEC H Step H back.
56178 LD (HL),E Write E where HL points.
56179 INC H Advance H.
FillEdgeRowPair_Next 56180 INC L Advance L.
56181 DJNZ FillEdgeRowPair_Cell Decrease B and jump to FillEdgeRowPair_Cell until none remain.
56183 POP HL Bring HL back off the stack.
FillEdgeRowPair_Up 56184 LD A,(52804) The segment row.
56187 DEC A Step A back.
56188 DEC A Step A back.
56189 LD (52804),A Update the segment row.
56192 LD A,(52790) The column step.
56195 ADD A,L A gains L.
56196 LD L,A L=A.
56197 DEC H Step H back.
56198 JP MoveUpARow Jump to MoveUpARow.
Prev: 56137 Up: Map Next: 56201