SIDin #12 — Ripping Trivia Arcade (Stefano Tognon, 2008)
A worked example of turning game music into a .sid file when the player does not follow the init/play convention: the music of The Trivia Arcade sits in a separate file, has three entry points, and runs four times per frame from a raster-line chain. Tognon shows the tools (vice's monitor, c1541, LaLa's SIDedit) and the reasoning.
Key claims#
- The game comes on two disks (
TRIVIAA0.D64,TRIVIAA1.D64).c1541 TRIVIAA0.D64→list→extract→quitpulls every file out as a PRG; a file namedtrimus.objis guessed to be the "Trivia Music Object". - LaLa's SIDedit (a Perl program) on the file: load address
$1000, threeJMPs at the start, and code that addresses$5000— so the music must be relocated to$5000and "not uses a standard IRQ calling (+0=init, +3=play), as there are 3 pointers". - VICE monitor:
break 5000,break 5003,break 5006before loading the game show$5000hit once,$5003once for every four hits of$5006;m 314reveals the IRQ vector$2E3F, and a breakpoint there shows$5006on every interrupt and$5003on every fourth.$5000only clears$D400–$D418and stores 1 to$5010–$5012— an init without a subtune argument. - A first test player (raster IRQ at line 50, calling
$5003every fourth tick) played nothing. Disassembling$5003→$5020shows$5009compared with$500A— subtune selection versus the subtune playing;> 5009 2thenxin the monitor makes the tune play, but far too slowly: a multispeed tune. - The game's IRQ setup (
$2DE5): NMI vector$2F08,$DC0D = $7F, IRQ vector$2E3F, raster line 1,$D01A = 1, thenJSR $5000. The IRQ routine dispatches on$D012values$01, $41, $6E, $C3, $D2and re-arms the next; a breakpoint log shows only lines 001, 065, 110, 196 in use for all five subtunes — four calls per frame,$D2unused. - The final player:
A= tune number →tax; inx; stx $5009; inx; stx $500a(skipping subtune 0),JSR $5000, a raster IRQ that walks$01 → $41 → $6E → $C3 → $01, calls$5003at line$01only and$5006at every line, thendec $d019; jmp $ea31; the music binary is.incbin'd at$4FFE(two-byte load address included). - Subtune count found by trying
$5009values: 0 starts with "some strange sound" (or silence if played first), 1–4 play well, 5 duplicates one of them, 6 and above repeat — hence 4 subtunes. The wrapper code is moved next to the data ("e.g 4f95"), the BASICSYSstub dropped, and SIDedit writes "a standard sidplay header … Real C64 tune, init address, 4 subtunes".
Practical takeaways#
- Ripping checklist for a non-standard player: extract with
c1541; inspect load address and entry points (SIDedit); breakpoints on the entry points and on the IRQ vector at$0314to learn call order and rate; find the subtune variable by reading the play routine; log$D012at the IRQ to get the raster positions; write a tiny raster driver that reproduces the call pattern; mark the result as a real-C64 (RSID) tune because it installs its own interrupt chain. - The four raster positions are what a 4× tune looked like in a 1980s game: not a CIA timer, but a chain of raster interrupts.
Notable quotes#
"Ripping is alway a way to make you enjoy a sid tune into your sidplayer, so I hope that looking even at how this is done is a good way for new rippers to learn how to do that."
Relevance to the wiki#
A concrete workflow for sid-format (when RSID is needed, what SIDedit fills in) and for vice's monitor (break, m, >, x); a raster-chain example for multispeed; a non-standard calling convention for sid-player-routine next to the +0/+3 norm; related to player-identification and sidid.
Pages touched#
sid-format · vice · multispeed · sid-player-routine · hvsc · player-identification · sidid · sidin