- Group:
- Tech Member: Tech Members
- Active Posts:
- 1164 (0.3 per day)
- Most Active In:
- Engineering & Reverse Engineering (429 posts)
- Joined:
- 09-October 04
- Profile Views:
- 4836
- Last Active:
Apr 16 2015 01:45 AM- Currently:
- Offline
My Information
- Age:
- 21 years old
- Birthday:
- June 9, 1994
- Gender:
-
Male
Contact Information
- E-mail:
- Click here to e-mail me
- Website:
-
http://
Previous Fields
- Project:
- Dustin Wyatt's Epic Jailbreak
- National Flag:
- us
- Wiki edits:
- 13
Latest Visitors
-
MegaMarioMan 
18 Mar 2015 - 19:18 -
MarkeyJester 
08 Mar 2015 - 19:10 -
GerbilSoft 
24 Feb 2015 - 23:58 -
kazblox 
01 Dec 2014 - 06:40 -
Ravenfreak 
14 Aug 2014 - 16:36
Topics I've Started
-
Compressed Sonic 1 PCM Music
27 February 2009 - 08:24 PM
You might remember the several (3) PCM demos I've posted in the past year or so, which streamed WAV files from the ROM to play as level music. The main problem with these demos was the large filesize needed to store PCM samples; however, over the past few days, I've added DPCM compression (the same type used for the Sonic 1 DAC samples) to the driver. DPCM compression compresses a sound file by storing a 4-bit deltas instead of a full byte; this results in an exact 2:1 compression ratio for an 8-bit WAV file. Even with the compression, the driver can still play WAVs at 22050Hz (and it works in Gens now!).
Like always, here's a ROM which showcases the new driver (it uses 6 22050Hz music files):
Link to Test ROM
The reason the ROM is 4MB is because it uses 22050KhZ compressed files; if I had used 11025KhZ instead like in the other demos I posted, it would be <2MB.
Also, here's the music list:
GHZ: Slash Man's Stage [Mega Man VII] MZ: Burning Heat [Gradius 2 Arcade] SYZ: Collision Chaos Present [Sonic CD Jap] LZ: Undersea Sector [The Guardian Legend] SLZ: Stardust Speedway GF [Sonic CD Jap] SBZ: We're The Robots [Mega Man 9] NOTE: LZ and SBZ's songs are not the original versions, but rather remastered ones.
Also, here's the compiled Z80 driver, and the ASM source. For instructions on how to integrate this driver into the Sonic 1 ROM, see this topic, at the bottom.
Sound files should be compressed with s1sndcomp.exe for best results. The link on jman2050's site doesn't exist anymore, so here's a mirror on my Fileden account. You probably shouldn't use 22050Hz WAVs like I did for the demo; 16000Hz would probably be better for a hack.
Hopefully this will help people overcome the filesize limit for PCM files. -
High-Quality Sonic 1 PCM Music
19 August 2008 - 09:39 PM
You might remember the various PCM demos I've posted over the past year, which played WAV files as level music in a Sonic 1 ROM. However, the quality of these past demos wasn't that great, to say the least.
Over the past few weeks, I've been optimizing the Z80 driver (now it's 3x faster) and finding other various ways to improve the sound quality. The playback quality is pretty much perfect now, and the driver can also support a file up to 22050Hz now.
Here's a test demo of the new, improved driver:
Link to Test Demo
EDIT: Link fixed.
EDIT 2: Just found this out; sound doesn't work in Gens. Would someone be willing to test if this works on real hardware?
Music list for the demo, in a fancy code box that preserves formatting:
PCMDriverLoad: ; XREF: GameClrRAM; TitleScreen move.w #0,($A11200).l move.w #$100,($A11100).l move.w #$100,($A11200).l WaitForZ80_2: btst #0,($A11100).l bne WaitForZ80_2 lea (Z802),a0 lea ($A00000).l,a1 move.W #Z802End-Z802,d1 LoadDriver: move.b (a0)+,(a1)+ dbf d1,LoadDriver move.b #$01,($FFFFFFFC).w rts Z802: incbin sound\PCMD.bin Z802End:
This is the code that actually loads the new PCM driver. It also incbin's the PCM driver (I'm assuming here that you put it in the sound folder of the split disassembly, and didn't change the name), and sets a special driver byte at $FFFFFFFC (this will be needed later).
Step 3:
Find the SoundDriverLoad subroutine, and replace it with this:
SoundDriverLoad: ; XREF: GameClrRAM; TitleScreen nop move.w #$100,($A11100).l ; stop the Z80 move.w #$100,($A11200).l ; reset the Z80 lea (Kos_Z80).l,a0 ; load sound driver lea ($A00000).l,a1 bsr.w KosDec ; decompress move.w #0,($A11200).l nop nop nop nop move.w #$100,($A11200).l ; reset the Z80 move.w #0,($A11100).l ; start the Z80 move.b #$00,($FFFFFFFC).w rts
The only new thing here is the line of code at the end that sets the driver flag to 0. So when the driver flag is 0, the regular S1 drum driver is in use, but when the driver flag is 1, the new PCM driver is in use.
Step 4:
Find the subroutine labeled "sub_71B4C", and replace it with this.
sub_71B4C: ; XREF: loc_B10; PalToCRAM cmpi.b #$01,($FFFFFFFC).w beq.s loc_71B82 move.w #$100,($A11100).l ; stop the Z80 loc_71B5A: btst #0,($A11100).l bne.s loc_71B5A move.b ($A01FFD).l,d0 btst #7,d0 bra.s loc_71B82 move.w #0,($A11100).l ; start the Z80 bra.s sub_71B4C
This is what we needed the driver flag for. Without this subroutine, the regular S1 drum driver won't play, but it's unnecessary to the new PCM driver, and also decreases the quality of the new PCM driver without this modification (since it stops the Z80). However, it's changed so that if the new PCM driver is in use, it'll skip stopping the Z80, preserving the quality of the music.
Step 5:
Find the subroutine labeled "Sound_81to9F", and add this code to the beginning:
; --------------------------------------------------------------------------- PlayMusic81: jsr Sound_E4 jsr PCMDriverLoad move.w #$100,($A11100).l ;Stop the Z80 WaitZ80_81: btst #0,($A11100).l bne WaitZ80_81 ;Wait for z80 to stop move.b #1,($a00039).l ;turn the driver on move.b #(((Music81+$34)&0xFF0000)>>16),($a0003c).l ;location - $__xxxx move.b #(((Music81+$34)&0xFF00)>>8),($a0003b).l ;location - $xx__xx move.b #((Music81+$34)&0xFF),($a0003a).l ;location - $xxxx__ move.b #(((Music82-Music81)&0xFF0000)>>16),($a0003f).l ;length - $__xxxx move.b #(((Music82-Music81)&0xFF00)>>8),($a0003e).l ;length - $xx__xx move.b #((Music82-Music81)&0xFF),($a0003d).l ;length - $xxxx__ move.b #$0C,($a00046).l ;sample rate (00=22050Hz, 05=16000Hz, 0C=11025Hz, 15=8000Hz) move.b #$01,($a0004A).l ;looping flag ($00=no,$01=yes) move.w #$0,($A11100).l ;Start the Z80 rts ; ---------------------------------------------------------------------------
This is the code that would actually play song $81. From the comments, you should be able to pretty much tell what it does. (Just in case you can't figure out, (Music82-Music81) equals the length of Music81.) You need to do one final thing to get it to play:
Add this at the beginning of Sound_81to9F:
Sound_81to9F: ; XREF: Sound_ChkValue cmpi.b #$81,d7 beq.l PlayMusic81 jmp Continue8129F nop ; --------------------------------------------------------------------------- PlayMusic81: jsr Sound_E4 jsr PCMDriverLoad move.w #$100,($A11100).l ;Stop the Z80 WaitZ80_81: btst #0,($A11100).l bne WaitZ80_81 ;Wait for z80 to halt move.b #1,($a00039).l ;turn the wav playing script on move.b #(((Music81+$34)&0xFF0000)>>16),($a0003c).l ;addr - $__xxxx move.b #(((Music81+$34)&0xFF00)>>8),($a0003b).l ;addr - $xx__xx move.b #((Music81+$34)&0xFF),($a0003a).l ;addr - $xxxx__ move.b #(((Music82-Music81)&0xFF0000)>>16),($a0003f).l ;addr - $__xxxx move.b #(((Music82-Music81)&0xFF00)>>8),($a0003e).l ;addr - $xx__xx move.b #((Music82-Music81)&0xFF),($a0003d).l ;addr - $xxxx__ move.b #$0C,($a00046).l ;sample rate (00=22050Hz, 05=16000Hz, 0C=11025Hz, 15=8000Hz) move.b #$01,($a0004A).l ;looping flag ($00=no,$01=yes) move.w #$0,($A11100).l ;Start the Z80 rts ; --------------------------------------------------------------------------- Continue8129F: jsr SoundDriverLoad cmpi.b #$88,d7 ; is "extra life" music played? bne.s loc_72024 ; if not, branch
Let's say that, in your split disassembly, music82.bin was also a wav file, and you wanted it to play too. Then the subroutine would look like this:
Sound_81to9F: ; XREF: Sound_ChkValue cmpi.b #$81,d7 beq.l PlayMusic81 cmpi.b #$82,d7 beq.l PlayMusic82 jmp Continue8129F nop ; --------------------------------------------------------------------------- PlayMusic81: jsr Sound_E4 jsr PCMDriverLoad move.w #$100,($A11100).l ;Stop the Z80 WaitZ80_81: btst #0,($A11100).l bne WaitZ80_81 ;Wait for z80 to halt move.b #1,($a00039).l ;turn the wav playing script on move.b #(((Music81+$34)&0xFF0000)>>16),($a0003c).l ;addr - $__xxxx move.b #(((Music81+$34)&0xFF00)>>8),($a0003b).l ;addr - $xx__xx move.b #((Music81+$34)&0xFF),($a0003a).l ;addr - $xxxx__ move.b #(((Music82-Music81)&0xFF0000)>>16),($a0003f).l ;addr - $__xxxx move.b #(((Music82-Music81)&0xFF00)>>8),($a0003e).l ;addr - $xx__xx move.b #((Music82-Music81)&0xFF),($a0003d).l ;addr - $xxxx__ move.b #$0C,($a00046).l ;sample rate (00=22050Hz, 05=16000Hz, 0C=11025Hz, 15=8000Hz) move.b #$01,($a0004A).l ;looping flag ($00=no,$01=yes) move.w #$0,($A11100).l ;Start the Z80 rts ; --------------------------------------------------------------------------- ; --------------------------------------------------------------------------- PlayMusic82: jsr Sound_E4 jsr PCMDriverLoad move.w #$100,($A11100).l ;Stop the Z80 WaitZ80_82: btst #0,($A11100).l bne WaitZ80_82 ;Wait for z80 to halt move.b #1,($a00039).l ;turn the wav playing script on move.b #(((Music82+$34)&0xFF0000)>>16),($a0003c).l ;addr - $__xxxx move.b #(((Music82+$34)&0xFF00)>>8),($a0003b).l ;addr - $xx__xx move.b #((Music82+$34)&0xFF),($a0003a).l ;addr - $xxxx__ move.b #(((Music83-Music82)&0xFF0000)>>16),($a0003f).l ;addr - $__xxxx move.b #(((Music83-Music82)&0xFF00)>>8),($a0003e).l ;addr - $xx__xx move.b #((Music83-Music82)&0xFF),($a0003d).l ;addr - $xxxx__ move.b #$0C,($a00046).l ;sample rate (00=22050Hz, 05=16000Hz, 0C=11025Hz, 15=8000Hz) move.b #$01,($a0004A).l ;looping flag ($00=no,$01=yes) move.w #$0,($A11100).l ;Start the Z80 rts ; --------------------------------------------------------------------------- Continue8129F: jsr SoundDriverLoad cmpi.b #$88,d7 ; is "extra life" music played? bne.s loc_72024 ; if not, branch
Hopefully you understood all of that...as I've said many times, I'm not good at explaining things. If you have any questions about this, just ask. =P
====================
tl;dr: You can put WAVs in for your level music now. You'll have to read the whole post to see how. -
Better-Sounding PCM Music
27 April 2008 - 03:56 PM
You might remember the new S1 sound driver I released October of last year, which could play streaming PCMs for level music (or any other purpose) through the Z80. The sound quality of the driver was extremely distorted and crappy (which was actually not the driver itself's fault). Since then, I've found a way to make the PCM playback sound much better. Here's a S1 ROM showcasing the improvement:
S1 PCM Test
For comparison, here's an old PCM test without the fixes I made:
Old PCM Test
Details on how to integrate the PCM driver, along with the fixes I made, will come soon.
Music Choices for New PCM Test:
GHZ - Collision Chaos Good Future Jap.
LZ - Lost World (Chased By a Rock!)
MZ - Volcano XZ (Sonic Xtreme)
SLZ - Stardust Speedway Good Future Jap.
SYZ - Casinopolis
SBZ - Metallic Madness Present Jap.
Title - Super Smash Bros. Brawl Main Theme -
Dustin Wyatt's Epic Adventure
02 March 2008 - 05:43 PM
Latest Update:
November 28, 2009 - Chimpo Man's Stage - Video
Note that almost all of the below information and pictures in this post are obsolete; they are simply the original images I posted of this hack. The original post dates back to March of 2008.
========================
Behold my awesome new hack! I call it "Dustin Wyatt's Epic Adventure".


So basically Tweaker decides to kick some ass so he gets his blaster and starts shooting things (like Down Syndrome Sonic heads!).
Current plans for levels (don't know the rest yet; feel free to suggest!):
GHZ: Intro Stage (the one in the picture)
MZ: Chimpo Man's Stage
SYZ: Shade Man's Stage
FZ: Sazpai Man's Stage
also, sum music:
http://www.fileden.c...488/junkman.vgm
Chimpo Man's Stage theme
http://www.fileden.c...150488/bass.vgm
Boss theme -
Sonic Adventure Music in Sonic 1
07 October 2007 - 05:54 PM
prepare for a tl;dr post guys.
As you may or may not know, I've been experimenting with different ways to play full PCMs over the past few weeks, and came up with a new S1 PCM driver based on the one that came with drx's code template which can support a 3-byte length, variable pitch, and looping (based on a looping flag). The driver doesn't work perfectly in S1 yet, there's still some distorted sound. Tweaker says the DAC works best when the 68K is frozen, but I don't know how to do that without slowing down/stopping the game, so some music sounds distorted and crappy.
Anyway, here's the ROM. Music choices are:
GHZ = Emerald Coast (Azure Blue Sky)
MZ = Red Mountain (Mt. Red - A Symbol Of Pride)
SYZ = Casinopolis (The Dreamy Stage)
LZ = Lost World (DANGER - Chased By A Rock!)
SLZ = Speed Highway (whatever the first song's name is)
SBZ = Final Egg (Mechanical Resonance)
Boss = SCD Jap. Boss Theme (yes, I know this isn't from Sonic Adventure)
FZ = Perfect Chaos
GHZ and LZ sound a little distorted, but they still sound like the original song.
I'll also take this topic to release the new driver, with instructions on how to integrate it into the ROM. Here's the new sound driver. It doesn't replace the old one, but instead works as a second driver for the PCM songs. To make this driver work with the S1 ROM, first put this at the end of the ROM:
PCMDriverLoad: ; XREF: GameClrRAM; TitleScreen move.w #0,($A11200).l move.w #$100,($A11100).l move.w #$100,($A11200).l WaitForZ80_2: btst #0,($A11100).l bne WaitForZ80_2 lea (Kos_Z80_2),a0 lea ($A00000).l,a1 move.W #KosZ802End-Kos_Z80_2,d1 LoadDriver: move.b (a0)+,(a1)+ dbf d1,LoadDriver rts
That's the subroutine that loads the PCM Driver. You'll also need to insert the second sound driver after that, which would be like this:
Kos_Z80_2: incbin sound\PCMD.bin KosZ802End:
PCM playing is handled at the beginning of the subroutine Sound_81to9F. At the beginning of Sound_81To9F, put a jump to SoundDriverLoad, which loads the original DAC sound driver for regular songs. To actually play a PCM song, put this before the jump to SoundDriverLoad:
cmpi.b #$81,d7 beq.l PlayMusic81 jmp Continue8129F
Replace the #$81 and PlayMusic81 with the respective values (e.g. #$82 and PlayMusic82) for respective songs. After that code, we need to put the actual code that plays the song, which would look like this:
; --------------------------------------------------------------------------- PlayMusic81: jsr Sound_E4 move.w #$100,($A11100).l ;Stop the Z80 WaitZ80_81: btst #0,($A11100).l bne WaitZ80_81 ;Wait for z80 to halt jsr PCMDriverLoad move.b #1,($a00039).l ;Turn PCM Playing Flag ON move.b #((Music81&0xFF0000)>>16),($a0003c).l ;addr - $__xxxx move.b #((Music81&0xFF00)>>8),($a0003b).l ;addr - $xx__xx move.b #(Music81&0xFF),($a0003a).l ;addr - $xxxx__ move.b #(((Music82-Music81)&0xFF0000)>>16),($a0003f).l ;addr - $__xxxx move.b #(((Music82-Music81)&0xFF00)>>8),($a0003e).l ;addr - $xx__xx move.b #((Music82-Music81)&0xFF),($a0003d).l ;addr - $xxxx__ move.b #$06,($a00046).l ;sample rate (06=8000KHz) move.b #$01,($a00048).l ;looping flag ($00=no,$01=yes) move.w #$0,($A11100).l ;Start the Z80 rts ; ---------------------------------------------------------------------------
Again, replace all respective values. The Music82-Music81 is signifying the length; Music82 starts at the end of Music81, so Music82-Music81 is the length of the song Music81.
Make more subroutines just like that and do more compares for more PCMs you want to play. After the end of the subroutine PlayMusic81, just put the label Continue8129F. And you're done. The whole thing should look like this:
Sound_81to9F: ; XREF: Sound_ChkValue cmpi.b #$81,d7 beq.l PlayMusic81 jmp Continue8129F ; --------------------------------------------------------------------------- PlayMusic81: jsr Sound_E4 move.w #$100,($A11100).l ;Stop the Z80 WaitZ80_81: btst #0,($A11100).l bne WaitZ80_81 ;Wait for z80 to halt jsr PCMDriverLoad move.b #1,($a00039).l ;Turn PCM Playing Flag ON move.b #((Music81&0xFF0000)>>16),($a0003c).l ;addr - $__xxxx move.b #((Music81&0xFF00)>>8),($a0003b).l ;addr - $xx__xx move.b #(Music81&0xFF),($a0003a).l ;addr - $xxxx__ move.b #(((Music82-Music81)&0xFF0000)>>16),($a0003f).l ;addr - $__xxxx move.b #(((Music82-Music81)&0xFF00)>>8),($a0003e).l ;addr - $xx__xx move.b #((Music82-Music81)&0xFF),($a0003d).l ;addr - $xxxx__ move.b #$06,($a00046).l ;sample rate (06=8000KHz) move.b #$01,($a00048).l ;looping flag ($00=no,$01=yes) move.w #$0,($A11100).l ;Start the Z80 rts ; --------------------------------------------------------------------------- Continue8129F: jsr SoundDriverLoad cmpi.b #$88,d7 ; is "extra life" music played? bne.s loc_72024 ; if not, branch tst.b $27(a6)
It should be fairly obvious how to add more songs. I hope you understood what to do, because I suck at explaining things =P
Hopefully this will open up the gates to much more awesome-sounding music in Sonic games.
Friends
Sonic 65 hasn't added any friends yet.

Find My Content
Apr 16 2015 01:45 AM
Male