Files
SplitBit-Emulator/Programs/testPrograms/pauseTest.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

48 lines
916 B
NASM

; A program that takes a while and makes no sound.
;
; Fixture. Something has to happen after a program that left a note sounding has stopped, or
; there is nothing for the sound device to be measured DURING: the machine halts the moment
; the shell runs out of input, and a note quietened at that instant leaves no samples behind
; to say whether it was quietened at all.
;
; So this burns about two million cycles and exits. Two nested counts and a third around
; them, because a byte only reaches 256 and a fifth of a second is a great deal more than
; that.
;
; Written by Anachronaut
#Include services.asm
#Program
#Base 0x5000
start:
INIA 0d16
outer:
PSHA ; The outer count, which the inner ones need A for.
RSTB
middle:
RSTA
inner:
DECA
BNA inner
DECB
BNB middle
POPA
DECA
BNA outer
SWI osExit
#Data
#Base 0x3000
Unused:
0x00
#Vectors
Boot start