\ At this point, M is set to 128 + yaw angle * 4 for \ the previous edge LDA M \ Set U = M - 48 SEC \ SBC #48 \ So U and A now contain the pixel x-coordinate of the STA U \ previous edge, i.e. of the pixel at yaw angle M, \ because: \ \ M - 48 \ = 128 + (yaw angle * 4) - 48 \ = 80 + (yaw angle * 4) \ \ 80 is the x-coordinate of the middle of the screen, so \ this calculates the pixel x-coordinate for this yaw \ angle, in the range 0 to 159 LSR A \ Set UU = A / 4 LSR A \ STA UU \ So UU and A now contain the dash data block number for \ the pixel at yaw angle M, as each dash data block is \ four pixels wide CMP #40 \ If A >= 40, then this is not a valid dash data block BCS dver24 \ number, as they are in the range 0 to 39, so jump to \ dver28 via dver24 to clean up and return from the \ subroutine LSR A \ Halve A, as there are two dash data blocks in every \ page of memory, so A is now the page number of the \ relevant dash data block CLC \ Set Q = dashData + A ADC #HI(dashData) \ STA Q \ So Q is the high byte of the address of the dash data \ block STA S \ Set S = Q CLC \ Set NN = S + 1 ADC #1 STA NN LDA U \ Set X = U mod 8 AND #7 \ TAX \ So X contains the pixel number within two pixel bytes, \ i.e. in the range 0 to 7, as each pixel byte contains \ four pixels \ \ We pass this to the drawing routines so they start \ drawing from the correct pixel LDY N \ Set Y = N, which is the pitch angle of the previous \ edge \ By this point we have the following addresses set up: \ \ * (S R) = address of the first dash data block in \ the memory page containing the pixels at \ yaw angle M (as R = 0), i.e. of the \ previous edge \ \ * (Q P) = address of the second dash data block in \ the memory page containing the pixels at \ yaw angle M (as P = &80), i.e. of the \ previous edge \ \ * (NN MM) = address of the third dash data block in \ this sequence, i.e. the first memory \ page of the next dash data block (as \ NN = SS + 1) \ \ and the following variables: \ \ * X = pixel number (0 to 7) \ \ * Y = pitch angle of previous edge \ \ * UU = the number of the dash data block containing \ the previous edge, i.e. the dash data block \ where we start drawing the new edge \ \ * JJ = The right pixel byte when drawing the edge in \ the screen buffer, i.e. the fill byte to the \ right of the edge \ \ * RR = the pitch angle of the edge to draw, clipped \ to the range 0 to 79 (to map onto a track \ line)Name: DrawSegmentEdge (Part 5 of 7) [Show more] Type: Subroutine Category: Drawing the track Summary: Calculate the dash data block and screen addresses for the edge Deep Dive: Drawing the track vergesContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
This part calculates the dash data block for the edge, and the corresponding addresses within the screen buffer.
Configuration variable: dashData = &3000
The address of the first code block that gets swapped in and out of screen memory, along with parts of the dashboard image