C64 Jeroen Tel's "Turbo Outrun" Oscilloscope view

85,963
0
Published 2017-03-11
To get the three voices of the SID I had to mute the sample playback by patching the SID file, because JSIDPlay does not offer muting of the sample playback.
This one was bit of a dog because the SID file contains at least three players, one for the intro, one for main, and one for the rest, which where relocated at run time.

The intro and main tunes has low-pass and band-pass filter enabled. Resonance is at minimum on the intro and about 20% on the main tune.
These settings and the cut-off frequency never change, and makes little to no difference to the sound compared to filters off.

Since one sample is 4-bit, two samples is stored in one byte. The sample playing code plays the high nibble first, then the low one.
Self modifying and duplicate code blocks is used to speed things up.

Sample playing code for the intro tune:
This can play samples at two volumes, full and half. Half volume throws away one bit, making it a 3bit playback instead of 4.

2133 85 E3 STA $E3 // Store accumulator, other registers is not used

*** Alternate between code path for high or low nibble
2135 A5 E4 LDA $E4
2137 D0 27 BNE $2160

*** Code path for high nibble
2139 AD xl xh LDA $xhxl // Read a new sample byte from RAM at address $xhxl. This address is modified by line 216F and 2174
213c C9 1F CMP #$1F // Compare with end-of-sample marker $1F
213e D0 0C BNE $214C // = Branch if Not Equal

2140 A9 00 LDA #$00 // Equal, turn of sample playback
2142 8D 0E DD STA $DD0E
2145 A9 38 LDA #$38 // and set volume to base line (half of full)
2147 8D 18 D4 STA $D418
214a D0 2B BNE $2177 // Relative jump to common code path

214c 8D 61 21 STA $2161 // Store sample byte for later use by the low nibble code path
214f 4A LSR A // shift high nibble to low nibble
2150 4A LSR A
2151 4A LSR A
2152 4A LSR A
2153 EA / 4A NOP / LSR A // This is NOP for full volume or LSR A (shift right, divide by 2) for half volume. This is modified by the music player.
2154 18 CLC
2155 69 3v ADC #$3v // Add filter enable bits and volume offset v (0 for full volume or 4 for half volume. This is modified by the music player.
2157 8D 18 D4 STA $D418 // PLay sample!
215a A9 01 LDA #$01 // Set nibble selector to low nibble
215c 85 E4 STA $E4
215e D0 17 BNE $2177 // Relative jump to common code path

*** Code path for low nibble
2160 A9 sw LDA #$sw // Get sample byte saved by the high nibble code path
2162 29 0F AND #$0F // Strip off the high nibble
2164 EA / 4A NOP / LSR A // This is NOP for full volume or LSR A (shift right, divide by 2) for half volume. This is modified by the music player.
2165 18 CLC
2166 69 3v ADC #$3v // Add filter enable bits and volume offset v (0 for full volume or 4 for half volume. This is modified by the music player.
2168 8D 18 D4 STA $D418 // Play sample!
216b A9 00 LDA #$00 // Set nibble selector to high nibble
216d 85 E4 STA $E4

216f EE 3A 21 INC $213A // Modify data field of instruction at $2139: Increase 16bit address by one.
2172 D0 03 BNE $2177
2174 EE 3B 21 INC $213B

*** Common code path
2177 AD 0D DD LDA $DD0D // Clear interrupt flag
217a A5 E3 LDA $E3 // Restore accumulator
217c 40 RTI // Exit NMI interrupt service

Sample playback code for the main tune:
This one is similar to the intro one, but can play samples with three different volumes, full, 1/2, and 1/4.
Full volume is never used, thus wasting 1 or 2 bits of the 4-bit samples.
This one also resides in page zero, a 256 byte RAM area normally used for storing data for faster access. This speeds it up a bit.
It contains one completely unnecessary instruction! Can you find it? :)

00a0 D8 CLD
00a1 85 0B STA $0B
00a3 AD xl xh LDA $xhxl
00a6 C9 1F CMP #$1F
00a8 D0 0C BNE $00B6

00aa A9 00 LDA #$00
00ac 8D 0E DD STA $DD0E
00af A9 38 LDA #$38
00b1 8D 18 D4 STA $D418
00b4 D0 2A BNE $00E0

00b6 24 0A BIT $0A
00b8 30 12 BMI $00CC

00ba 4A LSR A
00bb 4A LSR A
00bc 4A LSR A
00bd 4A LSR A
00be EA / 4A NOP / LSR A
00bf EA / 4A NOP / LSR A
00c0 18 CLC
00c1 69 3v ADC #$3v
00c3 8D 18 27 STA $D418
00c6 A9 80 LDA #$80
00c8 85 0A STA $0A
00ca D0 14 BNE $00E0

00cc 29 0F AND #$0F
00ce EA / 4A NOP / LSR A
00cf EA / 4A NOP / LSR A
00d0 18 CLC
00d1 69 3v ADC #$3v
00d3 8D 18 27 STA $D418
00d6 A9 00 LDA #$00
00d8 85 0A STA $0A

00da E6 A4 INC $A4
00dc D0 02 BNE $00E0
00de E6 A5 INC $A5

00e0 AD 0D DD LDA $DD0D
00e3 A5 0B LDA $0B
00e5 40 RTI

All Comments (21)
  • @JeroenTel
    It was so nice to freak out with samples on this one. I had 3 SID channels to play around with not having to worry the drums or bass line taking up most of the channels. At some points (Like around 5:00 and 9:40) I could do full chords instead of having to use arpeggios to save channels for the melody / drums / bass. That was so awesome at the time! Thanks for the upload, Rolf! ;-)
  • @bishopworks3203
    Jeroen Tel is the reason why I listen to chip tunes, and everything he produced will always be with me, not only for being impressive, but for being incredibly nice tunes.
  • @Null42x86
    1:27 WTF i dont expected beign rickrolled like that LOL
  • @OswaldMiyake35
    Definetly, the most crazy C64 soundtrack of Jeroen Tel. "Um, Outrun" "One, Two, Three, Blagh Outrun!" "Brake Sound" "Yeahh!" "Hey?"
  • @CJWarlock
    I like these tunes very much. As a teenager I used to turn the TV's volume to the max and enjoy listening to the Turbo Outrun intro and title music (often dancing to it) as soon as I discovered this game. Now I have a 1.5KW full range sound system at home (15" Celestion drivers + Selenium D220Ti tweeters for those of you who know what's what in stage audio) and I blast the C64 tunes through these speakers whenever I want to. Because I can. For pleasure. \o/ Jealous already? ;)
  • Okay, so I figured it out at last! Top one is leads, mid two are arps, lowest part(and this is... quite unique and weird for C64 music) is actually a channel that makes multiple sounds at once. It does the drums and the bass along with some of the percussion. I've always thought this song was quite complex for C64 standards, but seeing it like this... It makes me realize just how much they had to cope with the limitations of the system.
  • @GregDaniel78
    I so often loaded just as far as the title screen purely to hear these two amazing tracks. I know the game was superb too, but who's got that long to hang around!?
  • @TheBeeshSpweesh
    (*) Songs with fourth hidden channel ( ) Songs without fourth hidden channel
  • @hur9688
    Jeroen Tel did hard work... this is still better than today's music
  • @MarkMythV5
    This is incredible. Jeroen Tel was a god on the sid chip.
  • @ankhfrch
    One of my favorite c64 song, thanks for sharing that crazy funk!
  • @RolfRBakke
    It seems like we have been visited by 2 disgruntled Spectrum owners :)
  • @Z-Mat
    Turbo Outrun war sosolala... die Musik hat es zu dem gemacht, was es ist! 👍
  • @FlippDurch
    Sound of my childhood. I heard sid sound everyday... Almost everybody hat a C64 here. I still love this shit.