A quarter-tank warning that says it once, and a gauge that keeps saying it
Two halves of the same number. The warning is the moment it happened and the colour is how things stand: it fires on the way down through a quarter of a tank and then holds its peace, and the gauge stays red until a base fills the lander up, which also allows the warning again. Once, because a lander is at its most careful in the last few seconds before it touches, and something repeating in its ear through that is not a warning, it is a distraction. Checked where the fuel actually moves rather than once a frame - the tank only changes in takeFuel and payFuel, so there is nowhere else it can cross a threshold. Channel two, with the crash on three. Separate channels rather than one reused, because a crash while the warning is still sounding should not cut it off, and on a machine with four voices there is no reason to be clever. Half and a tenth are the obvious next thresholds and are deliberately not here: one is enough to find out whether being told at all is welcome. ---- And the crash sound is the one that was designed for it ---- Crash.json, which carries voice_gate itself, so the program's own trigger write is gone - it would have masked a deliberate choice rather than backing one up. The note moved from 24 to 60 by ear, and the comment saying it was low went with it. ---- A check that could not tell a beep from a nag ---- Counting bursts of sound cannot: without the latch the warning fires every tick the tank drops, far faster than the sound decays, so the beeps run into each other and a burst counter sees one long burst either way. It measures the LENGTH now - 26,944 samples against 490,348 - which is the difference between six tenths of a second and ten seconds of it.
This commit is contained in:
@@ -80,7 +80,8 @@ start:
|
||||
CALL putLander
|
||||
CALL putGauge
|
||||
CALL putOrbital
|
||||
CALL putBoom ; The instrument, once, the way the tiles are.
|
||||
CALL putBoom ; The instruments, once, the way the tiles are.
|
||||
CALL putAlarm
|
||||
|
||||
INIA 0x01
|
||||
OUTA 0x02 ; Key mode.
|
||||
@@ -602,6 +603,25 @@ putGauge:
|
||||
; Redrawn whole every frame. Thirty five cells is seventy bytes out of one port with the
|
||||
; address named once, which is cheaper than working out which of them changed.
|
||||
showFuel:
|
||||
; ---- Green above a quarter, red below it ----
|
||||
;
|
||||
; The same number the alarm goes off at, so the sound and the picture agree. The sound is
|
||||
; said once and this stays said, which is the division of labour: one of them is the moment
|
||||
; it happened and the other is how things stand.
|
||||
SETD.1 Fuel
|
||||
LDA.1
|
||||
INIB 0d64
|
||||
CCF
|
||||
SUB
|
||||
BNC showFuelGreen
|
||||
INIA 0x01
|
||||
BRI showFuelColoured
|
||||
showFuelGreen:
|
||||
INIA 0x02
|
||||
showFuelColoured:
|
||||
SETD.1 GaugeColour
|
||||
STA.1
|
||||
|
||||
RSTA
|
||||
SETD.1 Fuel
|
||||
LDB.1
|
||||
@@ -629,8 +649,9 @@ gaugeCell:
|
||||
STA.1
|
||||
INIA 0xC8
|
||||
OUTA 0xE9 ; The solid block, which is the ground's tile.
|
||||
INIA 0x02
|
||||
OUTA 0xE9 ; Scheme two, so the bar is not the colour of the moon.
|
||||
SETD.1 GaugeColour
|
||||
LDA.1
|
||||
OUTA 0xE9 ; Green, or red once a quarter is all that is left.
|
||||
BRI gaugeNext
|
||||
gaugeEmpty:
|
||||
OUTA 0xE9
|
||||
@@ -1140,6 +1161,7 @@ takeFuel:
|
||||
BRA takeFuelNone
|
||||
DECA
|
||||
STA.1
|
||||
CALL watchFuel ; Checked where the tank actually moves, not once a frame.
|
||||
INIA 0x01
|
||||
RSTB
|
||||
CCF
|
||||
@@ -2682,20 +2704,6 @@ putBoom:
|
||||
OUTA 0x41 ; Channel three. Every parameter write below lands on it.
|
||||
SETD.0 BoomPatch
|
||||
CALL playPatch
|
||||
|
||||
; ---- Struck, not held ----
|
||||
;
|
||||
; A gated voice lasts as long as something keeps hold of it, and the gate coming up is what
|
||||
; starts its release - which is what a keyboard is. A crash is not a keyboard. It is struck
|
||||
; once and then plays its own length, and nothing should have to remember to end it.
|
||||
;
|
||||
; Said here rather than left to the patch because it is the PROGRAM that knows this is a
|
||||
; one-shot: the patch decides what the bang sounds like, and this decides that it is a bang.
|
||||
; A patch designed in soundThing carries a gate of its own, and this overrides it on purpose.
|
||||
INIA 0x51
|
||||
OUTA 0x42
|
||||
INIA 0x01 ; Triggered.
|
||||
OUTA 0x43
|
||||
RET
|
||||
|
||||
; ---- A whole patch, out of a table ----
|
||||
@@ -2725,10 +2733,56 @@ playPatchOne:
|
||||
boom:
|
||||
INIA 0x03
|
||||
OUTA 0x41
|
||||
INIA 0d24 ; Low: the filter is doing the work and this is only the body.
|
||||
INIA 0d60 ; Middle C. The noise is not really pitched, but the filter is
|
||||
; tuned off the note and this is where it was found by ear.
|
||||
OUTA 0x44 ; Writing the note is what starts it.
|
||||
RET
|
||||
|
||||
; ---- A quarter of a tank, said once ----
|
||||
;
|
||||
; ONCE, and that is the whole design of it. A lander is at its most careful in the last few
|
||||
; seconds before it touches, and something repeating in its ear through that is not a warning,
|
||||
; it is a distraction - so this fires on the way DOWN through a quarter and then holds its
|
||||
; peace. Filling up at a base allows it again.
|
||||
;
|
||||
; A quarter is 64 of 255. Half and a tenth are the obvious next two and are not here yet: one
|
||||
; threshold is enough to find out whether being told at all is welcome.
|
||||
watchFuel:
|
||||
SETD.0 AlarmSaid
|
||||
LDA.0
|
||||
BNA watchFuelDone ; Already said. Saying it again is what this exists to avoid.
|
||||
SETD.0 Fuel
|
||||
LDA.0
|
||||
INIB 0d64
|
||||
CCF
|
||||
SUB
|
||||
BNC watchFuelDone ; No borrow: a quarter or more, so there is nothing to say.
|
||||
INIA 0x01
|
||||
SETD.0 AlarmSaid
|
||||
STA.0
|
||||
CALL alarm
|
||||
watchFuelDone:
|
||||
RET
|
||||
|
||||
; ---- The alarm, on channel two ----
|
||||
;
|
||||
; Effects count down from the top: the bang has three and this has two. They are separate
|
||||
; channels rather than one reused, because a crash while the warning is still sounding should
|
||||
; not cut it off - and on a machine with four voices there is no reason to be clever about it.
|
||||
putAlarm:
|
||||
INIA 0x02
|
||||
OUTA 0x41
|
||||
SETD.0 AlarmPatch
|
||||
CALL playPatch
|
||||
RET
|
||||
|
||||
alarm:
|
||||
INIA 0x02
|
||||
OUTA 0x41
|
||||
INIA 0d72 ; An octave over middle C, which is where a warning lives.
|
||||
OUTA 0x44
|
||||
RET
|
||||
|
||||
; ---- A key, or a button ----
|
||||
;
|
||||
; Somebody flying on a controller should not have to reach for the keyboard to say "yes, I
|
||||
@@ -3309,6 +3363,11 @@ arriveNowhere:
|
||||
; worth of adding is what says it went past, which is the same flag a sixteen bit sum uses to
|
||||
; run one half into the other.
|
||||
payFuel:
|
||||
; Filled up, so the warning is allowed to come again. Eighty units always clears a quarter
|
||||
; tank, so this needs no test of its own.
|
||||
RSTA
|
||||
SETD.0 AlarmSaid
|
||||
STA.0
|
||||
SETD.0 Fuel
|
||||
LDA.0
|
||||
INIB 0d80
|
||||
@@ -3613,6 +3672,11 @@ FallAt:
|
||||
; more arithmetic for a number nobody reads to the unit.
|
||||
Fuel:
|
||||
0xFF
|
||||
GaugeColour:
|
||||
0x00
|
||||
; Whether the quarter tank warning has been given since the last time it was filled.
|
||||
AlarmSaid:
|
||||
0x00
|
||||
GaugeLeft:
|
||||
0x00
|
||||
GaugeAt:
|
||||
@@ -4093,3 +4157,5 @@ LanderArtAt:
|
||||
#Include math.asm
|
||||
|
||||
#Include boom.asm
|
||||
|
||||
#Include alarm.asm
|
||||
|
||||
Reference in New Issue
Block a user