Prev: D711 Up: Map Next: D7F8
D729: End Segment
Finishes the last step of a segment: the end of the segment is stored at offset 02 of the record and DrawEdgePixels draws the pixels at the edge of a sloped segment. If steps of the segment were flagged (FlaggedSteps is not zero) and the horizontal offset is a multiple of eight, the routine starts or stops the horizontal speed in HorizontalSpeed depending on the direction of the segment and fills the pixels of the steps that were flagged with FillStripWithPattern, using the chequer pattern or blank. Purpose not yet known for the details of this.
EndSegment D729 LD (IX+$02),D Write D to offset 02 of IX.
D72C LD SP,$5B7A Set the stack pointer to 5B7A.
D72F CALL DrawEdgePixels Call DrawEdgePixels.
D732 LD A,($5C2F) The flagged steps.
D735 AND A Jump to FinishSegment if A is zero.
D736 JP Z,FinishSegment
D739 LD A,($CE41) The horizontal offset.
D73C AND %00000111 Keep the bits of A that are set in 07.
D73E JP NZ,FinishSegment Jump to FinishSegment if the zero flag is clear.
D741 LD ($5C1A),A The alignment that should stop the scroll.
D744 LD A,($CCBB) The horizontal scroll speed.
D747 AND A Jump to EndSegment_Fill if A is not zero.
D748 JP NZ,EndSegment_Fill
D74B LD A,($CE37) The vertical step.
D74E AND A Jump to FinishSegment if A is zero.
D74F JP Z,FinishSegment
D752 LD ($5C1A),A The vertical step that should stop the scroll.
D755 LD A,($E41B) The slope direction.
D758 LD B,A B=A.
D759 LD A,($CE59) The horizontal step copy.
D75C AND A Jump to EndSegment_Store if A is zero.
D75D JR Z,EndSegment_Store
D75F LD A,($5C35) The upside-down segment flag.
EndSegment_Store D762 XOR B Flip the bits of A that are set in B.
D763 LD ($CCBB),A Update the horizontal scroll speed.
EndSegment_Fill D766 LD A,($CE37) The vertical step.
D769 AND A Jump to FillSlopeEdge if A is zero.
D76A JP Z,FillSlopeEdge
D76D EXX Switch to the alternate registers.
D76E LD HL,($CE4F) Fetch the word at SavedScreenAddress into HL.
D771 LD A,($CE53) The saved row.
D774 LD ($CE44),A Update the segment row.
D777 LD A,($CE59) The horizontal step copy.
D77A AND A Jump to EndSegment_Pattern if A is not zero.
D77B JR NZ,EndSegment_Pattern
D77D LD ($5C35),A Update the upside-down segment flag.
D780 LD A,($E41B) The slope direction.
D783 NEG Negate A.
D785 LD ($CE36),A Update the column step.
EndSegment_Pattern D788 LD DE,$55AA DE=55AA.
D78B LD A,($CCBB) The horizontal scroll speed.
D78E LD B,A B=A.
D78F LD A,($5C35) The upside-down segment flag.
D792 XOR B Flip the bits of A that are set in B.
D793 LD B,A B=A.
D794 LD A,($E41B) The slope direction.
D797 XOR B Flip the bits of A that are set in B.
D798 BIT 7,A Jump to EndSegment_Direction if bit 7 of A is clear.
D79A JR Z,EndSegment_Direction
D79C LD DE,$0000 DE=00.
EndSegment_Direction D79F LD A,($E41B) The slope direction.
D7A2 CP $FF Jump to EndSegment_Flat if A is FF.
D7A4 JR Z,EndSegment_Flat
D7A6 LD A,($CCBB) The horizontal scroll speed.
D7A9 BIT 7,A Jump to EndSegment_Column if bit 7 of A is set.
D7AB JR NZ,EndSegment_Column
D7AD DEC L Step L back.
D7AE JP EndSegment_Rows Jump to EndSegment_Rows.
EndSegment_Column D7B1 LD A,($5C24) The column step size.
D7B4 ADD A,L A gains L.
D7B5 LD L,A L=A.
D7B6 JP EndSegment_Jump Jump to EndSegment_Jump.
EndSegment_Flat D7B9 LD A,($CCBB) The horizontal scroll speed.
D7BC BIT 7,A Jump to EndSegment_Step if bit 7 of A is set.
D7BE JR NZ,EndSegment_Step
D7C0 DEC L Step L back.
EndSegment_Jump D7C1 JP EndSegment_Rows Jump to EndSegment_Rows.
EndSegment_Step D7C4 LD A,($CE36) The column step.
D7C7 ADD A,L A gains L.
D7C8 LD L,A L=A.
EndSegment_Rows D7C9 LD A,($CE59) The horizontal step copy.
D7CC AND A Jump to EndSegment_Strip if A is not zero.
D7CD JR NZ,EndSegment_Strip
D7CF LD A,($5C2F) The flagged steps.
D7D2 LD B,A B=A.
D7D3 XOR A Clear A.
EndSegment_Rows2 D7D4 ADD A,$10 Add 10 to A.
D7D6 DJNZ EndSegment_Rows2 Decrease B and jump to EndSegment_Rows2 until none remain.
D7D8 LD ($CE5A),A Update the vertical step copy.
D7DB LD A,$01 A=01.
D7DD LD ($5C2F),A Update the flagged steps.
EndSegment_Strip D7E0 LD A,($CE5A) The vertical step copy.
D7E3 SRL A Shift A right.
D7E5 LD C,A C=A.
D7E6 EXX Switch to the alternate registers.
D7E7 LD A,($5C2F) The flagged steps.
D7EA LD B,A B=A.
D7EB CALL FillStripWithPattern Call FillStripWithPattern.
D7EE LD A,($5C1A) See whether that marker should stop the scroll.
D7F1 AND A Jump to FinishSegment if A is zero.
D7F2 JR Z,FinishSegment
D7F4 XOR A Clear A.
D7F5 LD ($CCBB),A Update the horizontal scroll speed.
Continue on to FinishSegment.
Prev: D711 Up: Map Next: D7F8