diff --git a/Programs/CosmOS/Apps/Play.asm b/Programs/CosmOS/Apps/Play.asm index 81373b8..f4c6477 100644 --- a/Programs/CosmOS/Apps/Play.asm +++ b/Programs/CosmOS/Apps/Play.asm @@ -37,10 +37,6 @@ ; first because that is what LDD and STD move - a pointer through a pointer, which is the ; whole reason this can be a loop over four voices instead of the same code written out four ; times. -; -; The counts start at one rather than zero, so the first pass through the loop runs every -; voice's count out and fetches its first event. Nothing has to be special-cased for the -; beginning, and the piece starts on the tick rather than one after it. #Include services.asm @@ -81,27 +77,6 @@ start: OUTA 0x51 ; Run, repeat, interrupt. SIF - ; ---- The voices, pointed at their tracks ---- - ; - ; The cursors are written here rather than assembled into the table, because a label used - ; as data does not come out as its address. - SETD.1 Voice0 - SETD.0 Track0 - CALL startVoice - SETD.1 Voice1 - SETD.0 Track1 - CALL startVoice - SETD.1 Voice2 - SETD.0 Track2 - CALL startVoice - SETD.1 Voice3 - SETD.0 Track3 - CALL startVoice - - INIA 0d4 - SETD.1 Playing - STA.1 ; Four tracks still running. - ; ---- The loop ---- ; ; Step every voice, see whether any of them is still going, and then sleep. Stepping before @@ -200,17 +175,6 @@ stepEnded: STA.3 RET -; DP1 is a voice and DP0 its track. Sets the cursor, and a count of one so that the first -; pass through the loop fetches the first event. -startVoice: - STD.0.1 - DPUP.1 0d2 - INIA 0d1 - STA.1 ; Count: one tick, which runs out immediately. - INCD.1 - STA.1 ; Live. - RET - ; A plucked sound, on the channel named by A. setUpChannel: OUTA 0x41 @@ -258,17 +222,26 @@ tick: #Base 0x3000 ; Four bytes a voice: cursor high, cursor low, count, live. +; +; A LABEL WRITTEN HERE COMES OUT AS ITS ADDRESS, two bytes, most significant first - which is +; exactly the shape LDD reads. So a voice starts pointed at its track without a line of code: +; nothing relocates on this machine, so the address the assembler wrote is the address it +; will have. +; +; The count starts at one rather than zero so that the first pass through the loop runs it out +; and fetches the first event. Nothing has to be special-cased for the beginning, and the +; piece starts on the tick rather than one after it. Voice0: - 0x00 0x00 0x00 0x00 + Track0 0d1 0d1 Voice1: - 0x00 0x00 0x00 0x00 + Track1 0d1 0d1 Voice2: - 0x00 0x00 0x00 0x00 + Track2 0d1 0d1 Voice3: - 0x00 0x00 0x00 0x00 + Track3 0d1 0d1 Playing: - 0x00 + 0d4 ThisChannel: 0x00 diff --git a/Programs/testPrograms/fourVoiceTest.asm b/Programs/testPrograms/fourVoiceTest.asm index 5ace985..9f6ce83 100644 --- a/Programs/testPrograms/fourVoiceTest.asm +++ b/Programs/testPrograms/fourVoiceTest.asm @@ -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 diff --git a/Tests/expected/cosmosCrossDisk.out b/Tests/expected/cosmosCrossDisk.out index 5ef2823..cb5cda6 100644 --- a/Tests/expected/cosmosCrossDisk.out +++ b/Tests/expected/cosmosCrossDisk.out @@ -32,7 +32,7 @@ vars.script 50 blocks.script 343 loops.script 272 tune.sbx 318 -Play.sbx 446 +Play.sbx 379 notes.txt 21 Apps