.plin14 \ We jump straight here if we are working through a \ linked object and come across a point with bit 7 set \ in the point's status byte (which means we have \ already processed the rest of the points in the \ linked object), otherwise we got here after processing \ the object in the previous part \ We now loop through any points we have added to the \ stack and process them all. If we find any that are \ not visible, then we return the result that the whole \ line is not visible PLA \ Pull the next point ID from the stack CMP pointId \ If the point ID matches pointId, then we have no other BEQ plin15 \ points on the stack to process, so jump down to plin15 \ to calculate its visibility STA GG \ Store the point ID in GG so its coordinates get \ calculated in the call to SetObjPointCoords LDA #0 \ Set matrixAxis = 0 (this has no effect, as this value STA matrixAxis \ is only used when setting the matrices, so this is \ presumably left over from a version of the code that \ supported multiple sets of matrices) STA matrixNumber \ Set the matrix number so the call to SetObjPointCoords \ uses matrix 1 in the calculation, which will rotate \ the point by the plane's pitch, roll and yaw angles, \ transforming it from the outside world's frame of \ reference to the plane's frame of reference JSR SetObjPointCoords \ Calculate the coordinates for this object point LDA showLine \ If showLine is non-zero, then the point is not BNE plin12 \ visible, so jump to plin12 to clear down the stack and \ return from the subroutine LDY GG \ Set objectAnchorPoint = the point ID in GG, so it STY objectAnchorPoint \ contains the ID of the last point before the object ID \ at the end of the linked list of points (as the last \ ID, the object ID, is processed by plin15 below) LDA #%10000000 \ Set bit 7 of the point's status byte, to indicate that ORA pointStatus,Y \ the point has now had its coordinates and visibility STA pointStatus,Y \ calculated BNE plin14 \ Jump to plin14 (this BNE is effectively a JMP as A is \ never zero) .plin15 STA GG \ Store the point ID in GG LDA #0 \ Set matrixAxis = 0 (this has no effect, as this value STA matrixAxis \ is only used when setting the matrices, so this is \ presumably left over from a version of the code that \ supported multiple sets of matrices) STA matrixNumber \ Set the matrix number so the call to SetObjPointCoords \ uses matrix 1 in the calculation, which will rotate \ the point by the plane's pitch, roll and yaw angles, \ transforming it from the outside world's frame of \ reference to the plane's frame of reference JSR SetObjPointCoords \ Calculate the coordinates for this object point LDA showLine \ If showLine is non-zero, then the line is not visible, BNE plin20 \ so jump to plin20 to return from the subroutineName: ProcessLine (Part 6 of 7) [Show more] Type: Subroutine Category: Visibility Summary: Check the visibility of all the object's points on the stack Deep dive: Visibility checksContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Subroutine SetObjPointCoords (Part 1 of 2) (category: 3D geometry)
Calculate the coordinate for a point within an object
[X]
Variable matrixAxis in workspace Main variable workspace
The axis to be processed by the matrix routines, specifically those that populate the matrices
[X]
Variable matrixNumber in workspace Main variable workspace
The matrix used in matrix operations
[X]
Variable objectAnchorPoint in workspace Main variable workspace
Used to store the anchor point of the current object
[X]
Label plin12 in subroutine ProcessLine (Part 5 of 7)
[X]
Label plin14 is local to this routine
[X]
Label plin15 is local to this routine
[X]
Label plin20 in subroutine ProcessLine (Part 7 of 7)
[X]
Variable pointId in workspace Main variable workspace
Temporary storage, used to store the ID of the current point when checking a line's visibility in the ProcessLine routine
[X]
Variable pointStatus in workspace Main variable workspace
Each point's status byte
[X]
Variable showLine in workspace Main variable workspace
Determines whether a line is visible