LDY #1 \ Set Y = 1 so we check point ID 1 in the call to \ CheckLineDistance (point ID 1 is the anchor point of \ the runway) LDX #10 \ Set X = 10 so we check the distance against that for \ line ID 10, which is one of the dashes in the middle \ of the runway .prun7 JSR CheckLineDistance \ Check whether point Y on line X is within the visible STA showLine \ distance for the line and store the result in showLine BNE prun8 \ If the point is too far away to be visible, then all \ the dashes are too far away to be seen, so jump to \ prun8 to return the relevant result CPY #3 \ If Y = 3, then we have checked both point 1 and 3 and BEQ prun12 \ both are close enough to be visible, so jump to prun12 \ to finish off the processing LDY #3 \ Otherwise set Y = 3 and jump back prun7 to check point BNE prun7 \ 3 as well (point 3 is the corner of the runway outline \ opposite the anchor point) .prun8 LDA #%10000000 \ Set showRunwayDashes to indicate that the dashes down STA showRunwayDashes \ the middle of the runway are not visible LDA lineId \ If lineId < 5, then the line ID is in the range 1 to CMP #5 \ 4, so it's part of the runway outline, so jump to BCC prun10 \ prun10 to return the result that the line is visible, \ as we always show the outline when the runway is \ visible, even when the runway dashes are hidden .prun9 LDA #%10000000 \ Set A to indicate the line is not visible, and jump to BNE prun11 \ prun11 to return this as the value of showLine (this \ BNE is effectively a JMP as A is never zero) .prun10 LDA #0 \ Set A to indicate the line is visible, so we can \ return this as the value of showLine .prun11 STA showLine \ Set the line's visibility to the value in A, to return \ as our result RTS \ Return from the subroutineName: ProcessRunwayLine (Part 3 of 5) [Show more] Type: Subroutine Category: Visibility Summary: Calculate visibility for the runway dashesContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Subroutine CheckLineDistance (category: Visibility)
Check whether a point on a line is within the visible distance for the line
[X]
Label prun10 is local to this routine
[X]
Label prun11 is local to this routine
[X]
Label prun12 in subroutine ProcessRunwayLine (Part 4 of 5)
[X]
Label prun7 is local to this routine
[X]
Label prun8 is local to this routine
[X]
Variable showLine in workspace Main variable workspace
Determines whether a line is visible
[X]
Variable showRunwayDashes in workspace Main variable workspace
Determines whether the dashes down the middle of the runway are close enough to be visible