Skip to navigation

Aviator on the BBC Micro

Visibility: ProcessRunwayLine (Part 1 of 5)

Name: ProcessRunwayLine (Part 1 of 5) [Show more] Type: Subroutine Category: Visibility Summary: Calculate coordinates and visibility for a runway line Deep dive: Visibility checks
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ProcessLine (Part 2 of 7) calls ProcessRunwayLine

Arguments: lineId The line ID to process (1 to 11): * 1 to 4 are the runway outline * 5 to 11 are the dashes down the middle of the runway Returns: showLine Whether this line is visible: * 0 = line is visible * Non-zero = line is not visible
.ProcessRunwayLine LDA objectStatus+1 \ Fetch the status byte for object 1, the runway object BEQ prun3 \ If object 1's status byte is zero, then we have not \ yet calculated the runway object's coordinates and \ visibility, so jump to prun3 to do this BMI prun1 \ If bit 7 of object 1's status byte is set, then we \ have already decided that the runway object is \ visible, so jump to prun1 to set the line's visibility \ accordingly JMP prun9 \ If we get here then we have already decided that the \ runway object is hidden, so jump to prun9 to set the \ line's visibility as hidden .prun1 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 prun2 \ prun2 to return from the subroutine as we always show \ the outline when the runway is visible LDA showRunwayDashes \ The line we are checking is one of the dashes down the STA showLine \ middle of the runway, so set the line's visibility to \ the value of showRunwayDashes, which contains the \ visibility of the runway dashes .prun2 RTS \ Return from the subroutine