(Discovery) Unused Sonic 1 Credits BGM Bar

Discussion in 'Engineering & Reverse Engineering' started by evilhamwizard, Oct 22, 2017.

  1. evilhamwizard

    evilhamwizard

    Researcher
    1,326
    119
    43
    Let me get the discovery out of the way first.

    As some of you may recall, an album which consisted of many demo tracks for Sonic 1 & 2 was put out a few years a go. One of the tracks, titled "Theme of SONIC THE HEDGEHOG Demo", contained a bar or two of music that does not exist in the final game.

    Well, as it turns out...I found one of them that goes completely unused. :)/>/>/>
    Have a listen for yourself here.
    This matches the part found on the demo track here:

    https://youtu.be/O13_fMoquD8?t=3904

    It seems that they planned to use some parts of the extended theme for the credits at one point, but chose not to for some reason. To my knowledge, this has never been found before. The sequencing for this part is still in the game! However, just this sequence and nothing else. I couldn't figure out how to get the other channels to loop twice, so that's why it's out of sync when playing the unused part.

    A while a go I was fooling around with BizHawk's CDL while playing some Megadrive titles to completion and noticed that areas where a game's sound driver would access sound data would sometimes go partially unused despite the sound data itself being used in some way. At first I chalked it up to just a weird oddity with BizHawk, but I wanted to take a closer look. I remembered looking at sound driver files for Muppets on the Go, a Sega Pico game that uses similar conventions to the Sonic 1 driver. The source code came with a demo song (which by the way, is Michael Jackson's Smooth Criminal, which is used in an early prototype of Richard Scarry's Huckle and Lowly's Busiest Day Ever). The source for the demo song is nothing more than macro'd 68k source representing the commands, notes, volume/pitch changes, etc. Like this:

    [68k];-----------------------------------------------;
    ; ;
    ; SONG TABLE ;
    ; ;
    ;-----------------------------------------------;
    ;-----------------------------------------------;
    ; PSG 0ch ;
    ;-----------------------------------------------;
    TAB810 EQU *
    T8100 EQU *
    DC.B NL,L1+L1,NL
    T810A EQU *
    T810A_0 EQU *
    DC.B CMCALL
    JDW SUB8100M
    DC.B CMREPT,0,3
    JDW T810A_0
    DC.B NL,L8,FVR,$0B,1,$F0+12,$FF,BF2,L8,VROFF,BF2,L16,BF2,AF2,BF2
    DC.B CN3,L8,FVR,1,1,3/3,4,CN3,VROFF,NL,BF2,L16,CN3
    DC.B DF3,L8,FVR,1,1,3/3,4,DF3,VROFF,NL,CN3,L16,DF3
    DC.B BN2,1,TIE,CN3,L8-1,FVR,1,1,4/2,4,AF2,L8+2,VROFF,NL,L8-2,NL,L8[/68k]

    It makes me wonder if the sound programmers (for SMPS games anyway) arranged the songs using macro'd assembly as well - meaning, no tracking software just raw macro'd assembler? It also made me wonder if Sonic 1 could've been represented the same way. I discovered Cinossu's program S1SMPS2ASM and went to work on the sound files in Sonic 1. Using what wasn't marked by Bizhawk, I was able to locate what the unused bytes actually represented using the program.

    Here's a run down of what I've found - music wise.

    1.) Star Light Zone
    Star Light Zone's BGM contains two unused jumps in the sequencing for the fifth FM channel. These two jumps jump to themselves infinitely and don't seem to do anything else.
    [68k]SLZ_Jump06:
    ; Jump To   location
    smpsJump SLZ_Jump06
    SLZ_Jump07:
    ; Jump To   location
    smpsJump SLZ_Jump07[/68k]

    2.) Scrap Brain Zone
    Scrap Brain Zone has one small loop that goes unused that doesn't seem to be much. The sequence is programmed to loop a rest with a duration of $60 once in the fifth FM channel.

    [68k]SBZ_Loop0D:
    dc.b nRst, $60
    ; Loop To   index loops location
    smpsLoop $00, $01, SBZ_Loop0D[/68k]

    3.) Invincibility
    The invincibility theme has a command to stop the channel right after the channel loops again, so it's never called.

    4.) Boss
    The first of the really interesting finds. This track contains two voices/instruments that go unused, meaning no track changes the current voice settings to these values. There are two unused voices in the Boss BGM, one plucky instrument (which may have been tested for the bass) and one finger bass instrument that sounds similar to the bass that was being used in the demo track. I made a quick test to see how the latter unused voice (voice #4) sounded when used for the bass instead of the slap guitar used in the final.

    Have a listen.
    Compare this with the bass used in the demo track:

    Here are the settings used for each of the unused voices:

    [68k]; Voice 03
    ; $30,$30,$30,$30,$30,$9E,$D8,$DC,$DC,$0E,$0A,$04,$05,$08,$08,$08,$08,$BF,$BF,$BF,$BF,$14,$3C,$14,$80
    ; #
    smpsVcAlgorithm $00
    smpsVcFeedback $06
    ; op1 op2 op3 op4
    smpsVcDetune $03, $03, $03, $03
    smpsVcCoarseFreq $00, $00, $00, $00
    smpsVcRateScale $03, $03, $03, $02
    smpsVcAttackRate $1C, $1C, $18, $1E
    smpsVcAmpMod $00, $00, $00, $00
    smpsVcDecayRate1 $05, $04, $0A, $0E
    smpsVcDecayRate2 $08, $08, $08, $08
    smpsVcDecayLevel $0B, $0B, $0B, $0B
    smpsVcReleaseRate $0F, $0F, $0F, $0F
    smpsVcTotalLevel $80, $14, $3C, $14

    ; Voice 04
    ; $39,$01,$51,$00,$00,$1F,$5F,$5F,$5F,$10,$11,$09,$09,$07,$00,$00,$00,$2F,$2F,$2F,$1F,$20,$22,$20,$80
    ; #
    smpsVcAlgorithm $01
    smpsVcFeedback $07
    ; op1 op2 op3 op4
    smpsVcDetune $00, $00, $05, $00
    smpsVcCoarseFreq $00, $00, $01, $01
    smpsVcRateScale $01, $01, $01, $00
    smpsVcAttackRate $1F, $1F, $1F, $1F
    smpsVcAmpMod $00, $00, $00, $00
    smpsVcDecayRate1 $09, $09, $11, $10
    smpsVcDecayRate2 $00, $00, $00, $07
    smpsVcDecayLevel $01, $02, $02, $02
    smpsVcReleaseRate $0F, $0F, $0F, $0F
    smpsVcTotalLevel $80, $20, $22, $20[/68k]

    Voice 4 is what I used to replace the bass. Voice 3 on the other hand, I have no clue what it might've been used for. It doesn't seem to play nice with any of the other sequences for this track.

    5.) Act Clear
    Just like the Boss BGM, this track also contains an unused voice/instrument (voice 04). This time for a moderately loud trumpet. I don't exactly know what channel it could've been used for, but it's too loud to be used for the 5th channel. It does seem to play nice with the left and right channels though (I forget which number they were). Have a listen here.

    [68k]; Voice 04
    ; $3D,$01,$02,$02,$02,$10,$50,$50,$50,$07,$08,$08,$08,$01,$00,$00,$00,$2F,$1F,$1F,$1F,$1C,$82,$82,$82
    ; #
    smpsVcAlgorithm $05
    smpsVcFeedback $07
    ; op1 op2 op3 op4
    smpsVcDetune $00, $00, $00, $00
    smpsVcCoarseFreq $02, $02, $02, $01
    smpsVcRateScale $01, $01, $01, $00
    smpsVcAttackRate $10, $10, $10, $10
    smpsVcAmpMod $00, $00, $00, $00
    smpsVcDecayRate1 $08, $08, $08, $07
    smpsVcDecayRate2 $00, $00, $00, $01
    smpsVcDecayLevel $01, $01, $01, $02
    smpsVcReleaseRate $0F, $0F, $0F, $0F
    smpsVcTotalLevel $82, $82, $82, $1C[/68k]

    6.) Credits
    Now for the big one. This track contains a mixture of unused sequencing data (as mentioned above) as well as unused voices/instruments. The unused sequencing data is particularly odd as it's positioned just after the sequencing data for the very beginning of the song, even though it's meant for the very end.

    [68k]Credits_Call1A:
    dc.b nB5, $0C, nG5, nB5, nD6, nC6, nB5, nA5
    dc.b nB5, nA5, nFs5, nA5, nC6, nB5, nA5, nG5
    dc.b nA5, nG5, nE5, nG5, nB5, nA5, nG5, nFs5
    dc.b nG5, nFs5, nG5, nA5
    smpsReturn
    dc.b nRst, $0C, nG6, nB6, nD7, nFs7, $0C, nRst
    dc.b $06, nFs7, $0C, nG7, $06, nFs7, $0C, nE7
    dc.b $60, nRst, $0C, nG6, nB6, nD7, nFs7, $0C
    dc.b nRst, $06, nFs7, $0C, nG7, $06, nFs7, $0C
    dc.b nAb7, $5D, nRst, $03, nA7, $12, nRst, $06
    dc.b nA7, $12, nRst, $06, nRst, $06, nAb7, $12
    dc.b nA7, $06, nRst, $12
    smpsReturn[/68k]
    Everything before the first smpsReturn is used by the first PSG channel and the first FM channel. Everything after the first smpsReturn is unused and is meant for the end of the song. The equivalent sequence that is used by the final version is this:
    [68k]Credits_Call07:
    dc.b nRst, $0C, nG6, nB6, nD7, nFs7, nRst, $06
    dc.b nFs7, $0C, nG7, $06, nFs7, $0C, nAb7, $54
    dc.b nRst, $0C, nA7, nRst, nA7, nRst, $12, nAb7
    dc.b nA7, $0C
    smpsReturn[/68k]
    Notice that the sequencing data itself is very similar, except it's obviously shorter because it doesn't have the extra notes in the unused version. The used sequencing data listed above is used by the first and fourth FM channel. Based on this, I altered the call made to this label to point to the unused code instead and got the result you hear above. It sounds like it would fit perfectly if only the other channels looped once more.

    Finally, there are two unused voices/instruments in this file.
    [68k]; Voice 13
    ; $3C,$31,$52,$50,$30,$52,$53,$52,$53,$08,$00,$08,$00,$04,$00,$04,$00,$10,$07,$10,$07,$1A,$80,$16,$80
    ; #
    smpsVcAlgorithm $04
    smpsVcFeedback $07
    ; op1 op2 op3 op4
    smpsVcDetune $03, $05, $05, $03
    smpsVcCoarseFreq $00, $00, $02, $01
    smpsVcRateScale $01, $01, $01, $01
    smpsVcAttackRate $13, $12, $13, $12
    smpsVcAmpMod $00, $00, $00, $00
    smpsVcDecayRate1 $00, $08, $00, $08
    smpsVcDecayRate2 $00, $04, $00, $04
    smpsVcDecayLevel $00, $01, $00, $01
    smpsVcReleaseRate $07, $00, $07, $00
    smpsVcTotalLevel $80, $16, $80, $1A[/68k]
    This is actually a slightly different version of Voice 07, which is used. I don't know where that one is used though.
    For comparison, here is voice 07:
    [68k]; Voice 07
    ; $3C,$31,$52,$50,$30,$52,$53,$52,$53,$08,$00,$08,$00,$04,$00,$04,$00,$1F,$0F,$1F,$0F,$1A,$80,$16,$80
    ; #
    smpsVcAlgorithm $04
    smpsVcFeedback $07
    ; op1 op2 op3 op4
    smpsVcDetune $03, $05, $05, $03
    smpsVcCoarseFreq $00, $00, $02, $01
    smpsVcRateScale $01, $01, $01, $01
    smpsVcAttackRate $13, $12, $13, $12
    smpsVcAmpMod $00, $00, $00, $00
    smpsVcDecayRate1 $00, $08, $00, $08
    smpsVcDecayRate2 $00, $04, $00, $04
    smpsVcDecayLevel $00, $01, $00, $01
    smpsVcReleaseRate $0F, $0F, $0F, $0F
    smpsVcTotalLevel $80, $16, $80, $1A[/68k]

    Finally, Voice 1E goes unused as well:
    [68k]; Voice 1E
    ; $3A,$01,$07,$01,$01,$8E,$8E,$8D,$53,$0E,$0E,$0E,$03,$00,$00,$00,$07,$1F,$FF,$1F,$0F,$18,$28,$27,$80
    ; #
    smpsVcAlgorithm $02
    smpsVcFeedback $07
    ; op1 op2 op3 op4
    smpsVcDetune $00, $00, $00, $00
    smpsVcCoarseFreq $01, $01, $07, $01
    smpsVcRateScale $01, $02, $02, $02
    smpsVcAttackRate $13, $0D, $0E, $0E
    smpsVcAmpMod $00, $00, $00, $00
    smpsVcDecayRate1 $03, $0E, $0E, $0E
    smpsVcDecayRate2 $07, $00, $00, $00
    smpsVcDecayLevel $00, $01, $0F, $01
    smpsVcReleaseRate $0F, $0F, $0F, $0F
    smpsVcTotalLevel $80, $27, $28, $18[/68k]
    Voice 1E, which I believe is a trumpet, is actually a slightly modified Voice 0A and 1C which are both duplicates of each other. For comparison, here's Voice 1C:
    [68k]; Voice 1C
    ; $3A,$01,$07,$01,$01,$8E,$8E,$8D,$53,$0E,$0E,$0E,$03,$00,$00,$00,$00,$1F,$FF,$1F,$0F,$18,$28,$27,$80
    ; #
    smpsVcAlgorithm $02
    smpsVcFeedback $07
    ; op1 op2 op3 op4
    smpsVcDetune $00, $00, $00, $00
    smpsVcCoarseFreq $01, $01, $07, $01
    smpsVcRateScale $01, $02, $02, $02
    smpsVcAttackRate $13, $0D, $0E, $0E
    smpsVcAmpMod $00, $00, $00, $00
    smpsVcDecayRate1 $03, $0E, $0E, $0E
    smpsVcDecayRate2 $00, $00, $00, $00
    smpsVcDecayLevel $00, $01, $0F, $01
    smpsVcReleaseRate $0F, $0F, $0F, $0F
    smpsVcTotalLevel $80, $27, $28, $18[/68k]

    I changed the used voice numbers to their equivalent unused to see how different they sounded when played back, along with the added extra bar at the end. The result was this - have a listen.

    I didn't go through the sound effects just yet, as there are a lot and are probably not as exciting as the BGM. This definitely opens up a possibility that other Megadrive games might have something similar going on, where a sound programmer would accidentally leave unused sequencing data in the tracks themselves. If they arranged the songs using hand written assembler, it's definitely a possibility.

    Kinda goes to show you that there's still some stuff left to find...
     
  2. drx

    drx

    mfw Researcher
    2,235
    214
    43
    :rolleyes:
    This is awesome.
     
  3. LukyHRE

    LukyHRE

    The only one who has a Portal-themed avatar Member
    379
    2
    18
    Buenos Aires, Argentina
    Bitching and complaining about my country -.-'
    26 years, and you people still finding things about the game. This is more than awesome.

    Are you gonna try another go at making the other channels loop on the Credits song? Would love to listen how the song was supposed to sound on the Genesis originally.
     
  4. Spanner

    Spanner

    The Tool Member
    3,250
    44
    28
    United Kingdom
    Sonic Hacking Contest
  5. ICEknight

    ICEknight

    Researcher Researcher
    Wow, awesome finds indeed!

    Definitely, just like you can sometimes see unused stuff in Amiga music files when browsing them with programs like ModPlug Tracker.

    Man, I wish we had a Mega Drive music sequencer at this point so that we could start checking all the already extracted music for this unused bits... :(
     
  6. McAleeCh

    McAleeCh

    Oldbie
    984
    12
    18
    Amazing finds here - great work! I was literally wondering only the other month what that 'extra' portion of the Sonic theme would have sounded like had it made it into the game, so it's mind-blowing to find that sequence data for that section actually exists and can be played back! Here's hoping you manage to find a way to make the other channels loop correctly so we can hear it as it was intended. I wonder if any of the other Sonic games (or indeed, other Mega Drive games in general) have tracks containing unused sequences in this manner.

    Would love to hear these with the 'prototype drums' too - I think I'm right in remembering it was discovered from prototype footage that although the same DAC samples were used they played back at a lower sample rate in earlier builds, resulting in a lower-pitched and beefier sound for the percussion similar to how it sounds in Masato Nakamura's original demo tracks.
     
  7. kazblox

    kazblox

    Member
    172
    16
    18
    Diassemblies and decompilations.
    The prototype drums are just the regular DAC samples being played in a generic DAC driver. There is a modified driver in the final game that changes the sampling rate to compensate for the SEGA sample.
     
  8. Natsumi

    Natsumi

    the cute one here Tech Member
    It is very easy to just disassemble all the tracks, and see where there are unused bytes. In fact, I've noticed this unused stuff before, but never bothered to investigate. I did find something else quite interesting too:
    [68k] dc.b nA3, $06, nRst
    saVolFM $FD
    dc.b nA2, $6C, sHold, $60
    sStop
    dc.b $00, $01 ; Unused

    Credits_Call10:
    dc.b $0C, $0C, $0C, $0C, $0C, $0C
    sNoteTimeOut $00
    dc.b $0C sRet[/68k]


    Those 2 unused bytes look like they are part of a flag, but off the top of my head I can't think of a flag which could use two bytes as input quite like this.
     
  9. RAMPKORV

    RAMPKORV

    Oldbie
    395
    0
    16
    Sweden
    Licking my girlfriend's anus <3
    Nice findings! I wonder what the guys who did this knew back in the days :) https://youtu.be/MM0P56mozRs?t=35
     
  10. Hez

    Hez

    Asshole Oldbie
    3,105
    44
    28
    Hell
    Your mother
    Ah man...this is the stuff that gets my mouth all watery. I WANT MORE
     
  11. ICEknight

    ICEknight

    Researcher Researcher
  12. Tanks

    Tanks

    Member
    1,028
    0
    16
    You've literally pulled blood from a god damn stone and this thread has so little traction. Jesus people, this community gonna make me cry. :(/>
     
  13. Covarr

    Covarr

    Sentient Cash Register Member
    4,233
    1
    18
    Trapped in my own thoughts.
    Two stageplays, a screenplay, and an album
    I would wager because, as impressive and exciting as it is, we don't want to flood the thread with a bunch of "good job" and "cool" posts.

    I, for one, was really fascinated by this, thoroughly enjoyed reading and watching the videos, etc., but I didn't have anything substantial to add so I didn't say anything.
     
  14. This seems like a cool find! I wonder what else is hidden in the code of Sonic 1...
     
  15. Natsumi

    Natsumi

    the cute one here Tech Member
    anything and everything basically
     
  16. Dissent

    Dissent

    @SailsSSB on Twitter Member
    403
    7
    18
    This is why all message boards need a "Like" button. It's pretty cool, but really isn't worth drowning discussion with posts that amount to "WHOA AWESOME."
     
  17. ICEknight

    ICEknight

    Researcher Researcher
    I admit that I sometimes instinctively look for the "like" button, after reading posts like this discovery...