Give the demo a real tune: the Anachronaut Labs theme

The composition is the user's - a leitmotif they already have variants of,
written into the note table by hand. It replaces the eight note scale that
was there to prove a note could be played at all, and it is a better demo
for the obvious reason and one less obvious one: it is long enough to hear
whether the machine keeps time, which a run of eight notes is not.

Forty five notes, 567 frames, 9.45 seconds, peaking at 19,461 of 32,767.
The test budget goes to twelve million cycles, which is a duration rather
than a guess: at 16,667 cycles a frame the music is 9.45 million, so there
is room to add bars before anybody has to come back here.

Also records what borrowing the screen's frame actually costs, which came
out of writing music rather than out of theory. The frame is not too slow,
it is FIXED: every duration is a whole number of 16.67 ms, so a note worth
a third of a beat cannot be written, and the way round it is choosing a
tempo whose subdivisions land on whole frames - making the tune fit the
machine. That is the argument for the timer peripheral wanting an arbitrary
tick rather than a faster fixed one, and for the screen not being the clock:
a display refresh and a music routine have no reason to share a rate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-08-29 22:33:33 -04:00
co-authored by Claude Opus 5
parent 85329f13c3
commit 2f22807458
2 changed files with 86 additions and 6 deletions
+10 -5
View File
@@ -52,11 +52,16 @@ frames | Examples/frames.asm | run | -
# picture draws a whole 320 by 200 bitmap and prints nothing, so what is recorded is only
# that it ran and what it cost. Tests/video.sh is where the pixels are checked.
picture | Examples/picture.asm | run | - | -
# tune plays eight notes and prints nothing, so what is recorded is that it ran, that it
# finished on its own, and how much of its time it spent asleep - which is nearly all of it,
# because the tempo is the screen's frame and a program waiting on a frame is not using the
# bus. Tests/sound.sh is where the samples are checked.
tune | Examples/tune.asm | run | - | 5000000
# tune plays the Anachronaut Labs theme and prints nothing, so what is recorded is that it
# ran, that it finished on its own, and how much of its time it spent asleep - which is
# 99.8% of it, because the tempo is the screen's frame and a program waiting on a frame is
# not using the bus. Tests/sound.sh is where the samples are checked.
#
# THE BUDGET IS A DURATION, and that is the thing to know if this ever fails. 567 frames of
# music at 16,667 cycles a frame is 9.45 million, so twelve leaves room to lengthen the tune
# without coming back here - and a failure saying "cycle limit reached" means somebody added
# bars, not that anything broke.
tune | Examples/tune.asm | run | - | 12000000
8bitSieve | Examples/primeSieve/8bitSieve.asm | run | - | -
16bitSegmentedSieve | Examples/primeSieve/16bitSieve.asm | run | - | -
# The four pointer rewrite. It emits exactly the same primes as the line above, which