Skip to navigation

Elite on the BBC Micro and NES

Version analysis of DIALS (Part 4 of 4)

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

Code variations between these versions are shown below.

Name: DIALS (Part 4 of 4) Type: Subroutine Category: Dashboard Summary: Update the dashboard: shields, fuel, laser & cabin temp, altitude Deep dive: The dashboard indicators

Code variation 1 of 9Related to the screen mode

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

LDA #&78 \ Set SC(1 0) = &7810, which is the screen address for STA SC+1 \ the character block containing the left end of the LDA #&10 \ top indicator in the left part of the dashboard, the STA SC \ one showing the forward shield
LDA #&70 \ Set SC(1 0) = &7020, which is the screen address for STA SC+1 \ the character block containing the left end of the LDA #&20 \ top indicator in the left part of the dashboard, the STA SC \ one showing the forward shield
LDA #&76 \ Set SC(1 0) = &7630, which is the screen address for STA SC+1 \ the character block containing the left end of the LDA #&30 \ top indicator in the left part of the dashboard, the STA SC \ one showing the forward shield
 LDA FSH                \ Draw the forward shield indicator using a range of
 JSR DILX               \ 0-255, and increment SC to point to the next indicator
                        \ (the aft shield)

 LDA ASH                \ Draw the aft shield indicator using a range of 0-255,
 JSR DILX               \ and increment SC to point to the next indicator (the
                        \ fuel level)

Code variation 2 of 9Related to the screen mode

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

LDA #YELLOW2 \ Set K (the colour we should show for high values) to STA K \ yellow STA K+1 \ Set K+1 (the colour we should show for low values) to \ yellow, so the fuel indicator always shows in this \ colour
 LDA QQ14               \ Draw the fuel level indicator using a range of 0-63,
 JSR DILX+2             \ and increment SC to point to the next indicator (the
                        \ cabin temperature)

Code variation 3 of 9Related to the screen mode

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

JSR PZW \ Call PZW to set A to the colour for dangerous values \ and X to the colour for safe values
JSR PZW2 \ Call PZW2 to set A to the colour for dangerous values \ and X to the colour for safe values, suitable for \ non-striped indicators
SEC \ Call NEXTR with the C flag set to move the screen JSR NEXTR \ address in SC(1 0) down by one character row

Code variation 4 of 9Related to the Electron version

The Electron version doesn't include suns, so although there is a cabin temperature indicator in the dashboard, it never registers any temperature increases as the relevant code is missing.

This variation is blank in the Electron version.

STX K+1 \ Set K+1 (the colour we should show for low values) to \ X (the colour to use for safe values) STA K \ Set K (the colour we should show for high values) to \ A (the colour to use for dangerous values) \ The above sets the following indicators to show red \ for high values and yellow/white for low values, which \ we use for the cabin and laser temperature bars LDX #11 \ Set T1 to 11, the threshold at which we change the STX T1 \ cabin and laser temperature indicators' colours LDA CABTMP \ Draw the cabin temperature indicator using a range of JSR DILX \ 0-255, and increment SC to point to the next indicator \ (the laser temperature)
 LDA GNTMP              \ Draw the laser temperature indicator using a range of
 JSR DILX               \ 0-255, and increment SC to point to the next indicator
                        \ (the altitude)

Code variation 5 of 9A variation in the comments only

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

LDA #240 \ Set T1 to 240, the threshold at which we change the STA T1 \ altitude indicator's colour. As the altitude has a \ range of 0-255, pixel 16 will not be filled in, and \ 240 would change the colour when moving between pixels \ 15 and 16, so this effectively switches off the colour \ change for the altitude indicator
LDA #240 \ Set T1 to 240, which would set the threshold at which STA T1 \ we change the altitude indicator's colour in the other \ versions, but it has no effect here, as the Electron \ version doesn't support indicator colour changes

Code variation 6 of 9Related to the screen mode

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

LDA #YELLOW2 \ Set K (the colour we should show for high values) to STA K \ yellow

Code variation 7 of 9Minor and very low-impact

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

STA K+1 \ Set K+1 (the colour we should show for low values) to \ 240, or &F0 (dashboard colour 2, yellow/white), so the \ altitude indicator always shows in this colour LDA ALTIT \ Draw the altitude indicator using a range of 0-255 JSR DILX
STA K+1 \ Set K+1 (the colour we should show for low values) to \ 240, or &F0 (dashboard colour 2, yellow/white), so the \ altitude indicator always shows in this colour LDA ALTIT \ Draw the altitude indicator using a range of 0-255, JMP DILX \ returning from the subroutine using a tail call
STA K+1 \ Set K+1 (the colour we should show for low values) to \ yellow, so the altitude indicator always shows in this \ colour LDA ALTIT \ Draw the altitude indicator using a range of 0-255, JMP DILX \ returning from the subroutine using a tail call
STA K+1 \ This sets K+1 to 240, which would set the colour to \ show for low values in the other versions, but it has \ no effect here, as the Electron version doesn't \ support indicator colour changes LDA ALTIT \ Draw the altitude indicator using a range of 0-255 JSR DILX

Code variation 8 of 9Specific to an individual platform

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

LDA #%00001001 \ Clear bits 1 and 2 of the Access Control Register at STA VIA+&34 \ SHEILA &34 to switch main memory back into &3000-&7FFF

Code variation 9 of 9Specific to an individual platform

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

JMP COMPAS \ We have now drawn all the indicators, so jump to \ COMPAS to draw the compass, returning from the \ subroutine using a tail call