Skip to navigation


Drawing lines: DrawCanopyLine (Part 5 of 9)

Name: DrawCanopyLine (Part 5 of 9) [Show more] Type: Subroutine Category: Drawing lines Summary: Draw a part of the line, working up the screen
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file

The code in this routine is modified by the ModifyDrawRoutine, and by the DrawCanopyLine routine itself. The default code (i.e. the unmodified version in the source) is run when: * The current colour cycle is drawing in colour 1, using the pixel bitmaps at colour1L2R and OR logic for updating the screen
.dlin27 \ This routine draws a part of a line (one pixel row, \ i.e. a byte) and moves us up to the previous pixel row \ \ We call this subroutine with: \ \ * A = the current slope error \ \ * X = the index of the pixel byte at colour1R2L STA SS \ Set SS = A .dlin28 LDA colour1R2L,X \ Fetch the X-th pixel byte from colour1R2L \ \ Gets modified by the ModifyDrawRoutine routine: \ \ * LDA colour1R2L,X when colourLogic = %10000000 \ \ * LDA colour2R2L,X when colourLogic = %01000000 \ \ * LDA colour1Row,X when colourLogic = %00000000 \ and colourCycle = %00001111 \ \ * LDA colour2Row,X when colourLogic = %00000000 \ and colourCycle = %11110000 \ \ In other words, this instruction has already been \ modified to implement the current colour cycle .dlin29 ORA (P),Y \ OR the pixel byte with the current screen contents \ \ Gets modified by the ModifyDrawRoutine routine: \ \ * ORA (P),Y when colourLogic = %01000000 \ \ * AND (P),Y when colourLogic = %00000000 \ \ In other words, this instruction has already been \ modified to implement the current drawing logic STA (P),Y \ Update the Y-th byte of (Q P) with the result, which \ sets 4 pixels to the pixel pattern in A .dlin30 LDA P \ Set (Q P) = (Q P) - 8 SEC \ SBC #8 \ starting with the low bytes STA P BCS dlin31 \ And then the high bytes, so (Q P) now points to the DEC Q \ previous character block to the left .dlin31 DEC QQ \ Decrement QQ, which contains the current character \ block number LDA QQ \ If QQ <> I, then we haven't yet reached the right edge CMP I \ of the screen (whose character block number we set in BNE dlin12 \ I in part 2), so jump back to dlin12 to keep drawing \ the line JMP dlin65 \ Otherwise we have reached the edge of the screen, so \ jump to dlin65 to process the clipped part of the \ line, if applicable