Skip to navigation

Aviator on the BBC Micro

Drawing lines: DrawClippedLine (Part 6 of 6)

Name: DrawClippedLine (Part 6 of 6) [Show more] Type: Subroutine Category: Drawing lines Summary: Add the clipped line to the line buffer and draw it
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
LDA colourCycle \ If bit 7 of colourCycle is set, i.e. %11110000, jump BMI draw23 \ jump down to draw23 to add a line to buffer 1 LDX lineBuffer2Count \ If lineBuffer2Count <> 95, line buffer 2 is not full, CPX #95 \ so jump down to draw22 to add a new line to the buffer BNE draw22 RTS \ Return from the subroutine .draw22 INX \ Increment the value in lineBuffer2Count as we are STX lineBuffer2Count \ about to add a new line to line buffer 2 JMP draw25 \ Jump down to draw25 to buffer the line and draw it .draw23 LDX lineBuffer1Count \ If lineBuffer1Count <> 47, line buffer 1 is not full, CPX #47 \ so jump down to draw24 to add a new line to the buffer BNE draw24 RTS \ Return from the subroutine .draw24 INX \ Increment the value in lineBuffer1Count as we are STX lineBuffer1Count \ about to add a new line to line buffer 1 .draw25 LDA R \ Save the start x-coordinate in lineBufferR STA lineBufferR,X LDA W \ Save the max/min x-coordinate in lineBufferW STA lineBufferW,X LDA S \ Save the start y-coordinate in lineBufferS STA lineBufferS,X LDA G \ Save the max/min y-coordinate in lineBufferG STA lineBufferG,X LDA T \ Save the |x-delta| in lineBufferT STA lineBufferT,X LDA U \ Save the |y-delta| in lineBufferU STA lineBufferU,X LDA V \ Save the direction in lineBufferV STA lineBufferV,X \ Fall through into DrawCanopyLine to draw the line