.PZW LDX #YELLOW ; Set X to dashboard colour yellow LDA MCNT ; A will be non-zero for 8 out of every 16 main loop AND #%00001000 ; counts, when bit 4 is set, so this is what we use to ; flash the "danger" colour AND FLH ; A will be zeroed if flashing colours are disabled BEQ P%+4 ; If A is zero, skip to the LDA instruction below TXA ; Otherwise flashing colours are enabled and it's the ; main loop iteration where we flash them, so set A to ; dashboard colour yellow and use the BIT trick below to ; return from the subroutine EQUB $2C ; Skip the next instruction by turning it into ; $2C $A9 $0F, or BIT $0FA9, which does nothing apart ; from affect the flags LDA #RED ; Set A to dashboard colour red RTS ; Return from the subroutineName: PZW [Show more] Type: Subroutine Category: Dashboard Summary: Fetch the current dashboard colours, to support flashingContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DIALS (Part 1 of 4) calls PZW * DIALS (Part 3 of 4) calls PZW * DIALS (Part 4 of 4) calls PZW
Set A and X to the colours we should use for indicators showing dangerous and safe values respectively. This enables us to implement flashing indicators, which is one of the game's configurable options. If flashing is enabled, the colour returned in A (dangerous values) will be red for 8 iterations of the main loop, and yellow for the next 8, before going back to red. If we always use PZW to decide which colours we should use when updating indicators, flashing colours will be automatically taken care of for us. The values returned are #YELLOW for yellow and #RED for red.
Returns: A The colour to use for indicators with dangerous values X The colour to use for indicators with safe values
[X]
Variable FLH in workspace Option variables
Flashing console bars configuration setting
[X]
Configuration variable RED = %01010101
Four multicolour bitmap mode pixels of colour %01, which is mapped to the danger colour for the dashboard dials, or red on the scanner, via the colour mapping in sdump (high nibble)
[X]
Configuration variable YELLOW = %10101010
Four multicolour bitmap mode pixels of colour %10, which is mapped to the normal indicator colour for the dashboard dials, or yellow on the scanner, via the colour mapping in sdump (low nibble)