Skip to navigation


Visibility: ShowOrHideLine

Name: ShowOrHideLine [Show more] Type: Subroutine Category: Visibility Summary: Process a line, working out its visibility and adding it to the linesToShow or linesToHide list Deep dive: Visibility checks
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ResetLineLists calls ShowOrHideLine

Check the visibility of a line and either add it to the linesToShow list or the linesToHide list, depending on whether it is visible.
Arguments: lineId The line ID to process
.ShowOrHideLine LDA #0 \ Set HH = 0, so in the following call to ProcessLine STA HH \ we check the line's distance against maxLineDistance \ in the visibility checks JSR ProcessLine \ Check whether this line is visible, returning the \ result in showLine LDA lineId \ Fetch the line ID into A LDX showLine \ If showLine = 0 then the line is visible, so jump down BEQ shli1 \ to shli1 to add the line to the linesToShow list \ The value of showLine is non-zero, so the line is not \ visible and we now add it to the linesToHide list INC linesToHideEnd \ Increment linesToHideEnd to point to the next free \ entry at the end of the linesToHide list LDX linesToHideEnd \ Add the line's ID to the end of the linesToHide list STA linesToHide,X RTS \ Return from the subroutine .shli1 \ The value of showLine is zero, so the line is visible \ and we now add it to the linesToShow list INC linesToShowEnd \ Increment linesToShowEnd so it still points to the \ first empty entry in the linesToShow list after we \ add this line INC linesToShowPointer \ Increment linesToShowPointer as we have already \ processed the line, so we set the progress pointer to \ be after this line LDX linesToShowPointer \ Add the line's ID to the end of the linesToShow list STA linesToShow,X RTS \ Return from the subroutine