Skip to navigation


Drawing lines: NLIN2

[BBC Master 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 Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * NLIN4 calls NLIN2

This draws a line from (2, A) to (254, A), which is almost screen-wide and fits in nicely between the white borders without clashing with it.
Arguments: A The pixel row on which to draw the horizontal line
.NLIN2 STA Y1 \ Set Y1 = A LDA #YELLOW \ Switch to colour 1, which is yellow STA COL LDX #2 \ Set X1 = 2, so (X1, Y1) = (2, A) STX X1 LDX #254 \ Set X2 = 254, so (X2, Y2) = (254, A) STX X2 JSR HLOIN3 \ Call HLOIN3 to draw a line from (2, A) to (254, A) LDA #CYAN \ Switch to colour 3, which is cyan or white STA COL RTS \ Return from the subroutine