diff --git a/Programs/CosmOS/Apps/Lander.asm b/Programs/CosmOS/Apps/Lander.asm index 545fe6b..2a3a43e 100644 --- a/Programs/CosmOS/Apps/Lander.asm +++ b/Programs/CosmOS/Apps/Lander.asm @@ -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 diff --git a/Programs/CosmOS/README.md b/Programs/CosmOS/README.md index 926fc55..5626344 100644 --- a/Programs/CosmOS/README.md +++ b/Programs/CosmOS/README.md @@ -727,7 +727,7 @@ from every assembly file in it. Several are old programs written for the bare ma | Grid | The first program to use the screen as a screen. Redefines a tile above the font, fills all 128 map rows, and scrolls it diagonally a pixel at a time. | | Sprite | Moves a ball across the shell's own text, writing not one byte of the map to do it. It leaves the sprite in the table on the way out, because clearing them is the system's job - see below. | | Pad | Says what the controllers are doing, printing a line whenever one changes. It tells apart the three things that look identical from inside a game that is not responding: a pad nobody noticed, a pad mapped to nothing, and a mapping that is wrong. | -| Lander | Lunar Porter, rung one: a lander over a moon that wraps. Flown with a controller if there is one - a held thruster burns every tick it is held for - and with the arrow keys if there is not, where one press is one burn and that is the most the console can say. A bar at the bottom is the sideways drift, drawn as a sprite stretched to the speed - a moon has no air, so a drift never stops by itself and stopping one means cancelling it exactly, which is hard to do blind. It lands or crashes on arrival, and what decides is the speed at the moment it touches: gentler than three quarters of a pixel a frame downwards and half of one sideways, or it is a lander on its side. A fuel gauge sits in the window layer, where the moon turning underneath cannot scroll it away, and every thruster costs a unit of fuel every tick it fires. An empty tank is not an ending: it is a lander still flying that can no longer do anything about where. Four landing pads are carved into the moon after it is generated, levelled to whatever height their first column happened to have, and marked in cyan by an attribute rather than a tile of their own. The lander starts above one, because that is where a porter's day begins. Each pad is a base, told apart by the colour it is drawn in, and landing at one either loads cargo for the base across the moon or delivers what is aboard and pays eighty units of fuel. A landing is not an ending: the lander rests where it is until the throttle opens again, and A or Start says "read it" as readily as a key does. What a base says goes in the window rather than out of the console: the console draws into the map, so a message printed while flying is one the lander then flies over, and printing scrolls the whole world up a row. Opening the throttle wipes the line. Two bars read the speeds and are green while a landing would survive and red while it would not, so "can I put down" is a glance rather than a sum. A third runs up the left edge and is how much sky is under the lander, half a pixel of bar to a pixel of it; it reads nought the moment the lander is down, and it exists because the orbit takes the lander off the top of the screen and a panel that only works while the ground is in sight is no use above it. And gravity here is the pull MINUS the swing outwards, which is what makes an orbit rather than a one way trip: under four pixels a frame sideways the pull wins and the lander falls, over it the swing wins and the lander climbs, and at it they cancel and it circles. Falling buys sideways speed and climbing spends it - at a rate set by the product of the two, so the trade stops by itself as the sideways speed runs out - and that is the cycle: a fall carries the lander past orbital speed and becomes a climb, the climb pays it back and becomes a fall, periapse and apoapse, round and round. Orbital speed is marked on the drift bar, sixty four pixels either side of the middle, because a number nothing points at is folklore. Gravity never falls off and the moon wraps, so a circular orbit is the same length at any height and one orbital speed serves everywhere. There is a ceiling 192 pixels above the world's origin, which is the top of the wide view - it was sixty four while sixty four was all the sky a forty column screen had over the origin, which was a fact about the view rather than about the world. It pins rather than ends: leaving upward is recoverable, so the lander is held there and told so, and one sideways is spent every tick it tries to climb - without that the pin wiped the climb, the trade saw neither fall nor climb, and the speed pushing it up never changed. What kills you out here is running dry a long way from the ground. B, or z on the keyboard, swaps the screen between forty columns and eighty, which is the same map, the same cells and the same engine at half the size: nearly two thirds of the moon at once for the orbit, and twice as big for the landing. The twenty extra rows that buys go to the SKY and not to the moon - the wide view starts twenty four rows above the world's origin rather than at it, so the ground sits near the bottom and the whole flyable band is on the screen. Drawn down from the origin instead it was 71 per cent rock, which is a zoom that shows you more of the thing you cannot fly through. A lander at the ceiling is off the top of a forty column screen, which is where the orbit lives and why the altitude bar had to exist; zoomed out it is in the picture. And there is a station up there, twelve rows above the world's origin - about two thirds of the way from the ground to the ceiling, clear of work near the surface - going round at orbital speed - which needs no physics of its own, because a body at 64 sixteenths is exactly what a circular orbit IS under these rules, at any height, since gravity never falls off and the moon wraps. It is off the top of a forty column screen too, so it is somewhere to go that the zoom is needed to see. Docking it is landing on something that is moving: close enough, and slow enough RELATIVE TO THE STATION, or it is a wreck. Its speed is orbital speed, which is the number the marks on the drift bar point at, so the instrument for it was on the screen before there was anything to dock with. A dock pays eighty units of fuel and holds the lander a tile under the station until a thruster lets go, sliding it into line at half a pixel a frame rather than snapping - a dock is allowed eight pixels out either way, so putting the lander exactly in place the instant it took hold moved it a whole tile in one frame, right at the moment the player was being told they had been careful. It settles squarely under the port, which it did not used to: the lander is drawn from half a screen LESS HALF A TILE, because that is what centres it, and the station was drawn from half a screen exactly, so a perfectly flown dock still looked four pixels out. Getting there is a two burn manoeuvre and not a straight line: climbing SPENDS sideways speed, so a lander cannot rise while matched - it arrives slower than orbital every time, and has to raise the far side of its orbit and then circularise at the top. Which is also why it reads /lander.state if the disk has one: sixteen bytes of position, velocity, station, fuel and screen, laid straight over the numbers it would otherwise start with, so a rendezvous can be examined without flying one first. A disk without the file is the game as it always was. The buffer is a whole block wide because osFileRead lands a file in blocks of 256, and sixteen bytes of room for it wrote over everything that followed. A landing kicks up dust, sideways and up off the lander's feet, because that is where kicked dust goes and there is ground in the way of the rest of it. Letting go of the station vents gas instead, evenly in every direction, since nothing is in the way of a docking port - and that one does NOT stop the world the way the others do, because it goes off on the frame a thruster is pressed and freezing then would be felt as the controls sticking. There is none on docking: a dock is a catch and not a touchdown, and there is nothing under it to kick. A lander also has to get two tiles clear of the station before it can take hold of it again, because a docked one sits exactly one tile under it - so letting go upwards docked it straight back on, took the fuel again, and sat waiting to be told the message had been read. A crash also makes a noise, which is the first sound this game has, and it is a TRIGGERED voice - struck once and then playing its own length, so nothing has to come back and end it. That the program says so rather than the patch is deliberate: the patch decides what the bang sounds like and the program decides that it is a bang. It is noise through a low pass that the modulation envelope shuts as the level falls, so the bright part is only at the front and it is a boom rather than a hiss. The instrument is built at startup the way the tiles are, because a patch is twenty odd writes and a note is two - which is what the selector and value registers are for. It plays on channel THREE: effects count down from the top so that music, if it ever arrives, can take nought and count up and the two never have to negotiate. A crash takes the lander apart: it goes, and six pieces of it leave in a rough hexagon at its own colour for about a second before the verdict is said. It used to be a line of text and a lander still sitting there in one piece, so a watcher had to read the words to know what had happened. The world is not running while that plays - it is a loop of its own, so nothing else has to know how to be half destroyed. A plume hangs off whichever side the engine is pushing from - under the lander to lift, over it to retro, and on the far side from the way it is being pushed sideways, since that is where the gas leaves. Every other reading here is a number drawn as a bar and all of them say what is happening TO the lander, so without this a watcher has to read gauges to work out that a thruster is even lit. It is drawn while the BUTTON IS HELD rather than while the engine fires: the engine fires one frame in ten, because that is the tick gravity is applied on, and a flame that honest is a fault lamp rather than a rocket. An empty tank draws none, and neither does the retro thruster on the ground, because in both cases the button really is doing nothing. Down is a retro thruster at half the strength of up - one sixteenth a tick against two, which is exactly gravity's own step, so it can stop a climb and hurry a descent and can never turn a landing approach into a crash faster than letting go would. Arresting a rise otherwise meant a sideways burn and a wait for the orbit to come round, which is how a rendezvous really is flown and a lot to ask of somebody who has not flown one. It does nothing at all to a lander on the ground, which is not politeness: touchdown has already had its say and will not speak again, so without that guard a landed lander holding it goes straight through the moon. | +| Lander | Lunar Porter, rung one: a lander over a moon that wraps. Flown with a controller if there is one - a held thruster burns every tick it is held for - and with the arrow keys if there is not, where one press is one burn and that is the most the console can say. A bar at the bottom is the sideways drift, drawn as a sprite stretched to the speed - a moon has no air, so a drift never stops by itself and stopping one means cancelling it exactly, which is hard to do blind. It lands or crashes on arrival, and what decides is the speed at the moment it touches: gentler than three quarters of a pixel a frame downwards and half of one sideways, or it is a lander on its side. A fuel gauge sits in the window layer, where the moon turning underneath cannot scroll it away, and every thruster costs a unit of fuel every tick it fires. It turns from green to red at a quarter of a tank, and a warning sounds ONCE on the way down through it - once, because a lander is at its most careful in the last seconds before it touches and something repeating in its ear through that is a distraction rather than a warning. Filling up at a base allows it again. The sound is the moment it happened and the colour is how things stand, and both come off the same number so they cannot disagree. An empty tank is not an ending: it is a lander still flying that can no longer do anything about where. Four landing pads are carved into the moon after it is generated, levelled to whatever height their first column happened to have, and marked in cyan by an attribute rather than a tile of their own. The lander starts above one, because that is where a porter's day begins. Each pad is a base, told apart by the colour it is drawn in, and landing at one either loads cargo for the base across the moon or delivers what is aboard and pays eighty units of fuel. A landing is not an ending: the lander rests where it is until the throttle opens again, and A or Start says "read it" as readily as a key does. What a base says goes in the window rather than out of the console: the console draws into the map, so a message printed while flying is one the lander then flies over, and printing scrolls the whole world up a row. Opening the throttle wipes the line. Two bars read the speeds and are green while a landing would survive and red while it would not, so "can I put down" is a glance rather than a sum. A third runs up the left edge and is how much sky is under the lander, half a pixel of bar to a pixel of it; it reads nought the moment the lander is down, and it exists because the orbit takes the lander off the top of the screen and a panel that only works while the ground is in sight is no use above it. And gravity here is the pull MINUS the swing outwards, which is what makes an orbit rather than a one way trip: under four pixels a frame sideways the pull wins and the lander falls, over it the swing wins and the lander climbs, and at it they cancel and it circles. Falling buys sideways speed and climbing spends it - at a rate set by the product of the two, so the trade stops by itself as the sideways speed runs out - and that is the cycle: a fall carries the lander past orbital speed and becomes a climb, the climb pays it back and becomes a fall, periapse and apoapse, round and round. Orbital speed is marked on the drift bar, sixty four pixels either side of the middle, because a number nothing points at is folklore. Gravity never falls off and the moon wraps, so a circular orbit is the same length at any height and one orbital speed serves everywhere. There is a ceiling 192 pixels above the world's origin, which is the top of the wide view - it was sixty four while sixty four was all the sky a forty column screen had over the origin, which was a fact about the view rather than about the world. It pins rather than ends: leaving upward is recoverable, so the lander is held there and told so, and one sideways is spent every tick it tries to climb - without that the pin wiped the climb, the trade saw neither fall nor climb, and the speed pushing it up never changed. What kills you out here is running dry a long way from the ground. B, or z on the keyboard, swaps the screen between forty columns and eighty, which is the same map, the same cells and the same engine at half the size: nearly two thirds of the moon at once for the orbit, and twice as big for the landing. The twenty extra rows that buys go to the SKY and not to the moon - the wide view starts twenty four rows above the world's origin rather than at it, so the ground sits near the bottom and the whole flyable band is on the screen. Drawn down from the origin instead it was 71 per cent rock, which is a zoom that shows you more of the thing you cannot fly through. A lander at the ceiling is off the top of a forty column screen, which is where the orbit lives and why the altitude bar had to exist; zoomed out it is in the picture. And there is a station up there, twelve rows above the world's origin - about two thirds of the way from the ground to the ceiling, clear of work near the surface - going round at orbital speed - which needs no physics of its own, because a body at 64 sixteenths is exactly what a circular orbit IS under these rules, at any height, since gravity never falls off and the moon wraps. It is off the top of a forty column screen too, so it is somewhere to go that the zoom is needed to see. Docking it is landing on something that is moving: close enough, and slow enough RELATIVE TO THE STATION, or it is a wreck. Its speed is orbital speed, which is the number the marks on the drift bar point at, so the instrument for it was on the screen before there was anything to dock with. A dock pays eighty units of fuel and holds the lander a tile under the station until a thruster lets go, sliding it into line at half a pixel a frame rather than snapping - a dock is allowed eight pixels out either way, so putting the lander exactly in place the instant it took hold moved it a whole tile in one frame, right at the moment the player was being told they had been careful. It settles squarely under the port, which it did not used to: the lander is drawn from half a screen LESS HALF A TILE, because that is what centres it, and the station was drawn from half a screen exactly, so a perfectly flown dock still looked four pixels out. Getting there is a two burn manoeuvre and not a straight line: climbing SPENDS sideways speed, so a lander cannot rise while matched - it arrives slower than orbital every time, and has to raise the far side of its orbit and then circularise at the top. Which is also why it reads /lander.state if the disk has one: sixteen bytes of position, velocity, station, fuel and screen, laid straight over the numbers it would otherwise start with, so a rendezvous can be examined without flying one first. A disk without the file is the game as it always was. The buffer is a whole block wide because osFileRead lands a file in blocks of 256, and sixteen bytes of room for it wrote over everything that followed. A landing kicks up dust, sideways and up off the lander's feet, because that is where kicked dust goes and there is ground in the way of the rest of it. Letting go of the station vents gas instead, evenly in every direction, since nothing is in the way of a docking port - and that one does NOT stop the world the way the others do, because it goes off on the frame a thruster is pressed and freezing then would be felt as the controls sticking. There is none on docking: a dock is a catch and not a touchdown, and there is nothing under it to kick. A lander also has to get two tiles clear of the station before it can take hold of it again, because a docked one sits exactly one tile under it - so letting go upwards docked it straight back on, took the fuel again, and sat waiting to be told the message had been read. A crash also makes a noise, which is the first sound this game has, and it is a TRIGGERED voice - struck once and then playing its own length, so nothing has to come back and end it. That the program says so rather than the patch is deliberate: the patch decides what the bang sounds like and the program decides that it is a bang. It is noise through a low pass that the modulation envelope shuts as the level falls, so the bright part is only at the front and it is a boom rather than a hiss. The instrument is built at startup the way the tiles are, because a patch is twenty odd writes and a note is two - which is what the selector and value registers are for. It plays on channel THREE: effects count down from the top so that music, if it ever arrives, can take nought and count up and the two never have to negotiate. A crash takes the lander apart: it goes, and six pieces of it leave in a rough hexagon at its own colour for about a second before the verdict is said. It used to be a line of text and a lander still sitting there in one piece, so a watcher had to read the words to know what had happened. The world is not running while that plays - it is a loop of its own, so nothing else has to know how to be half destroyed. A plume hangs off whichever side the engine is pushing from - under the lander to lift, over it to retro, and on the far side from the way it is being pushed sideways, since that is where the gas leaves. Every other reading here is a number drawn as a bar and all of them say what is happening TO the lander, so without this a watcher has to read gauges to work out that a thruster is even lit. It is drawn while the BUTTON IS HELD rather than while the engine fires: the engine fires one frame in ten, because that is the tick gravity is applied on, and a flame that honest is a fault lamp rather than a rocket. An empty tank draws none, and neither does the retro thruster on the ground, because in both cases the button really is doing nothing. Down is a retro thruster at half the strength of up - one sixteenth a tick against two, which is exactly gravity's own step, so it can stop a climb and hurry a descent and can never turn a landing approach into a crash faster than letting go would. Arresting a rise otherwise meant a sideways burn and a wait for the orbit to come round, which is how a rendezvous really is flown and a lot to ask of somebody who has not flown one. It does nothing at all to a lander on the ground, which is not politeness: touchdown has already had its say and will not speak again, so without that guard a landed lander holding it goes straight through the moon. | | Depth | Four pillars at four distances and a ball walking past them, behind the near ones and in front of the far ones. The ball is sprite nought and every pillar is numbered after it, so table order puts it in front of all four - what actually decides is the depth buffer, asked a column at a time. | | Flip | Draws a whole screen into the bank that is not being shown, waits, and then shows it in one byte out of one port. It writes nothing else at all - not a tile, not a colour - so it does not ask for the screen to be saved, and the line it printed is still there when it comes back. It deliberately does not put the displayed screen back either, because that is the system's to restore: a program that faulted while flipped could not have. | | Edit | A line editor. | diff --git a/Programs/Sounds/Crash1.json b/Programs/Sounds/Crash.json similarity index 96% rename from Programs/Sounds/Crash1.json rename to Programs/Sounds/Crash.json index c38cb9d..7209831 100644 --- a/Programs/Sounds/Crash1.json +++ b/Programs/Sounds/Crash.json @@ -34,9 +34,11 @@ "lfo0_rate": 8.796101, "lfo0_waveform": 0, "lfo0_active": 0, + "lfo0_mode": 0, "lfo1_rate": 1.000000, "lfo1_waveform": 0, "lfo1_active": 0, + "lfo1_mode": 0, "filter_cutoff": 13294.700195, "filter_resonance": 0.574200, "filter_type": 0, @@ -46,6 +48,7 @@ "filter_resModRouting": 0, "filter_resModDepth": 0.000000, "voice_levelSource": 2, + "voice_gate": 1, "master_volume": 1.000000, "master_pitchBendRange": 2.000000 } diff --git a/Programs/Sounds/alarm.asm b/Programs/Sounds/alarm.asm new file mode 100644 index 0000000..3285bc0 --- /dev/null +++ b/Programs/Sounds/alarm.asm @@ -0,0 +1,58 @@ +; AlarmPatch, converted from Programs/Sounds/LowFuel.json by SoundPatch. +; Designed in soundThing, where it can be heard. Do not edit the numbers +; here: change the patch and convert it again. + +#Data + +AlarmPatch: + 0d50 ; how many pairs follow + 0x00 0d1 ; oscillator 0, waveform + 0x01 0d255 ; gain + 0x02 0d128 ; duty + 0x03 0d128 ; detune, in cents + 0x04 0d130 ; octave + 0x05 0d1 ; on + 0x06 0d0 ; what moves its width + 0x07 0d128 ; and how far + 0x08 0d3 ; what moves its pitch + 0x09 0d83 ; and how far + 0x0A 0d1 ; what moves its gain + 0x0B 0d255 ; and how far + 0x10 0d1 ; oscillator 1, waveform + 0x11 0d255 ; gain + 0x12 0d128 ; duty + 0x13 0d128 ; detune, in cents + 0x14 0d128 ; octave + 0x15 0d1 ; on + 0x16 0d0 ; what moves its width + 0x17 0d128 ; and how far + 0x18 0d3 ; what moves its pitch + 0x19 0d83 ; and how far + 0x1A 0d1 ; what moves its gain + 0x1B 0d255 ; and how far + 0x20 0d4 ; amplitude envelope, attack + 0x21 0d97 ; decay + 0x22 0d255 ; sustain + 0x23 0d33 ; release + 0x30 0d9 ; modulation envelope, attack + 0x31 0d90 ; decay + 0x32 0d0 ; sustain + 0x33 0d40 ; release + 0x40 0d0 ; filter, on + 0x41 0d0 ; type: 0 low, 1 high, 2 band + 0x42 0d221 ; cutoff, in hertz + 0x43 0d0 ; resonance + 0x44 0d0 ; what moves the cutoff + 0x45 0d128 ; and how far, in hertz + 0x46 0d0 ; what moves the resonance + 0x47 0d128 ; and how far + 0x60 0d1 ; LFO 0, on + 0x61 0d2 ; waveform + 0x62 0d180 ; rate, in hertz + 0x63 0d1 ; 0 free, 1 starts with a voice + 0x70 0d0 ; LFO 1, on + 0x71 0d0 ; waveform + 0x72 0d127 ; rate, in hertz + 0x73 0d0 ; 0 free, 1 starts with a voice + 0x50 0d1 ; what shapes the level + 0x51 0d1 ; 0 gated, 1 triggered diff --git a/Programs/Sounds/boom.asm b/Programs/Sounds/boom.asm index a12c77f..38c12f5 100644 --- a/Programs/Sounds/boom.asm +++ b/Programs/Sounds/boom.asm @@ -1,11 +1,11 @@ -; BoomPatch, converted from Programs/Sounds/Crash1.json by SoundPatch. +; BoomPatch, converted from Programs/Sounds/Crash.json by SoundPatch. ; Designed in soundThing, where it can be heard. Do not edit the numbers ; here: change the patch and convert it again. #Data BoomPatch: - 0d47 ; how many pairs follow + 0d50 ; how many pairs follow 0x00 0d5 ; oscillator 0, waveform 0x01 0d255 ; gain 0x02 0d128 ; duty @@ -49,7 +49,10 @@ BoomPatch: 0x60 0d0 ; LFO 0, on 0x61 0d0 ; waveform 0x62 0d220 ; rate, in hertz + 0x63 0d0 ; 0 free, 1 starts with a voice 0x70 0d0 ; LFO 1, on 0x71 0d0 ; waveform 0x72 0d127 ; rate, in hertz + 0x73 0d0 ; 0 free, 1 starts with a voice 0x50 0d2 ; what shapes the level + 0x51 0d1 ; 0 gated, 1 triggered diff --git a/Tests/expected/cosmosCrossDisk.out b/Tests/expected/cosmosCrossDisk.out index 5675367..42adce2 100644 --- a/Tests/expected/cosmosCrossDisk.out +++ b/Tests/expected/cosmosCrossDisk.out @@ -25,7 +25,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosDrives.out b/Tests/expected/cosmosDrives.out index b14e538..54bf7f2 100644 --- a/Tests/expected/cosmosDrives.out +++ b/Tests/expected/cosmosDrives.out @@ -15,7 +15,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosFault.out b/Tests/expected/cosmosFault.out index c78ed48..884fd10 100644 --- a/Tests/expected/cosmosFault.out +++ b/Tests/expected/cosmosFault.out @@ -32,7 +32,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosFlip.out b/Tests/expected/cosmosFlip.out index c742305..77d1b5a 100644 --- a/Tests/expected/cosmosFlip.out +++ b/Tests/expected/cosmosFlip.out @@ -22,7 +22,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosGrid.out b/Tests/expected/cosmosGrid.out index 6edccb9..b81d74e 100644 --- a/Tests/expected/cosmosGrid.out +++ b/Tests/expected/cosmosGrid.out @@ -22,7 +22,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosMonitor.out b/Tests/expected/cosmosMonitor.out index e3dc5be..1040880 100644 --- a/Tests/expected/cosmosMonitor.out +++ b/Tests/expected/cosmosMonitor.out @@ -108,7 +108,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosMonitorRun.out b/Tests/expected/cosmosMonitorRun.out index 636d1fe..4fe773b 100644 --- a/Tests/expected/cosmosMonitorRun.out +++ b/Tests/expected/cosmosMonitorRun.out @@ -27,7 +27,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosRun.out b/Tests/expected/cosmosRun.out index f77fae1..938fc3e 100644 --- a/Tests/expected/cosmosRun.out +++ b/Tests/expected/cosmosRun.out @@ -15,7 +15,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosSlowDisk.out b/Tests/expected/cosmosSlowDisk.out index 1647cce..c5124e2 100644 --- a/Tests/expected/cosmosSlowDisk.out +++ b/Tests/expected/cosmosSlowDisk.out @@ -13,7 +13,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/expected/cosmosSprite.out b/Tests/expected/cosmosSprite.out index 373322f..e2841e6 100644 --- a/Tests/expected/cosmosSprite.out +++ b/Tests/expected/cosmosSprite.out @@ -22,7 +22,7 @@ Mode.sbx 48 Flip.sbx 173 Sprite.sbx 442 Depth.sbx 672 -Lander.sbx 8409 +Lander.sbx 8608 Pad.sbx 264 Crash.sbx 632 vars.script 50 diff --git a/Tests/video.sh b/Tests/video.sh index e462b00..53162a2 100755 --- a/Tests/video.sh +++ b/Tests/video.sh @@ -2714,6 +2714,70 @@ EOT && result ok "and it is loudest at the front" "which is what makes it a bang" \ || result no "and it is loudest at the front" "louder in the second half than the first" +# ---- A quarter of a tank, said once ---- +# +# ONCE 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 it fires on the way DOWN through a quarter tank and then holds its peace, +# and filling up at a base allows it again. +# +# The gauge says the same thing the other way round: the sound is the moment it happened, the +# colour is how things stand. Both off the same number, so they cannot disagree. +python3 -c " +import struct +# Seventy of two hundred and fifty five, which is a few ticks of thruster above the quarter. +open('$BUILD/lowfuel.state','wb').write(struct.pack(' /dev/null +python3 -c "open('$BUILD/burn.pad','wb').write(b'\x08' * 40000)" +for when in 1700000 2400000; do + timeout 60 "$EMU" --fast --cycles $when --keyboard "$BUILD/fly.keys" \ + --pad "$BUILD/burn.pad" --screen "$BUILD/fuel$when.ppm" \ + --disk "$BUILD/lowfuel.img" --ram-disk 2048 \ + "$BUILD/cosmos.bin" > "$BUILD/fuel.out" 2>&1 || true +done +timeout 60 "$EMU" --fast --cycles 12000000 --keyboard "$BUILD/fly.keys" \ + --pad "$BUILD/burn.pad" --sound "$BUILD/warn.raw" \ + --disk "$BUILD/lowfuel.img" --ram-disk 2048 \ + "$BUILD/cosmos.bin" > "$BUILD/warn.out" 2>&1 || true +read -r ABOVE BELOW WARNINGS < 300] +span = (loud[-1] - loud[0]) if loud else 0 +print(gauge('$BUILD/fuel1700000.ppm'), gauge('$BUILD/fuel2400000.ppm'), span) +" 2>/dev/null || echo "none none -1") +EOT +# Green cells then red cells, and none of the other colour either time. +[ "$ABOVE" = "8,0" ] && [ "$BELOW" = "0,7" ] \ + && result ok "the fuel gauge goes red at a quarter" "eight green became seven red" \ + || result no "the fuel gauge goes red at a quarter" "$ABOVE above, $BELOW below" +# Twelve seconds of holding the thruster, which empties the tank entirely and keeps it empty. +# The warning is under a second of that, or it is a nag rather than a warning. +[ "$WARNINGS" -gt 0 ] && [ "$WARNINGS" -lt 48000 ] \ + && result ok "and the warning sounds once, not once a tick" "$WARNINGS samples of it in twelve seconds of running dry" \ + || result no "and the warning sounds once, not once a tick" "$WARNINGS samples of warning" + # ---- Dust on landing, and gas on letting go ---- # # The same six pieces as the explosion, thrown differently: dust goes sideways and UP off the