.dvec3 \ If we get here then we need to step along the x-axis LDA QQ \ Set A = QQ + U CLC \ ADC U \ so A contains the cumulative step along the y-axis \ (the shorter axis) CMP T \ If A < T, then we haven't yet reached a full step of BCC dvec5 \ length T along the y-axis, so we don't change the \ y-coordinate and instead jump to dvec5 to do the step \ along the x-axis by one pixel \ We now need to step along the y-axis by one pixel as \ the cumulative step has just crossed over into a new \ multiple of T SBC T \ Set A = A - T \ \ so we keep the cumulative step within the bounds of a \ single byte (as we are only interested in when it \ crosses the boundary into a new multiple of T) \ We now move one pixel along the y-axis in the \ direction given in V BIT V \ If bit 6 of V is clear, jump to dvec4 to step along BVC dvec4 \ the y-axis in a positive direction DEC J \ Bit 6 of V is set, so decrement the y-coordinate in \ J so we move along the y-axis in a negative direction BVS dvec5 \ Jump to dvec5 to do the step along the x-axis by one \ pixel (this BVS is effectively a JMP as we know the V \ flag is set) .dvec4 INC J \ Bit 6 of V is clear, so increment the y-coordinate in \ J so we move along the y-axis in a positive direction .dvec5 STA QQ \ Store the updated fractional value in QQ \ We now move one pixel along the x-axis in the \ direction given in V BIT V \ If bit 7 of V is clear, jump to dvec6 to step along BPL dvec6 \ the x-axis in a positive direction DEC I \ Bit 7 of V is set, so decrement the x-coordinate in \ I so we move along the x-axis in a negative direction JMP dvec11 \ Now that we have moved (I, J) to the next pixel in the \ line, jump to dvec11 to plot the next pixel .dvec6 INC I \ Bit 7 of V is clear, so increment the x-coordinate in \ I so we move along the x-axis in a positive direction JMP dvec11 \ Now that we have moved (I, J) to the next pixel in the \ line, jump to dvec11 to plot the next pixel .dvec7 \ We jump here when we need to calculate the coordinates \ of the next pixel in the line when stepping along the \ longer delta axis one pixel at a time LDA PP \ If PP = 0 then this is a shallow horizontal slope, so BEQ dvec3 \ jump up to dvec3 step along the x-axis \ If we get here then this is a steep vertical line, so \ we need to step along the y-axis LDA QQ \ Set A = QQ + T CLC \ ADC T \ so A contains the cumulative step along the x-axis \ (the shorter axis) CMP U \ If A < U, then we haven't yet reached a full step of BCC dvec9 \ length U along the x-axis, so we don't change the \ x-coordinate and instead jump to dvec9 to do the step \ along the y-axis by one pixel \ We now need to step along the x-axis by one pixel as \ the cumulative step has just crossed over into a new \ multiple of U SBC U \ Set A = A - U \ \ so we keep the cumulative step within the bounds of a \ single byte (as we are only interested in when it \ crosses the boundary into a new multiple of U) \ We now move one pixel along the x-axis in the \ direction given in V BIT V \ If bit 7 of V is clear, jump to dvec8 to step along BPL dvec8 \ the x-axis in a positive direction DEC I \ Bit 7 of V is set, so decrement the x-coordinate in \ I so we move along the x-axis in a negative direction, \ i.e. to the left JMP dvec9 \ Jump to dvec9 to do the step along the y-axis by one \ pixel .dvec8 INC I \ Bit 7 of V is clear, so increment the x-coordinate in \ I so we move along the x-axis in a positive direction, \ i.e. to the right .dvec9 STA QQ \ Store the updated fractional value in QQ \ We now move one pixel along the y-axis in the \ direction given in V BIT V \ If bit 6 of V is clear, jump to dvec10 to step along BVC dvec10 \ the y-axis in a positive direction, i.e. up the screen DEC J \ Bit 6 of V is set, so decrement the y-coordinate in \ J so we move along the y-axis in a negative direction, \ i.e. down the screen BVS dvec11 \ Now that we have moved (I, J) to the next pixel in the \ line, jump to dvec11 to plot the next pixel (this BVS \ is effectively a JMP as we know the V flag is set) .dvec10 INC J \ Bit 6 of V is clear, so increment the y-coordinate in \ J so we move along the y-axis in a positive direction \ Now that we have moved (I, J) to the next pixel in the \ line, we fall through into part 3 to plot that pixelName: DrawVectorLine (Part 2 of 3) [Show more] Type: Subroutine Category: Drawing lines Summary: Calculate the coordinates of the next pixel as we step along the line by one pixelContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Label dvec10 is local to this routine
[X]
Label dvec11 in subroutine DrawVectorLine (Part 3 of 3)
[X]
Label dvec3 is local to this routine
[X]
Label dvec4 is local to this routine
[X]
Label dvec5 is local to this routine
[X]
Label dvec6 is local to this routine
[X]
Label dvec8 is local to this routine
[X]
Label dvec9 is local to this routine