Files
SplitBit-Emulator/Programs/testPrograms/humTest.asm
T
AnachronautandClaude Opus 5 f9b08cf7f9 CosmOS lets every voice go when a program stops
A gate is a register on the sound device and only a program can drop one.
A program that has stopped cannot: it is gone. So a note left held
sustained until something else said otherwise, and nothing else did -
one program could leave the machine sounding for as long as it ran, with
nothing the person at it could do.

The shell already puts back the Stack, the vectors, the drive, the
working directory and the screen. This is the same list and the same
argument, and the fault path calls it too, for the stronger version of
the argument: a program that CRASHED is exactly the one that cannot tidy
up after itself, and a machine that will not stop humming is a poor place
to read an error message.

It does not make the device silent at once and does not pretend to.
Dropping a gate RELEASES a note rather than stopping it, so the patch's
release still runs. A bounded tail rather than an endless one is the part
the system can be responsible for without knowing what instrument the
program had built.

Hum exits while holding a note; Pause makes no sound and takes a couple
of million cycles, because the machine stops the moment the shell runs
out of input and a note quietened at that instant leaves no samples
behind to say whether it was. They are on a disk of their own so that a
fixture does not move the ten recordings that quote cosmos.img's listing.

THE CHECK CAUGHT ITSELF PASSING WRONGLY FIRST. Pause was missing from the
disk, the machine halted immediately, and the window that should have
held the tail was past the end of a render a twentieth of a second long -
an empty window's peak is nought, which is indistinguishable from silence.
So the sample count is asserted before anything is read from it. Verified
with break.sh: without the call the note is still ringing at 9869.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
2026-09-05 18:54:46 -04:00

71 lines
1.6 KiB
NASM

; A program that stops while a note is still held down.
;
; The gate is a register on the sound device, and only a program can drop one. This one does
; not: it starts a note whose envelope sustains at full and then hands the machine back, so
; the note is left sounding with nothing left in the world able to end it.
;
; WHAT SHOULD HAPPEN IS THAT COSMOS ENDS IT, the way it puts the screen back and the drive and
; the vectors - and for a stronger reason, since a program that faults cannot tidy up after
; itself either. Without that this note sustains for as long as the machine runs.
;
; Sustain at full and a short release, so the difference between the two answers is loud: a
; gate left up rings for ever and a gate dropped is quiet within a fraction of a second.
;
; Written by Anachronaut
#Include services.asm
#Program
#Base 0x5000
start:
RSTA
OUTA 0x41 ; Channel 0
OUTA 0x42
INIA 0d2
OUTA 0x43 ; Saw
INIA 0x01
OUTA 0x42
INIA 0xFF
OUTA 0x43 ; at full gain
INIA 0x05
OUTA 0x42
INIA 0x01
OUTA 0x43 ; and on.
INIA 0x20
OUTA 0x42
RSTA
OUTA 0x43 ; No attack
INIA 0x21
OUTA 0x42
RSTA
OUTA 0x43 ; no decay
INIA 0x22
OUTA 0x42
INIA 0xFF
OUTA 0x43 ; and held at full, for ever, until a gate says otherwise.
INIA 0x23
OUTA 0x42
INIA 0d5
OUTA 0x43 ; A short release, so a dropped gate is quiet almost at once.
INIA 0xC0
OUTA 0x46
INIA 0d60
OUTA 0x44 ; Middle C, started and never let go of.
SWI osExit
#Data
#Base 0x3000
Unused:
0x00
#Vectors
Boot start