SIDin #2 — David Whittaker's Lazy Jones music routine (Stefano Tognon, 2002)
Tognon's reverse-engineering of the hvsc rip of Lazy Jones (Terminal Software, 1984) — david-whittaker's earliest routine in the wiki and, in his words, "the most simple I had seen until now": two voices of raw frequency pairs, one step every twelve frames, one fixed sound and no effects at all. "You probably will be surprise to see a so simple engine gives this magic music: maybe it is all David talent!" The listing is reproduced in full; this page keeps the mechanics and the numbers. The Panther driver of 1986 on whittaker-player is a different, far larger routine.
Key claims#
- Basis: "the Sid rip present in HVSC. How you see it is not complete with the sound SX [effects]: however it is just what we need." The rip "was ripped from a cracked version of the game, as it contains a faulty track (not used in the rip, but present)" — the bytes after tune 21 under the label
wrong, which "you can listen to … if you change the source and you active it again". The copyright note: "contact the copyright owner author for making any business use of it." - Data: "The 20 music peaces are with the same length (the first is a case we see after): 80h bytes of data. Each peaces of music contains the low/high frequency to set in the sid registers for the 2 voices used (so 4 bytes)." So a piece is 32 steps; the index is incremented by 4 per step and compared with
$80(COMP) to loop the piece. "Tune 1 is an exception: it is the running of tune 10 and 11 in sequences" — for song 0initpatches the compare value to$00, so the index wraps after 256 bytes, andTune10andTune11are consecutive in memory (Tune1:is the same label asTune10:). - Timing: "There's not a note duration: each notes have the same length."
DELAYis reloaded with$0Cand decremented once per call; only when it reaches zero is a step played. - One sound: "There's not special SID effect: all the notes use the same setting: Attack/Decay of 66h and 21h wave form. As the Decay/Released is not set (so 0), there's a simple 20h to 21h setting in the wave form when the note changes."
setADwrites$1Fto$D418and$66to$D405and$D40C;initEnginewrites$FFto$D416and$03to$D417, setsMUSIC = 1,INDEX = 0,DELAY = $0Cand the pattern pointer. Sustain/release is never written (adsr-envelope). - Per step (
IRQ): read the low byte at($B4),y; if it is zero skip the voice entirely (beq skip1), otherwise write$D400,$D401, then$20and$21to$D404; advance the pointer by 2; the same for voice 2 ($D407,$D408,$D40B);INDEX += 4; at$80reset the index and reload the pointer fromPATTL/PATTH;jmp $EA31. Voice 3 is never touched. Rests are$00,$00,$00,$00rows (Tune17). - Variables:
MUSIC = $03E0(1 = play),INDEX = $03E1,DELAY = $03E3,PATTL = $03E4,PATTH = $03E5; the running pointer in$B4/$B5;tableLo/tableHihold the 21 tune addresses andinitcopies the chosen one into theLOP/HIPimmediates (self-modifying code). - PSID header as typed:
org 1921,.byte "PSID",.word $0200(v2),.word $7C00(data offset$7C), load and init =init, play =IRQ,.word $1500= 21 songs,.word $0100= start song 1, the strings"lazy Jones","David Whittaker","1984 Terminal Software"(sid-format). - What is in the notes: Tognon annotates
Tune10with note names —$26,$04,$3A,$04 ; . H1 C2,$4D,$08,$75,$08 ; . H2 C3,$30,$04,$8F,$0C ; ^ H1 F#3,$61,$08,$8F,$0A ; ^ H2 D#3… — voice 1 alternatingH1/H2(B in two octaves, German naming) on every step while voice 2 carries the tune, with./^marking each row "low"/"hi" (octave-bass). His guess at the magic: "I think from the music notes themselves! Maybe David had used some frequencies that give a better result using a little less or high values from the expected." - Rastertime: "this engine use a maximum of 4 rasterlines when it is piking a new note, and only 1 rasterline in the other case" (sid-player-routine). "Don't forget that the game is from 1984, so it was develop at the beginning of the Commodore time."
Practical takeaways#
- A complete SID tune in 32 rows × 2 voices with a single sawtooth blip (AD
$66, SR$00, gate retriggered by$20→$21) — the smallest possible "instrument" and a lesson in letting the note choice do the work (instrument-design). - The retrigger is the whole articulation: dropping and raising the gate in the same call restarts the attack; with sustain 0 each note is a fixed-length blip whatever the step length (hard-restart is the later refinement of the same idea).
- Chaining two pieces by widening the loop compare (
$80→ wrap at$00) is a two-byte song structure (orderlist).
Notable quotes#
"Now I simply show you how David made this music. You probably will be surprise to see a so simple engine gives this magic music: maybe it is all David talent!"
"this is a very simple engine music (I can say that it is the most simple I had seen until now)."
Relevance to the wiki#
The documented Lazy Jones routine for whittaker-player and david-whittaker (until now cited there only through s-sidin02-matt-gray-driller); a hand-written PSID header and a rip from a cracked source for sid-format and hvsc; a 1984 octave bass for octave-bass; the smallest driver on sid-player-routine.
Pages touched#
whittaker-player · david-whittaker · sid-format · hvsc · sid-player-routine · octave-bass · adsr-envelope · sidin
To verify#
- (unverified) Read with the datasheet:
$D417 = $03routes voices 1 and 2 through the filter with resonance 0,$D418 = $1Fis low-pass on at volume 15,$D416 = $FFputs the cutoff at its maximum — so both voices pass through a wide-open low-pass filter; Tognon prints the register comments only. - (unverified) The
wrongblock ($3F,$3F,$37,$7F … $18,$18,$18,$18 …) looks like character or sprite graphics that the cracked image left in place of music data. - (unverified) Tognon's note names use German
Hfor B; his octave numbers are not mapped to tracker octaves here.