Prev: DB49 Up: Map Next: DB89
DB5B: 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 DB5B LD A,($CE44) The segment row.
DB5E CP $B8 Jump to FillEdgeRowPair_Up if A is B8 or more.
DB60 JR NC,FillEdgeRowPair_Up
DB62 CP $18 Jump to FillEdgeRowPair_Up if A is less than 18.
DB64 JR C,FillEdgeRowPair_Up
DB66 LD B,C B=C.
DB67 PUSH HL Stash HL on the stack.
FillEdgeRowPair_Cell DB68 LD A,L A=L.
DB69 AND %00011111 Keep the bits of A that are set in 1F.
DB6B DEC A Step A back.
DB6C CP $1C Jump to FillEdgeRowPair_Next if A is 1C or more.
DB6E JR NC,FillEdgeRowPair_Next
DB70 LD (HL),D Write D where HL points.
DB71 DEC H Step H back.
DB72 LD (HL),E Write E where HL points.
DB73 INC H Advance H.
FillEdgeRowPair_Next DB74 INC L Advance L.
DB75 DJNZ FillEdgeRowPair_Cell Decrease B and jump to FillEdgeRowPair_Cell until none remain.
DB77 POP HL Bring HL back off the stack.
FillEdgeRowPair_Up DB78 LD A,($CE44) The segment row.
DB7B DEC A Step A back.
DB7C DEC A Step A back.
DB7D LD ($CE44),A Update the segment row.
DB80 LD A,($CE36) The column step.
DB83 ADD A,L A gains L.
DB84 LD L,A L=A.
DB85 DEC H Step H back.
DB86 JP MoveUpARow Jump to MoveUpARow.
Prev: DB49 Up: Map Next: DB89