.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 subroutineName: 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 checksContext: 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
[X]
Subroutine ProcessLine (Part 1 of 7) (category: Visibility)
Process a line, rotating and transforming it to the correct coordinates and calculating its visibility
[X]
Variable linesToHide in workspace Main variable workspace
A list of line IDs for lines that are not visible
[X]
Variable linesToHideEnd in workspace Zero page
The index of the last entry in the linesToHide list
[X]
Variable linesToShow in workspace Main variable workspace
A list of line IDs for lines that are visible
[X]
Variable linesToShowEnd in workspace Zero page
The index of the first empty entry in the linesToShow list
[X]
Variable linesToShowPointer in workspace Zero page
A pointer into the linesToShow list to keep track of where we have processed up to
[X]
Label shli1 is local to this routine
[X]
Variable showLine in workspace Main variable workspace
Determines whether a line is visible