1988 · Elite Systems

Ikari Warriors: music

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

Jason Brooke's three tunes and the game's 23 sound effects, played by the game's own music driver.

01 · Music

Music: three tunes

The game keeps three tunes in tune_table: tune 0 on the title pages, tune 1 at game over, and tune 2 in the opening sequence and all through play. The player below runs the game's own driver on the kit's 6502, from the bytes of the Source tab, into the site's model of the sound chip: start_tune once, then music_tick fifty times a second, as the game's interrupt calls it.

TuneWhere it playsFrames a step

Tunes 0 and 2 loop for ever: the end of each voice's list of patterns starts it again (cmd_next_pattern). Tune 1 ends with a stop command (cmd_stop).

02 · The driver

How a tune is stored

Each tune is seven bytes in tune_table: a tempo, and the address of a list of patterns for each of the three voices. A pattern is a stream of bytes that voice_step reads when a voice's note runs out. A byte below $80 is a note. $E0-$FF sets the length of the notes after it, $D0-$DF picks an instrument (a waveform and an envelope), $C0-$CF an arpeggio, and $80-$8E are commands: rests, vibrato, slides, bends, drums, pulse sweeps, transposing, and the end of the pattern (music_commands).

The tempo is the number of frames between steps: 4, 5 or 6. Between steps, voice_update works on every voice every frame, adding the arpeggio, vibrato, slide, and pulse sweep before it writes the chip. A frame-skip switch at skip_frames, the usual way of making music written for one television standard play at the same speed on the other, is never turned on: the game is for European PAL machines only.

03 · Sound

Sound: 23 effects

The sound effects are 20 bytes each in effect_table. play_effect finds a voice for one, and start_effect_voice copies its bytes in and takes the voice from the music until the effect ends. Each effect sweeps its frequency by a pattern of steps, jumps back to its start every so many frames, and switches between two waveforms (effect_update). With music and effects both on, effects use only the first voice, so the tune keeps the other two. Press F5 in play to choose music, effects, both or neither.

Each effect is started by the game's own play_effect with the music off, then run by music_tick. The names come from where the code plays them; an effect with only a number has no caller in the code that names its use.