Skip to navigation


Dashboard: DIALS (Part 4 of 4)

[Commodore 64 version]

Name: DIALS (Part 4 of 4) [Show more] Type: Subroutine Category: Dashboard Summary: Update the dashboard: shields, fuel, laser & cabin temp, altitude Deep dive: The dashboard indicators
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
LDA #LO(DLOC%+8*6) ; Set SC(1 0) to the screen bitmap address for the STA SC ; character block containing the left end of the top LDA #HI(DLOC%+8*6) ; indicator in the left part of the dashboard, the one STA SC+1 ; showing the forward shield ; ; DLOC% is the screen address of the dashboard (which ; starts on character row 18) so this sets the address ; to character 8 on that row LDA #YELLOW ; 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 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) 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) JSR PZW ; Call PZW to set A to the colour for dangerous values ; and X to the colour for safe values 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) 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 ;STA K+1 ; This instruction is commented out in the original ; source LDA ALTIT ; Draw the altitude indicator using a range of 0-255 JSR DILX 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