Prev: 55057 Up: Map Next: 55288
55081: End Segment
Finishes the last step of a segment: the end of the segment is stored at offset 2 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 55081 LD (IX+2),D Write D to offset 2 of IX.
55084 LD SP,23418 Set the stack pointer to 23418.
55087 CALL DrawEdgePixels Call DrawEdgePixels.
55090 LD A,(23599) The flagged steps.
55093 AND A Jump to FinishSegment if A is zero.
55094 JP Z,FinishSegment
55097 LD A,(52801) The horizontal offset.
55100 AND %00000111 Keep the bits of A that are set in 7.
55102 JP NZ,FinishSegment Jump to FinishSegment if the zero flag is clear.
55105 LD (23578),A The alignment that should stop the scroll.
55108 LD A,(52411) The horizontal scroll speed.
55111 AND A Jump to EndSegment_Fill if A is not zero.
55112 JP NZ,EndSegment_Fill
55115 LD A,(52791) The vertical step.
55118 AND A Jump to FinishSegment if A is zero.
55119 JP Z,FinishSegment
55122 LD (23578),A The vertical step that should stop the scroll.
55125 LD A,(58395) The slope direction.
55128 LD B,A B=A.
55129 LD A,(52825) The horizontal step copy.
55132 AND A Jump to EndSegment_Store if A is zero.
55133 JR Z,EndSegment_Store
55135 LD A,(23605) The upside-down segment flag.
EndSegment_Store 55138 XOR B Flip the bits of A that are set in B.
55139 LD (52411),A Update the horizontal scroll speed.
EndSegment_Fill 55142 LD A,(52791) The vertical step.
55145 AND A Jump to FillSlopeEdge if A is zero.
55146 JP Z,FillSlopeEdge
55149 EXX Switch to the alternate registers.
55150 LD HL,(52815) Fetch the word at SavedScreenAddress into HL.
55153 LD A,(52819) The saved row.
55156 LD (52804),A Update the segment row.
55159 LD A,(52825) The horizontal step copy.
55162 AND A Jump to EndSegment_Pattern if A is not zero.
55163 JR NZ,EndSegment_Pattern
55165 LD (23605),A Update the upside-down segment flag.
55168 LD A,(58395) The slope direction.
55171 NEG Negate A.
55173 LD (52790),A Update the column step.
EndSegment_Pattern 55176 LD DE,21930 DE=21930.
55179 LD A,(52411) The horizontal scroll speed.
55182 LD B,A B=A.
55183 LD A,(23605) The upside-down segment flag.
55186 XOR B Flip the bits of A that are set in B.
55187 LD B,A B=A.
55188 LD A,(58395) The slope direction.
55191 XOR B Flip the bits of A that are set in B.
55192 BIT 7,A Jump to EndSegment_Direction if bit 7 of A is clear.
55194 JR Z,EndSegment_Direction
55196 LD DE,0 DE=0.
EndSegment_Direction 55199 LD A,(58395) The slope direction.
55202 CP 255 Jump to EndSegment_Flat if A is 255.
55204 JR Z,EndSegment_Flat
55206 LD A,(52411) The horizontal scroll speed.
55209 BIT 7,A Jump to EndSegment_Column if bit 7 of A is set.
55211 JR NZ,EndSegment_Column
55213 DEC L Step L back.
55214 JP EndSegment_Rows Jump to EndSegment_Rows.
EndSegment_Column 55217 LD A,(23588) The column step size.
55220 ADD A,L A gains L.
55221 LD L,A L=A.
55222 JP EndSegment_Jump Jump to EndSegment_Jump.
EndSegment_Flat 55225 LD A,(52411) The horizontal scroll speed.
55228 BIT 7,A Jump to EndSegment_Step if bit 7 of A is set.
55230 JR NZ,EndSegment_Step
55232 DEC L Step L back.
EndSegment_Jump 55233 JP EndSegment_Rows Jump to EndSegment_Rows.
EndSegment_Step 55236 LD A,(52790) The column step.
55239 ADD A,L A gains L.
55240 LD L,A L=A.
EndSegment_Rows 55241 LD A,(52825) The horizontal step copy.
55244 AND A Jump to EndSegment_Strip if A is not zero.
55245 JR NZ,EndSegment_Strip
55247 LD A,(23599) The flagged steps.
55250 LD B,A B=A.
55251 XOR A Clear A.
EndSegment_Rows2 55252 ADD A,16 Add 16 to A.
55254 DJNZ EndSegment_Rows2 Decrease B and jump to EndSegment_Rows2 until none remain.
55256 LD (52826),A Update the vertical step copy.
55259 LD A,1 A=1.
55261 LD (23599),A Update the flagged steps.
EndSegment_Strip 55264 LD A,(52826) The vertical step copy.
55267 SRL A Shift A right.
55269 LD C,A C=A.
55270 EXX Switch to the alternate registers.
55271 LD A,(23599) The flagged steps.
55274 LD B,A B=A.
55275 CALL FillStripWithPattern Call FillStripWithPattern.
55278 LD A,(23578) See whether that marker should stop the scroll.
55281 AND A Jump to FinishSegment if A is zero.
55282 JR Z,FinishSegment
55284 XOR A Clear A.
55285 LD (52411),A Update the horizontal scroll speed.
Continue on to FinishSegment.
Prev: 55057 Up: Map Next: 55288