Skip to navigation

Elite on the BBC Micro and NES

Version analysis of TT103

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

Code variations between these versions are shown below.

Name: TT103 Type: Subroutine Category: Charts Summary: Draw a small set of crosshairs on a chart
Draw a small set of crosshairs on a galactic chart at the coordinates in (QQ9, QQ10).
.TT103

Code variation 1 of 3Related to the Master version

The moveable chart crosshairs in the Master version are drawn with white/yellow vertical stripes (with the exception of the static crosshairs on the Long-range Chart, which are white). All crosshairs are white in the other versions.

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

LDA #GREEN \ Switch to stripe 3-1-3-1, which is white/yellow in the STA COL \ chart view
 LDA QQ11               \ Fetch the current view type into A

Code variation 2 of 3Other (e.g. bug fix, optimisation)

The cassette version doesn't draw crosshairs in routine TT103 if this is a space view, but the other versions don't do this check, so perhaps it isn't required?

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

BEQ TT180 \ If this is a space view, return from the subroutine \ (as TT180 contains an RTS), as there are no moveable \ crosshairs in space
 BMI TT105              \ If this is the Short-range Chart screen, jump to TT105

Code variation 3 of 3Related to the Master version

Master version contains code to scale the crosshairs on the chart views, though it has no effect in this version. The code is left over from the non-BBC versions, which needed to be able to scale the charts to fit their different-sized screens.

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

LDA QQ9 \ Store the crosshairs x-coordinate in QQ19 STA QQ19 LDA QQ10 \ Halve the crosshairs y-coordinate and store it in QQ19 LSR A \ (we halve it because the Long-range Chart is half as STA QQ19+1 \ high as it is wide)
LDA QQ9 \ Store the crosshairs x-coordinate in QQ19 JSR SCALEX \ STA QQ19 \ The call to SCALEX has no effect as it only contains \ an RTS, but having this call instruction here would \ enable different scaling to be applied by altering \ the SCALE routines. This code is left over from the \ conversion to other platforms, where the scale factor \ might need to be different LDA QQ10 \ Halve the crosshairs y-coordinate and store it in QQ19 JSR SCALEY \ (we halve it because the Long-range Chart is half as STA QQ19+1 \ high as it is wide) \ \ The call to SCALEY simply does an LSR A, but having \ this call instruction here would enable different \ scaling to be applied by altering the SCALE routines. \ This code is left over from the conversion to other \ platforms, where the scale factor might need to be \ different
 LDA #4                 \ Set QQ19+2 to 4 denote crosshairs of size 4
 STA QQ19+2

 JMP TT15               \ Jump to TT15 to draw crosshairs of size 4 at the
                        \ crosshairs coordinates, returning from the subroutine
                        \ using a tail call