Skip to navigation


Dashboard: DIALS (Part 1 of 4)

[Commodore 64 version]

Name: DIALS (Part 1 of 4) [Show more] Type: Subroutine Category: Dashboard Summary: Update the dashboard: speed indicator Deep dive: The dashboard indicators
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * Main game loop (Part 5 of 6) calls DIALS * wantdials calls DIALS

This routine updates the dashboard. First we draw all the indicators in the right part of the dashboard, from top (speed) to bottom (energy banks), and then we move on to the left part, again drawing from top (forward shield) to bottom (altitude). This first section starts us off with the speedometer in the top right.
.DIALS LDA #LO(DLOC%+8*30) ; 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*30) ; indicator in the right part of the dashboard, the one STA SC+1 ; showing our speed ; ; DLOC% is the screen address of the dashboard (which ; starts on character row 18) so this sets the address ; to character 30 on that row 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 LDA #14 ; Set T1 to 14, the threshold at which we change the STA T1 ; indicator's colour LDA DELTA ; Fetch our ship's speed into A, in the range 0-40 ;LSR A ; Draw the speed indicator using a range of 0-31, and JSR DIL-1 ; increment SC to point to the next indicator (the roll ; indicator). The LSR is commented out as it isn't ; required with a call to DIL-1, so perhaps this was ; originally a call to DIL that got optimised