Skip to navigation

Elite on the BBC Micro

Version analysis of TTX66 / TTX662

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

Code variations between these versions are shown below.

Code variation 1 of 25A variation in the comments only

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, 6502SP, Electron

Master

Name: TTX66
Name: TTX662
Type: Subroutine Category: Utility routines

Code variation 2 of 25A variation in the comments only

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, Master, Electron

6502SP

Summary: Clear the top part of the screen and draw a white border
Summary: Send control code 11 to the I/O processor to clear the top part of the screen and draw a white border

Clear the top part of the screen (the space view) and draw a white border along the top and sides.

Code variation 3 of 25A variation in the comments only

This variation is blank in the Disc (docked) and Master versions.

Cassette, Flight, 6502SP, Electron

Other entry points: BOX Just draw the border and (if this is a space view) the view name. This can be used to remove the border and view name, as it is drawn using EOR logic

Code variation 4 of 25A variation in the comments only

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

Electron

BORDER Just draw the border

Code variation 5 of 25A variation in the comments only

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

Docked

Other entry points: BOL1-1 Contains an RTS

Code variation 6 of 25A variation in the labels only

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, 6502SP, Electron

Master

.TTX66
.TTX662 JSR TTX66 \ Call TTX66 to clear the top part of the screen and \ draw a white border

Code variation 7 of 25Related to an enhanced feature

The default case for enhanced text tokens is Sentence Case.

See below for more variations related to this code.

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

Docked, 6502SP, Master

JSR MT2 \ Switch to Sentence Case when printing extended tokens

Code variation 8 of 25Related to Elite's use of the Tube

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

Tap on a version to expand it, and tap it again to show to all variations.

Master

6502SP

LDA #0 \ Reset the ball line heap pointer at LSP STA LSP
JSR PBZE \ Reset the pixel buffer size in PBUP JSR HBZE \ Reset the horizontal line buffer size in HBUP STZ LBUP \ Reset the line buffer size at LBUP STZ LSP \ Reset the ball line heap pointer at LSP
 LDA #%10000000         \ Set bit 7 of QQ17 to switch to Sentence Case
 STA QQ17

Code variation 9 of 25Related to an enhanced feature

See variation 7 above for details.

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

Docked, 6502SP, Master

STA DTW2 \ Set bit 7 of DTW2 to indicate we are not currently \ printing a word

Code variation 10 of 25Specific to an individual platform

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

Flight, 6502SP, Master

JSR FLFLLS \ Call FLFLLS to reset the LSO block

Code variation 11 of 25Related to the screen mode

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

6502SP

LDA #YELLOW \ Send a #SETCOL YELLOW command to the I/O processor to JSR DOCOL \ switch to colour 2, which is yellow

Code variation 12 of 25Specific to an individual platform

Tap on a version to expand it, and tap it again to show to all variations.

Cassette

Docked

Flight

Master

6502SP

Electron

IF _SOURCE_DISC ASL A \ Set LASCT to 0, as 128 << 1 = %10000000 << 1 = 0. This STA LASCT \ stops any laser pulsing ELIF _TEXT_SOURCES ASL A \ Set LAS2 to 0, as 128 << 1 = %10000000 << 1 = 0. This STA LAS2 \ stops any laser pulsing ENDIF
ASL A \ Set LASCT to 0, as 128 << 1 = %10000000 << 1 = 0. This STA LASCT \ stops any laser pulsing
STA LAS2 \ Set LAS2 = 0 to stop any laser pulsing (the call to \ FLFLLS sets A = 0)
LDA #0 \ Set LAS2 = 0 to stop any laser pulsing STA LAS2
STZ LAS2 \ Set LAS2 = 0 to stop any laser pulsing
ASL A \ Set LAS2 to 0, as 128 << 1 = %10000000 << 1 = 0. This STA LAS2 \ stops any laser pulsing

Code variation 13 of 25Minor and very low-impact

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, Master, Electron

6502SP

STA DLY \ Set the delay in DLY to 0, to indicate that we are \ no longer showing an in-flight message, so any new \ in-flight messages will be shown instantly STA de \ Clear de, the flag that appends " DESTROYED" to the \ end of the next text token, so that it doesn't
STZ DLY \ Set the delay in DLY to 0, to indicate that we are \ no longer showing an in-flight message, so any new \ in-flight messages will be shown instantly STZ de \ Clear de, the flag that appends " DESTROYED" to the \ end of the next text token, so that it doesn't

Code variation 14 of 25Related to Elite's use of the Tube

This variation is blank in the Master version.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked

6502SP

Electron

LDX #&60 \ Set X to the screen memory page for the top row of the \ screen (as screen memory starts at &6000) .BOL1 JSR ZES1 \ Call ZES1 to zero-fill the page in X, which clears \ that character row on the screen INX \ Increment X to point to the next page, i.e. the next \ character row CPX #&78 \ Loop back to BOL1 until we have cleared page &7700, BNE BOL1 \ the last character row in the space view part of the \ screen (the top part)
LDA #11 \ Send control code 11 to OSWRCH, to instruct the I/O JSR OSWRCH \ processor to clear the top part of the screen
LDX #&58 \ Call LYN with X = &58 to clear the screen from page JSR LYN \ &58 to page &75, which clears the whole screen (as \ screen memory starts at &5800)

Code variation 15 of 25A variation in the labels only

This variation is blank in the Disc (docked) version.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Electron

6502SP, Master

LDX QQ22+1 \ Fetch into X the number that's shown on-screen during \ the hyperspace countdown BEQ BOX \ If the counter is zero then we are not counting down \ to hyperspace, so jump to BOX to skip the next \ instruction JSR ee3 \ Print the 8-bit number in X at text location (0, 1), \ i.e. print the hyperspace countdown in the top-left \ corner .BOX
LDX QQ22+1 \ Fetch into X the number that's shown on-screen during \ the hyperspace countdown BEQ OLDBOX \ If the counter is zero then we are not counting down \ to hyperspace, so jump to OLDBOX to skip the next \ instruction JSR ee3 \ Print the 8-bit number in X at text location (0, 1), \ i.e. print the hyperspace countdown in the top-left \ corner .OLDBOX

Code variation 16 of 25Related to Elite's use of the Tube

This variation is blank in the Master version.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, Electron

6502SP

LDY #1 \ Move the text cursor to row 1 STY YC
LDA #1 \ Move the text cursor to column 1 JSR DOYC
 LDA QQ11               \ If this is not a space view, jump to tt66 to skip
 BNE tt66               \ displaying the view name

Code variation 17 of 25Related to Elite's use of the Tube

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, Electron

Master

6502SP

LDY #11 \ Move the text cursor to row 11 STY XC
LDA #11 \ Move the text cursor to row 11 STA XC
LDA #11 \ Move the text cursor to row 11 JSR DOXC

Code variation 18 of 25Related to the screen mode

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

Tap on a version to expand it, and tap it again to show to all variations.

Master

6502SP

LDA #CYAN \ Switch to colour 3, which is cyan in the space view STA COL
LDA #CYAN \ Send a #SETCOL CYAN command to the I/O processor to JSR DOCOL \ switch to colour 3, which is cyan in the space view
 LDA VIEW               \ Load the current view into A:
                        \
                        \   0 = front
                        \   1 = rear
                        \   2 = left
                        \   3 = right

 ORA #&60               \ OR with &60 so we get a value of &60 to &63 (96 to 99)

 JSR TT27               \ Print recursive token 96 to 99, which will be in the
                        \ range "FRONT" to "RIGHT"

 JSR TT162              \ Print a space

 LDA #175               \ Print recursive token 15 ("VIEW ")
 JSR TT27

.tt66

Code variation 19 of 25Specific to an individual platform

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

6502SP

LDA #1 \ Move the text cursor to column 1, row 1 JSR DOXC JSR DOYC LDX #0 \ Set QQ17 = 0 to switch to ALL CAPS STX QQ17 RTS \ Return from the subroutine .BOX

Code variation 20 of 25Related to the screen mode

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

6502SP

LDA #YELLOW \ Send a #SETCOL YELLOW command to the I/O processor to JSR DOCOL \ switch to colour 2, which is yellow

Code variation 21 of 25Related to Elite's use of the Tube

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked

Master

6502SP

Electron

LDX #0 \ Set (X1, Y1) to (0, 0) STX X1 STX Y1 STX QQ17 \ Set QQ17 = 0 to switch to ALL CAPS
LDX #0 \ Set QQ17 = 0 to switch to ALL CAPS STX QQ17
LDX #0 \ Set QQ17 = 0 to switch to ALL CAPS STX QQ17 STX X1 \ Set (X1, Y1) to (0, 0) STX Y1 STX Y2 \ Set Y2 = 0
LDX #0 \ Set QQ17 = 0 to switch to ALL CAPS STX QQ17 .BORDER LDX #0 \ Set (X1, Y1) to (0, 0) STX X1 STX Y1

Code variation 22 of 25Related to Elite's use of the Tube

This variation is blank in the Master version.

Cassette, Flight, Docked, 6502SP, Electron

DEX \ Set X2 = 255 STX X2

Code variation 23 of 25Related to Elite's use of the Tube

This variation is blank in the Master version.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, Electron

6502SP

JSR HLOIN \ Draw a horizontal line from (X1, Y1) to (X2, Y1), so \ that's (0, 0) to (255, 0), along the very top of the \ screen
JSR LL30 \ Draw a line from (X1, Y1) to (X2, Y2), so that's \ (0, 0) to (255, 0), along the very top of the screen

Code variation 24 of 25Specific to an individual platform

This variation is blank in the Master version.

Cassette, Flight, Docked, 6502SP, Electron

LDA #2 \ Set X1 = X2 = 2 STA X1 STA X2 JSR BOS2 \ Call BOS2 below, which will call BOS1 twice, and then \ fall through into BOS2 again, so we effectively do \ BOS1 four times, decrementing X1 and X2 each time \ before calling LOIN, so this whole loop-within-a-loop \ mind-bender ends up drawing these four lines: \ \ (1, 0) to (1, 191) \ (0, 0) to (0, 191) \ (255, 0) to (255, 191) \ (254, 0) to (254, 191) \ \ So that's a 2-pixel wide vertical border along the \ left edge of the upper part of the screen, and a \ 2-pixel wide vertical border along the right edge .BOS2 JSR BOS1 \ Call BOS1 below and then fall through into it, which \ ends up running BOS1 twice. This is all part of the \ loop-the-loop border-drawing mind-bender explained \ above .BOS1 LDA #0 \ Set Y1 = 0 STA Y1 LDA #2*Y-1 \ Set Y2 = 2 * #Y - 1. The constant #Y is 96, the STA Y2 \ y-coordinate of the mid-point of the space view, so \ this sets Y2 to 191, the y-coordinate of the bottom \ pixel row of the space view DEC X1 \ Decrement X1 and X2 DEC X2

Code variation 25 of 25Specific to an individual platform

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Docked, Electron

Master

6502SP

JMP LOIN \ Draw a line from (X1, Y1) to (X2, Y2), and return from \ the subroutine using a tail call
RTS \ Return from the subroutine
JMP LL30 \ Draw a line from (X1, Y1) to (X2, Y2), and return from \ the subroutine using a tail call
RSS Feed