1987 · System 3

IK+

This minisite was contributed by air. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/ik-plus with me to Gold.

Rob Hubbard's tune plays through every fight on three voices of the SID. The fighters' shouts are digitised samples, played through the volume register four bits at a time.

01 · The music

Music: Rob Hubbard's tune, played by its own driver

The tune is Rob Hubbard's, and it plays through every fight unless F5 turns it off. The player runs a port of the game's own driver once a frame, so each note it plays is the note the C64 plays.

The tune and the sound effects, played by a JavaScript port of the music driver ($E00F) and the effect player ($EE45). The port matched the original code, run in a 6502 simulator on the game's memory, register write for register write over 82,400 frames, with effects started at 119 random moments over the tune. The 6581 setting of the filter switch uses one chip's cutoff curve, as measured for the reSID emulator; real chips differ from one another. Effects 4 and 5 are in the game's tables, but nothing starts them.

The tune runs for 7 minutes 40 seconds before its three tracks start again, together. Each track is a list of pattern numbers and transpositions ($EABB, $EB44, $EC0E), and the 40 patterns hold the notes. A tick is three frames, and one tick in every 113 frames takes four ($E696). Each of the fifteen instruments is two records of eight bytes ($E975, $E9ED): waveform, envelope, vibrato, a pulse-width sweep and a byte of effect flags that turn on drums, arpeggios, the filter sweep and a noise burst.

Voice 3 carries the bass, and it is the only voice the filter touches ($D417 is always $F4). Instruments 1, 7 and 8 lower the cutoff by 12 a frame from each note's start, wrapping round to the top, and add a one-frame burst of noise to voice 3 about every sixth frame, switching the filter from low-pass to band-pass for that frame (note_flags, $E41A). Over the whole tune that tick sounds 3,741 times.

02 · The shouts

Sound: every shout at a random pitch

The six shouts are digitised sound, four bits a sample, played through the SID's volume register. Each starts at a sample rate picked at random, so the same cry comes out a little higher or lower each time.

The game's own samples ($BF00-$CFFF), played the way its sample player ($0934) plays them: one nibble a timer interrupt, from the byte after the shout's start up to its end page ($0ECB, $0ED1), at the PAL clock divided by the timer's latch plus one. The page turns each level straight into sound, without the chip's own output stage, so a real C64 sounds somewhat different.

The six shouts share their bytes: three sit in the high nibbles of $BF00-$CFFF and three in the low ($0EDD). Starting one ($0EE3) patches the sample player's four instructions that pick the nibble, either four LSR A or NOP, NOP, AND #$0F, and sets CIA 1's timer to its base, 224 on PAL, plus a random 0 to 31 from the frame counter and the raster line. A sample every 225 to 256 cycles is about 3.8 to 4.4 kHz. Each nibble goes straight into $D418, the register whose low four bits are the SID's master volume, and the jumps in volume are the sound.

The seventeen poses that can bring a shout ($0E1F) and the four tables beside them ($0E31-$0E85). When a fighter's pose changes ($0DED), a fighter who has just scored gets the scoring shout, one knocked down gets the fall's, and one striking gets the attack's. A pose number opens it on the Fighters tab.

The second shout after a score comes from the frame interrupt, which counts the delay down ($01C1). Only one shout plays at a time, since a new one takes over the sample player's pointer, and F7 turns them all off ($FD51).