Skip to navigation

Elite on the BBC Micro and NES

Version analysis of NLIN2

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: NLIN2 Type: Subroutine Category: Drawing lines Summary: Draw a screen-wide horizontal line at the pixel row in A
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

Code variation 1 of 4Related to Elite's use of the Tube

This variation is blank in the Cassette, Disc (flight), Disc (docked), Master and Electron versions.

STA Y2 \ Set Y2 = A

Code variation 2 of 4Related to the screen mode

This variation is blank in the Cassette, Disc (flight), Disc (docked) and Electron versions.

Tap on a block to expand it, and tap it again to revert.

LDA #YELLOW \ Switch to colour 1, which is yellow STA COL
LDA #YELLOW \ Send a #SETCOL YELLOW command to the I/O processor to JSR DOCOL \ switch to colour 1, which is yellow
 LDX #2                 \ Set X1 = 2, so (X1, Y1) = (2, A)
 STX X1

 LDX #254               \ Set X2 = 254, so (X2, Y2) = (254, A)
 STX X2

Code variation 3 of 4Related to Elite's use of the Tube

Tap on a block to expand it, and tap it again to revert.

BNE HLOIN \ Call HLOIN to draw a horizontal line from (2, A) to \ (254, A) and return from the subroutine (this BNE is \ effectively a JMP as A will never be zero)
JSR HLOIN3 \ Call HLOIN3 to draw a line from (2, A) to (254, A)
JSR LL30 \ Call LL30 to draw a line from (2, A) to (254, A)
\ Fall through into HLOIN to draw a horizontal line from \ (2, A) to (254, A) and return from the subroutine

Code variation 4 of 4Related to the screen mode

This variation is blank in the Cassette, Disc (flight), Disc (docked) and Electron versions.

Tap on a block to expand it, and tap it again to revert.

LDA #CYAN \ Switch to colour 3, which is cyan or white STA COL RTS \ Return from the subroutine
LDA #CYAN \ Send a #SETCOL CYAN command to the I/O processor to JMP DOCOL \ switch to colour 3, which is cyan or white