Skip to navigation


Drawing lines: NLIN2

[Commodore 64 version]

Name: NLIN2 [Show more] Type: Subroutine Category: Drawing lines Summary: Draw a screen-wide horizontal line at the pixel row in A
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * NLIN4 calls NLIN2 * TT22 calls NLIN2

This draws a line from (0, A) to (255, A), which runs across the whole screen.
Arguments: A The pixel row on which to draw the horizontal line
.NLIN2 STA Y1 ; Set Y1 = A STA Y2 ; Set Y2 = A ;LDA #YELLOW ; These instructions are commented out in the original ;JSR DOCOL ; source LDX #0 ; Set X1 = 0, so (X1, Y1) = (0, A) STX X1 DEX ; Set X2 = 255, so (X2, Y2) = (255, A) STX X2 JMP LL30 ; Call LL30 to draw a line from (0, A) to (255, A), ; returning from the subroutine using a tail call ;LDA #CYAN ; These instructions are commented out in the original ;JMP DOCOL ; source ;RTS