Arkanoid (Martin Galway, 1986 Imagine)
martin-galway's music and sound-effect program for Imagine's C64 Arkanoid — "Arkanoid / Martin Galway / 1986 Imagine" in the header of the RSID that Stefano Tognon reverse-engineered for sidin #4 (2003-06-21) — famous as the game with the "digitized samples", which the code shows to be drums synthesized through the volume register. It is the fullest documented example of the galway-player (sources: s-realdmx-galway-arkanoid-player, s-sidin04-galway-arkanoid).
Facts#
- The file: an RSID, version 2, with 20 songs, init
$0801and play$0000— init installs its own CIA-timer interrupt. Songs 0–1 are the two tunes with the "sample" track, 2–7 six jingles, 8–19 twelve sound effects; the header comments say the loader tune "was a conversion from Martin's previous work on Cobra for the ZX Spectrum" and call it "One of the first, if not the first, game music featuring digitized samples" (source: s-realdmx-galway-arkanoid-player). - Two engine rates: CIA timer A is
$49F0for songs 0–1 and$24F8for the rest — about 52 Hz and 104 Hz on PAL, so jingles and effects run at twice the frame rate (multispeed). For the two sample tunes the init never returns: the foreground synthesizes the drums while the interrupt plays the voices, which is why the file must be an RSID (sid-format) (sources: s-realdmx-galway-arkanoid-player, s-sidin04-galway-arkanoid). - The "samples": no PCM anywhere. Six routines step a 4-bit value into
$D418with busy-wait delay tables (delayTabP3: $20,$10,$08,$04,$02,$01— each stage twice as slow, a falling drum), scheduled by a sample stream whose opcodes are real 6510 opcodes (81–86 xxplay drum n for xx ticks,20JSR,49FOR,40NEXT,4CJMP,60RTS); thesta $D418sits in memory with a masked operand and is unmasked only while a drum plays. Tognon's conclusion: the sample system was made "a bit harder to understand" on purpose, and a PSID player's sample emulation plays the tune "so different" from the real machine (chip-samples) (sources: s-realdmx-galway-arkanoid-player, s-sidin04-galway-arkanoid). - Songs as programs: each tune is three byte-code streams plus a minimum note duration (
$03–$0Dacross the eight tunes) — calls, loops, transposed calls, jumps, pokes into the sounding instrument. The title leadins01is a triangle-shaped vibrato (+20 × 3, −20 × 6, +20 × 3 ticks after 30) over a ±10 × 50-tick pulse sweep around$0800; its held note is turned into a 128-tick upward slide by editing the running instrument (SET2CI $0C,$80,$07 / SET2CI $06,$3C,$00); voice 2's arpeggio mode (arp39,arp37,arp5b,arp59) is "very important … as it heavy used into tune 1"; voice 3 carries a 16-byte filter envelope retriggered on every note (fil02: up by$014Dfor 3 ticks, then three slowing falls) (vibrato, pulse-width-modulation, chord-arpeggio, filter-programming) (sources: s-realdmx-galway-arkanoid-player, s-sidin04-galway-arkanoid). - Tune 6 has voices 2 and 3 jump into voice 1's stream after a staggered rest — one line played three times as a delayed echo (fake-echo) (source: s-realdmx-galway-arkanoid-player).
- Sound effects: an instrument table with two extra bytes of frequency, pushed straight into the modulation engine on any of the three voices — twelve of them, three 31-byte blocks each (sources: s-sidin04-galway-arkanoid, s-realdmx-galway-arkanoid-player).
- Sizes: about 4.5 KB of player code (three copies of the interpreter and effect engine, one per voice), 2.5 KB of music, 1116 bytes of effects, 0.5 KB of tables (source: s-realdmx-galway-arkanoid-player).
- The rip: Tognon picked the tune "as the tune contains the new sample music system in it" and calls the underlying rip "very clean"; a leftover copy of voice 1/2 code in it is "probably … part of the relocation of the code into upper memory" (source: s-sidin04-galway-arkanoid).
- The credit, disputed: because it shipped in February 1987 the game is usually named as the first with sampled drums on the C64. chris-huelsbeck claimed in 1996 that he had the trick working first and lost the race to a slipped rainbow-arts release — "So Martin Galway got the fame with 'Arkanoid' and his sample-like technique... but I don't want to be jealous of him... :)"; Galway for his part never claimed to have invented it. Both statements, and the dates, are set out on martin-galway and chip-samples (source: s-imr-huelsbeck-interview).
Related#
martin-galway · galway-player · chip-samples · multispeed · filter-programming · fake-echo · sid-format · sid-player-routine · sidin · sid
Sources#
s-realdmx-galway-arkanoid-player · s-sidin04-galway-arkanoid · s-imr-huelsbeck-interview