A voice starts pointed at its track, without code to point it

There is no assembler bug. I reported one and was wrong.

A label written in the Data Segment does come out as its address, two
bytes, most significant first - implemented in populateOutputBuffers,
documented in the Assembler Manual, and correct. What misled me was the
test I checked it with: the label was the first thing in an unbased
Data Segment, so its address really was 0x0000, and I read the right
answer as an unfilled placeholder.

So Play was doing at run time what the assembler had already offered to
do at assembly time. The voice records now carry their track labels
directly, which is exactly the shape LDD reads, and nothing relocates on
this machine so the address written is the address it will have. That
takes out startVoice, its four call sites, and the eight SETDs that fed
them: 450 bytes to 379, and the initial state of a voice is now
something you can read rather than something you have to follow the code
to work out.

The comment claiming otherwise is gone from Play.asm, and the same
change is made in fourVoiceTest.

The music is unchanged - bar by bar the render matches to within one per
cent, which is the program loading a shade sooner because it is smaller.
Ten recordings moved for the same reason: 446 to 379, and nothing else.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-09-05 15:24:02 -04:00
co-authored by Claude Opus 5
parent 79d1e2639b
commit 1687422619
12 changed files with 29 additions and 68 deletions
+5 -17
View File
@@ -43,13 +43,6 @@ start:
OUTA 0x51
SIF
SETD.1 Voice0
SETD.0 Track0
CALL startVoice
SETD.1 Voice1
SETD.0 Track1
CALL startVoice
; Twelve ticks. B survives the calls below, because a CALL saves it.
INIB 0d12
tickLoop:
@@ -110,14 +103,6 @@ stepVoice:
stepDone:
RET
; DP1 a voice, DP0 its track. A count of one, so the first pass fetches the first event.
startVoice:
STD.0.1
DPUP.1 0d2
INIA 0d1
STA.1
RET
; Held at full and released quickly, so a note lasts exactly its ticks and the boundary
; between two of them is something a counter can find.
setUpChannel:
@@ -157,10 +142,13 @@ tick:
#Data
; Cursor high, cursor low, count, spare. A label written here comes out as its address, most
; significant first, which is the shape LDD reads - so a voice starts pointed at its track
; with no code at all. The count starts at one so the first pass runs it out and fetches.
Voice0:
0x00 0x00 0x00 0x00
Track0 0d1 0d0
Voice1:
0x00 0x00 0x00 0x00
Track1 0d1 0d0
ThisChannel:
0x00