Actions

SCHG How-to Talk

Difference between revisions of "Fix the SEGA Sound"

From Sonic Retro

 
Line 2: Line 2:
 
:I always thought it was because there was a remnant left of the old WAV... [[User:Overlord|Overlord]] 13:33, 27 September 2009 (UTC)
 
:I always thought it was because there was a remnant left of the old WAV... [[User:Overlord|Overlord]] 13:33, 27 September 2009 (UTC)
 
::Which old .wav? Forgive me, I'm a noob. --[[User:ShadowDog|ShadowDog]] 16:48, 27 September 2009 (UTC)
 
::Which old .wav? Forgive me, I'm a noob. --[[User:ShadowDog|ShadowDog]] 16:48, 27 September 2009 (UTC)
 +
:::The upper 32k of the Z80 memory map is a bank, and for the SEGA PCM sample that bank is switched to the region in ROM from $78000 to $80000; it then reads a specified portion from the end of the bank and feeds it to the YM2612 to be played. When data is added to the Sonic 1 ROM, the end of the WAV is pushed past $80000 an can't be read by the Z80, which instead reads garbage data and therefore produces static.
 +
:::In theory if the last $8000 bytes of the ROM get pushed past $80000 then the bank will be moved (Hivebrain was astute enough to put the bank location in the disassembly rather than leaving it hard-coded); however, IIRC there's still a bit hard-coded which dictates whether the bank is read from $x0000 or $x8000, so it may need to be pushed past $88000 to work correctly. Puto's solution is better at any rate, since it shifts the work onto the 68k and therefore avoids the awkwardness that is Z80 bankswitching. [[User:Quickman|Quickman]] 18:09, 29 January 2010 (UTC)

Latest revision as of 14:09, 29 January 2010

Anyone know why it does the scretch to begin with? --ShadowDog 06:22, 27 September 2009 (UTC)

I always thought it was because there was a remnant left of the old WAV... Overlord 13:33, 27 September 2009 (UTC)
Which old .wav? Forgive me, I'm a noob. --ShadowDog 16:48, 27 September 2009 (UTC)
The upper 32k of the Z80 memory map is a bank, and for the SEGA PCM sample that bank is switched to the region in ROM from $78000 to $80000; it then reads a specified portion from the end of the bank and feeds it to the YM2612 to be played. When data is added to the Sonic 1 ROM, the end of the WAV is pushed past $80000 an can't be read by the Z80, which instead reads garbage data and therefore produces static.
In theory if the last $8000 bytes of the ROM get pushed past $80000 then the bank will be moved (Hivebrain was astute enough to put the bank location in the disassembly rather than leaving it hard-coded); however, IIRC there's still a bit hard-coded which dictates whether the bank is read from $x0000 or $x8000, so it may need to be pushed past $88000 to work correctly. Puto's solution is better at any rate, since it shifts the work onto the 68k and therefore avoids the awkwardness that is Z80 bankswitching. Quickman 18:09, 29 January 2010 (UTC)