Actions

SCHG How-to

Difference between revisions of "Port Sonic 3's Sound Driver to Sonic 2"

From Sonic Retro

(Optional: Fix the level select)
m (Super minor change, I just changed how the download link works. Sorry for constantly editing this page!)
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{GuideBy|Kram1024}}
 
{{GuideBy|Kram1024}}
 +
 +
'''Updated and fixed by''' [[User:WBilgini]]
  
 
You probably saw my method of placing the Sonic 3 sound driver in Sonic 1. Well, we are going to put it in Sonic 2 Rev01 this time. The changes are very similar to that of the Sonic 1 port.  Over the years, I found that the S3 driver actually works without a Sonic game with minimal hacking (it just needs a wait routine to time it). Thus it is actually possible to put it into Sonic 2 with relative ease as well and into a homebrew too, though in homebrew it might not be legal anyways due to IP laws but Sega no longer enforces them on Genesis games anyways, thus why nobody gets sued for Sonic hacks, but let's get back to the hack.
 
You probably saw my method of placing the Sonic 3 sound driver in Sonic 1. Well, we are going to put it in Sonic 2 Rev01 this time. The changes are very similar to that of the Sonic 1 port.  Over the years, I found that the S3 driver actually works without a Sonic game with minimal hacking (it just needs a wait routine to time it). Thus it is actually possible to put it into Sonic 2 with relative ease as well and into a homebrew too, though in homebrew it might not be legal anyways due to IP laws but Sega no longer enforces them on Genesis games anyways, thus why nobody gets sued for Sonic hacks, but let's get back to the hack.
Line 12: Line 14:
 
Unlike the S1 driver, Sonic 2 actually calls the driver over and over again after stopping the Z80 then restarting the Z80. The PlaySound routine of our new driver will do that automatically, so we do not really need any of that kind of code.
 
Unlike the S1 driver, Sonic 2 actually calls the driver over and over again after stopping the Z80 then restarting the Z80. The PlaySound routine of our new driver will do that automatically, so we do not really need any of that kind of code.
 
We will search for all instances of:  
 
We will search for all instances of:  
<asm>
+
<pre>
 
stopZ80 ; stop the Z80
 
stopZ80 ; stop the Z80
 
bsr.w sndDriverInput ; give input to the sound driver
 
bsr.w sndDriverInput ; give input to the sound driver
 
startZ80 ; start the Z80
 
startZ80 ; start the Z80
</asm>
+
</pre>
 
and comment it out or just plain remove it. I prefer to replace it with a nop instruction, but even comments or removal work as well.
 
and comment it out or just plain remove it. I prefer to replace it with a nop instruction, but even comments or removal work as well.
 
In case you are a little lazy, here is a list of routines with this code:
 
In case you are a little lazy, here is a list of routines with this code:
Line 23: Line 25:
 
*'''Vint0_noWater''' (only touch the " bsr.w sndDriverInput ; give input to the sound driver" line)
 
*'''Vint0_noWater''' (only touch the " bsr.w sndDriverInput ; give input to the sound driver" line)
 
*'''loc_748''' (only touch the " bsr.w sndDriverInput ; give input to the sound driver" line)
 
*'''loc_748''' (only touch the " bsr.w sndDriverInput ; give input to the sound driver" line)
*'''Vint10_specialStage''' (only touch the " jsr (sndDriverInput).l)
+
*'''Vint_Pause_specialStage''' (only touch the " jsr (sndDriverInput).l)
*'''loc_92A+++++''' (only touch the " jsr (sndDriverInput).l)
+
*'''off_97A''' (only touch the " jsr (sndDriverInput).l)
 
*'''loc_BD6''' (only touch the " jsr (sndDriverInput).l)
 
*'''loc_BD6''' (only touch the " jsr (sndDriverInput).l)
 
*'''VintSub18''' (only touch the " bsr.w sndDriverInput)
 
*'''VintSub18''' (only touch the " bsr.w sndDriverInput)
Line 32: Line 34:
 
===Removal of sndDriverInput===
 
===Removal of sndDriverInput===
 
Okay, we disabled the Sonic 2 Z80 sound driver junk, but we still have a vestige of the old driver taking up valuable ROM space. Locate:
 
Okay, we disabled the Sonic 2 Z80 sound driver junk, but we still have a vestige of the old driver taking up valuable ROM space. Locate:
<asm>
+
<pre>
 
sndDriverInput:
 
sndDriverInput:
 
lea (Music_to_play&$00FFFFFF).l,a0
 
lea (Music_to_play&$00FFFFFF).l,a0
lea (Z80_RAM+zComRange).l,a1 ; $A01B80
+
lea (Z80_RAM+zAbsVar).l,a1 ; $A01B80
cmpi.b #$80,8(a1) ; If this (zReadyFlag) isn't $80, the driver is processing a previous sound request.
+
cmpi.b #$80,zVar.QueueToPlay(a1) ; If this (zReadyFlag) isn't $80, the driver is processing a previous sound request.
 
bne.s loc_10C4 ; So we'll wait until at least the next frame before putting anything in there.
 
bne.s loc_10C4 ; So we'll wait until at least the next frame before putting anything in there.
 
_move.b 0(a0),d0
 
_move.b 0(a0),d0
Line 51: Line 53:
 
loc_10AE: ; Check that the sound is not FE or FF
 
loc_10AE: ; Check that the sound is not FE or FF
 
move.b d0,d1 ; If it is, we need to put it in $A01B83 as $7F or $80 respectively
 
move.b d0,d1 ; If it is, we need to put it in $A01B83 as $7F or $80 respectively
subi.b #$FE,d1
+
subi.b #MusID_Pause,d1
 
bcs.s loc_10C0
 
bcs.s loc_10C0
 
addi.b #$7F,d1
 
addi.b #$7F,d1
move.b d1,3(a1)
+
move.b d1,zVar.StopMusic(a1)
 
bra.s loc_10C4
 
bra.s loc_10C4
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
  
 
loc_10C0:
 
loc_10C0:
move.b d0,8(a1)
+
move.b d0,zVar.QueueToPlay(a1)
  
 
loc_10C4:
 
loc_10C4:
Line 66: Line 68:
 
- move.b 1(a0,d1.w),d0 ; FFE3 (unk_FFE3) goes to 1B8B, (unknown)
 
- move.b 1(a0,d1.w),d0 ; FFE3 (unk_FFE3) goes to 1B8B, (unknown)
 
beq.s + ; FFE2 (SFX_to_play_2) goes to 1B8A (zSFXToPlay2),
 
beq.s + ; FFE2 (SFX_to_play_2) goes to 1B8A (zSFXToPlay2),
tst.b 9(a1,d1.w) ; FFE1 (SFX_to_play) goes to 1B89 (zSFXToPlay).
+
tst.b zVar.SFXToPlay(a1,d1.w) ; FFE1 (SFX_to_play) goes to 1B89 (zSFXToPlay).
 
bne.s +
 
bne.s +
 
clr.b 1(a0,d1.w)
 
clr.b 1(a0,d1.w)
move.b d0,9(a1,d1.w)
+
move.b d0,zVar.SFXToPlay(a1,d1.w)
 
+
 
+
 
dbf d1,-
 
dbf d1,-
 
rts
 
rts
 
; End of function sndDriverInput
 
; End of function sndDriverInput
</asm>
+
</pre>
 
and remove it.  We don't need it anymore because the Sonic 3 driver does this stuff on its own, in its own way.
 
and remove it.  We don't need it anymore because the Sonic 3 driver does this stuff on its own, in its own way.
  
Line 82: Line 84:
 
Delete everything from SoundDriverLoad until the line "; end of 'ROM'"
 
Delete everything from SoundDriverLoad until the line "; end of 'ROM'"
  
In its place, paste this:
+
In its place, paste the code inside this file:
<asm>
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (20 blocks)
 
; Buzzer's fireball
 
ArtNem_Buzzer_Fireball: BINCLUDE "art/nemesis/Fireball 1 (Buzzer).bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (24 blocks)
 
; Waterfall tiles
 
ArtNem_Waterfall: BINCLUDE "art/nemesis/Waterfall tiles.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (16 blocks)
 
; Another fireball
 
ArtNem_HtzFireball: BINCLUDE "art/nemesis/Fireball 2.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (8 blocks)
 
; Bridge in EHZ
 
ArtNem_EHZ_Bridge: BINCLUDE "art/nemesis/EHZ bridge.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (48 blocks)
 
; Diagonally moving lift in HTZ
 
ArtNem_HtzZipline: BINCLUDE "art/nemesis/HTZ zip-line platform.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (4 blocks)
 
; One way barrier from HTZ
 
ArtNem_HtzValveBarrier: BINCLUDE "art/nemesis/One way barrier from HTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (24 blocks)
 
; See-saw in HTZ
 
ArtNem_HtzSeeSaw: BINCLUDE "art/nemesis/See-saw in HTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (24 blocks)
 
; Unused Fireball
 
;ArtNem_F0B06:
 
BINCLUDE "art/nemesis/Fireball 3.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (20 blocks)
 
; Rock from HTZ
 
ArtNem_HtzRock: BINCLUDE "art/nemesis/Rock from HTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (4 blocks)
 
; Orbit badnik from HTZ ; ArtNem_HtzSol:
 
ArtNem_Sol: BINCLUDE "art/nemesis/Sol badnik from HTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (120 blocks)
 
; Large spinning wheel from MTZ
 
ArtNem_MtzWheel: BINCLUDE "art/nemesis/Large spinning wheel from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (9 blocks)
 
; Indent in large spinning wheel from MTZ
 
ArtNem_MtzWheelIndent: BINCLUDE "art/nemesis/Large spinning wheel from MTZ - indent.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (8 blocks)
 
; Spike block from MTZ
 
ArtNem_MtzSpikeBlock: BINCLUDE "art/nemesis/MTZ spike block.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (15 blocks)
 
; Steam from MTZ
 
ArtNem_MtzSteam: BINCLUDE "art/nemesis/Steam from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (8 blocks)
 
; Spike from MTZ
 
ArtNem_MtzSpike: BINCLUDE "art/nemesis/Spike from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (54 blocks)
 
; Similarly shaded blocks from MTZ
 
ArtNem_MtzAsstBlocks: BINCLUDE "art/nemesis/Similarly shaded blocks from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (9 blocks)
 
; Lava bubble from MTZ
 
ArtNem_MtzLavaBubble: BINCLUDE "art/nemesis/Lava bubble from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (4 blocks)
 
; Lava cup
 
ArtNem_LavaCup: BINCLUDE "art/nemesis/Lava cup from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (8 blocks)
 
; End of a bolt and rope from MTZ
 
ArtNem_BoltEnd_Rope: BINCLUDE "art/nemesis/Bolt end and rope from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (12 blocks)
 
; Small cog from MTZ
 
ArtNem_MtzCog: BINCLUDE "art/nemesis/Small cog from MTZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (4 blocks)
 
; Unknown. Four blocks that are all the same colour from MTZ.
 
ArtNem_MtzUnkBlocks: BINCLUDE "art/nemesis/Unknown MTZ sprite.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (32 blocks)
 
; Large wooden box from MCZ ; ArtNem_F187C:
 
ArtNem_Crate: BINCLUDE "art/nemesis/Large wooden box from MCZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (26 blocks)
 
; Collapsing platform from MCZ ; ArtNem_F1ABA:
 
ArtNem_MCZCollapsePlat: BINCLUDE "art/nemesis/Collapsing platform from MCZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (16 blocks)
 
; Switch that you pull on from MCZ ; ArtNem_F1C64:
 
ArtNem_VineSwitch: BINCLUDE "art/nemesis/Pull switch from MCZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (10 blocks)
 
; Vine that lowers in MCZ ; ArtNem_F1D5C:
 
ArtNem_VinePulley: BINCLUDE "art/nemesis/Vine that lowers from MCZ.bin"
 
; --------------------------------------------------------------------
 
; Nemesis compressed art (20 blocks)
 
; Log viewed from the end for folding gates in MCZ (start of MCZ2) ; ArtNem_F1E06:
 
ArtNem_MCZGateLog: BINCLUDE "art/nemesis/Drawbridge logs from MCZ.bin"
 
 
 
; ---------------------------------------------------------------------------
 
; Subroutine to load the sound driver
 
; ---------------------------------------------------------------------------
 
; sub_EC000:
 
SoundDriverLoad:
 
nop
 
move.w #$100,($A11100).l ; Z80 bus request - Start
 
move.w #$100,($A11200).l ; Z80 stop reset
 
lea (DriverData).l,a0
 
lea ($A00000).l,a1
 
move.w #DriverDataEnd-DriverData,d0
 
 
 
DriverLoadLoop:
 
move.b (a0)+,(a1)+
 
dbf d0,DriverLoadLoop
 
lea (DriverPointers).l,a0
 
lea ($A01300).l,a1
 
move.w #DriverPointersEnd-DriverPointers,d0
 
 
 
DriverPointersLoadLoop:
 
move.b (a0)+,(a1)+
 
dbf d0, DriverPointersLoadLoop
 
lea (UniversalVoiceBank).l,a0
 
lea ($A017D8).l,a1
 
move.w #UniversalVoiceBankEnd-UniversalVoiceBank,d0
 
 
 
UniversalVoiceBankLoadLoop:
 
move.b (a0)+,(a1)+
 
dbf d0,UniversalVoiceBankLoadLoop
 
lea (DriverResetData).l,a0
 
lea ($A01C00).l,a1
 
move.w #DriverResetDataEnd-DriverResetData,d0
 
 
 
DriverResetDataLoadLoop:
 
move.b (a0)+,(a1)+
 
dbf d0,DriverResetDataLoadLoop
 
btst #6,($FFFFFFF8).w
 
beq.s DriverAlreadyInitialized
 
move.b #1,($A01C02).l
 
 
 
DriverAlreadyInitialized:
 
move.w #0,($A11200).l
 
nop
 
nop
 
nop
 
nop
 
move.w #$100,($A11200).l ; Z80 start reset
 
move.w #0,($A11100).l ; Z80 bus request - Stop
 
rts
 
; End of function SoundDriverLoad
 
 
 
  
DriverResetData:
+
{{Download|file=SoundDriverLoadCode.asm|filesize=54kb|title=The Sonic 3 Sound Driver Load code|plural=0}}
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
'''Note:''' Linux systems and some mac installs have a case sensitive filesystem  and that can cause build errors,<br>
DriverResetDataEnd:
+
to fix, simply rename all non-sound effects to lowercase names.
  
align $8000
 
DriverData:
 
dc.b $F3,$F3,$ED,$56,$C3,$89,$00,$00
 
dc.b $2A,$15
 
dc.b $00,$06,$00,$09,$08,$7E
 
dc.b $23,$66,$6F,$08,$C9
 
dc.w ((($1300&$1FFF)>>$08)|(($1300&$1FFF)<<$08))&$FFFF
 
dc.b $00,$4F,$06,$00,$09,$09,$00,$00,$00
 
dc.b $7E,$23,$66,$6F,$C9,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$F3,$F5,$FD,$E5,$D9,$ED,$5F,$32
 
dc.b $17,$1C,$CD,$21,$01,$3A,$02,$1C,$B7,$28,$12,$3A,$04,$1C,$B7,$20
 
dc.b $08,$3E,$06,$32,$04,$1C,$C3,$3D,$00,$3D,$32,$04,$1C,$AF,$32,$21
 
dc.b $1C,$3A,$30,$1C,$E6,$7F,$4F,$06,$00,$21,$DC,$00,$09,$7E
 
Z80_0x006E:
 
dc.b $C3,$4C,$11
 
dc.b $77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77
 
dc.b $AF,$77
 
Z80_0x0082:
 
dc.b $D9,$FD,$E1,$F1,$06,$01,$C9,$31,$00,$20,$0E,$00,$06,$00
 
dc.b $10,$FE,$0D,$28,$F9,$CD,$29,$09,$3E,$80,$3E,$06,$32,$3E,$1C,$AF
 
dc.b $32,$27,$1C,$32,$30,$1C,$32,$3F,$1C,$32,$28,$1C,$3E,$05,$32,$04
 
dc.b $1C,$FB,$C3,$62,$10,$DD,$CB,$01,$7E,$C0,$DD,$CB,$00,$56,$C0,$DD
 
dc.b $86,$01,$DD,$CB,$01,$56,$20,$09,$32,$00,$40,$00,$79,$32,$01,$40
 
dc.b $C9,$D6,$04,$32,$02,$40,$00,$79,$32,$03,$40,$C9
 
Z80_0x00DC:
 
Dac_Sample_Selector:
 
dc.b ((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F))
 
dc.b ((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F))
 
dc.b ((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F))
 
dc.b ((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F))
 
dc.b ((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F))
 
dc.b ((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F))
 
dc.b ((DacBank0>>$F)),((DacBank0>>$F)),((DacBank0>>$F)),((DacBank1>>$F))
 
dc.b ((DacBank1>>$F)),((DacBank1>>$F)),((DacBank1>>$F)),((DacBank1>>$F))
 
dc.b ((DacBank1>>$F)),((DacBank1>>$F)),((DacBank1>>$F)),((DacBank1>>$F))
 
dc.b ((DacBank1>>$F)),((DacBank1>>$F)),((DacBank1>>$F)),((DacBank1>>$F))
 
dc.b ((DacBank1>>$F)),((DacBank1>>$F)),((DacBank1>>$F)),((DacBank2>>$F))
 
dc.b ((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F))
 
dc.b ((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F))
 
dc.b ((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F))
 
dc.b ((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F))
 
dc.b ((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F))
 
dc.b ((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F)),((DacBank2>>$F))
 
dc.b ((DacBank2>>$F))
 
dc.b $CD,$E8,$07,$CD,$A2,$01,$CD,$B1,$09,$CD,$62,$08,$CD,$C6,$08
 
dc.b $3A,$16,$1C,$FE,$29,$20,$18,$3A,$0A,$1C,$FE,$2A,$28,$04,$FE,$32
 
dc.b $38,$04,$AF,$32,$0A,$1C,$AF,$32,$0B,$1C,$32,$0C,$1C,$18,$1F,$3A
 
dc.b $16,$1C,$FE,$FF,$28,$18,$21,$0A,$1C,$5E,$23,$56,$23,$7E,$B2,$B3
 
dc.b $28,$0C,$CD,$C7,$09,$CD,$DF,$04,$CD,$DF,$04,$CD,$DF,$04
 
Z80_0x016E:
 
dc.b $3A,$3E,$1C
 
dc.b $FE,$00
 
dc.b $C2
 
dc.w (((Z80DefaultBankSwitch&$1FFF)>>$08)|((Z80DefaultBankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $CD
 
dc.w (((Z80BankSwitch0&$1FFF)>>$08)|((Z80BankSwitch0&$1FFF)<<$08))&$FFFF
 
dc.b $18,$03
 
Z80DefaultBankSwitch:
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00
 
Z80_0x0183:
 
dc.b $AF,$32,$19,$1C,$3A,$16,$1C,$FE,$FF,$CC,$05,$0A,$DD
 
dc.b $21,$40,$1C,$DD,$CB,$00,$7E,$C4,$7A,$0B,$06,$08,$DD,$21,$70,$1C
 
dc.b $18,$1A,$3E,$01,$32,$19,$1C
 
Z80_0x01A7:
 
dc.b $3E, ((SndBank>>$0F))
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
dc.b $DD,$21,$F0,$1D,$06,$07,$C5,$DD,$CB,$00
 
dc.b $7E,$C4,$E6,$01,$11,$30,$00,$DD,$19,$C1,$10,$F0,$3A,$08,$1C,$B7
 
dc.b $C8,$3A,$2F,$1C,$B7,$C2,$E1,$01,$3A,$08,$1C,$32,$2F,$1C,$C3,$27
 
dc.b $01,$3D,$32,$2F,$1C,$C9,$DD,$CB,$01,$7E,$C2,$9C,$0F,$CD,$37,$03
 
dc.b $20,$17,$CD,$74,$02,$DD,$CB,$00,$66,$C0,$CD,$9B,$03,$CD,$6C,$04
 
dc.b $CD,$C6,$03,$CD,$28,$02,$C3,$3F,$03,$DD,$CB,$00,$66,$C0,$CD,$6A
 
dc.b $03,$DD,$7E,$1E,$B7,$28,$06,$DD,$35,$1E,$CA,$58,$03,$CD,$6C,$04
 
dc.b $DD,$CB,$00,$76,$C0,$CD,$C6,$03,$DD,$CB,$00,$56,$C0,$DD,$CB,$00
 
dc.b $46,$C2,$41,$02,$3E,$A4,$4C,$CD,$B5,$00,$3E,$A0,$4D,$CD,$B5,$00
 
dc.b $C9,$DD,$7E,$01,$FE,$02,$20,$EC,$06,$04,$21,$6F,$02,$C5,$7E,$23
 
dc.b $E5,$EB,$4E,$23,$46,$23,$EB,$DD,$6E,$0D,$DD,$66,$0E,$09,$F5,$4C
 
dc.b $CD,$C8,$00,$F1,$D6,$04,$4D,$CD,$C8,$00,$E1,$C1,$10,$DF,$C9,$AD
 
dc.b $AE,$AC,$A6,$C9,$DD,$5E,$03,$DD,$56,$04,$DD,$CB,$00,$8E,$DD,$CB
 
dc.b $00,$A6,$1A,$13,$FE,$E0,$D2,$CF,$0B,$08,$CD,$58,$03,$08,$DD,$CB
 
dc.b $00,$5E,$C2,$E5,$02,$B7,$F2,$05,$03,$D6,$81,$F2,$A3,$02,$CD,$44
 
dc.b $10,$18,$2E,$DD,$86,$05,$21,$88,$0A,$F5,$DF,$F1,$DD,$CB,$01,$7E
 
dc.b $20,$19,$D5,$16,$08,$1E,$0C,$08,$AF,$08,$93,$38,$05,$08,$82,$18
 
dc.b $F8,$08,$83,$21,$30,$0B,$DF,$08,$B4,$67,$D1,$DD,$75,$0D,$DD,$74
 
dc.b $0E,$1A,$B7,$F2,$04,$03,$DD,$7E,$0C,$DD,$77,$0B,$18,$2D,$1A,$13
 
dc.b $DD,$77,$11,$18,$1E,$67,$1A,$13,$6F,$B4,$28,$0C,$DD,$7E,$05,$06
 
dc.b $00,$B7,$F2,$F6,$02,$05,$4F,$09,$DD,$75,$0D,$DD,$74,$0E,$1A,$13
 
dc.b $DD,$77,$11,$1A,$13,$CD,$2D,$03,$DD,$77,$0C,$DD,$73,$03,$DD,$72
 
dc.b $04,$DD,$7E,$0C,$DD,$77,$0B,$DD,$CB,$00,$4E,$C0,$AF,$DD,$77,$25
 
dc.b $DD,$77,$22,$DD,$77,$17,$DD,$7E,$1F,$DD,$77,$1E,$C9,$DD,$46,$02
 
dc.b $05,$C8,$4F,$81,$10,$FD,$C9,$DD,$7E,$0B,$3D,$DD,$77,$0B,$C9,$DD
 
dc.b $7E,$0D,$DD,$B6,$0E,$C8,$DD,$7E,$00,$E6,$06,$C0,$DD,$7E,$01,$F6
 
dc.b $F0,$4F,$3E,$28,$CD,$C8,$00,$C9,$DD,$7E,$00,$E6,$06,$C0,$DD,$4E
 
dc.b $01,$CB,$79,$C0,$3E,$28,$CD,$C8,$00,$C9,$DD,$7E,$18,$B7,$C8,$F8
 
dc.b $3D,$0E,$0A,$CF,$DF,$CD,$12,$10,$DD,$66,$1D,$DD,$6E,$1C,$11,$AE
 
dc.b $04,$06,$04,$DD,$4E,$19,$F5,$CB,$29,$C5,$30,$08,$86,$E6,$7F,$4F
 
dc.b $1A,$CD,$B5,$00,$C1,$13,$23,$F1,$10,$EC,$C9,$DD,$CB,$07,$7E,$C8
 
dc.b $DD,$CB,$00,$4E,$C0,$DD,$5E,$20,$DD,$56,$21,$DD,$E5,$E1,$06,$00
 
dc.b $0E,$24,$09,$EB,$ED,$A0,$ED,$A0,$ED,$A0,$7E,$CB,$3F,$12,$AF,$DD
 
dc.b $77,$22,$DD,$77,$23,$C9,$DD,$7E,$07,$B7,$C8,$FE,$80,$20,$48,$DD
 
dc.b $35,$24,$C0,$DD,$34,$24,$E5,$DD,$6E,$22,$DD,$66,$23,$DD,$5E,$20
 
dc.b $DD,$56,$21,$D5,$FD,$E1,$DD,$35,$25,$20,$17,$FD,$7E,$01,$DD,$77
 
dc.b $25,$DD,$7E,$26,$4F,$E6,$80,$07,$ED,$44,$47,$09,$DD,$75,$22,$DD
 
dc.b $74,$23,$C1,$09,$DD,$35,$27,$C0,$FD,$7E,$03,$DD,$77,$27,$DD,$7E
 
dc.b $26,$ED,$44,$DD,$77,$26,$C9,$3D,$EB,$0E,$08,$CF,$DF,$18,$03,$DD
 
dc.b $77,$25,$E5,$DD,$4E,$25,$06,$00,$09,$7E,$E1,$CB,$7F,$CA,$5D,$04
 
dc.b $FE,$82,$28,$12,$FE,$80,$28,$12,$FE,$84,$28,$11,$26,$FF,$30,$1F
 
dc.b $DD,$CB,$00,$F6,$E1,$C9,$03,$0A,$18,$D5,$AF,$18,$D2,$03,$0A,$DD
 
dc.b $86,$22,$DD,$77,$22,$DD,$34,$25,$DD,$34,$25,$18,$C5,$26,$00,$6F
 
dc.b $DD,$46,$22,$04,$EB,$19,$10,$FD,$DD,$34,$25,$C9,$DD,$66,$0E,$DD
 
dc.b $6E,$0D,$06,$00,$DD,$7E,$10,$B7,$F2,$7D,$04,$06,$FF,$4F,$09,$C9
 
dc.b $2A,$37,$1C,$3A,$19,$1C,$B7,$28,$06,$DD,$6E,$2A,$DD,$66,$2B,$AF
 
dc.b $B0,$C8,$11,$19,$00,$19,$10,$FD,$C9,$B0,$30,$38,$34,$3C,$50,$58
 
dc.b $54,$5C,$60,$68,$64,$6C,$70,$78,$74,$7C,$80,$88,$84,$8C,$40,$48
 
dc.b $44,$4C,$90,$98,$94,$9C,$11,$99,$04,$DD,$4E,$0A,$3E,$B4,$CD,$B5
 
dc.b $00,$CD,$D7,$04,$DD,$77,$1B,$06,$14,$CD,$D7,$04,$10,$FB,$DD,$75
 
dc.b $1C,$DD,$74,$1D,$C3,$9C,$0C,$1A,$13,$4E,$23,$CD,$B5,$00,$C9,$3A
 
dc.b $05,$1C,$32,$09,$1C,$3A,$06,$1C,$32,$05,$1C,$3A,$07,$1C,$32,$06
 
dc.b $1C,$AF,$32,$07,$1C,$3A,$09,$1C,$FE,$FF,$CA,$FB,$09,$FE,$33,$DA
 
dc.b $4A,$05,$FE,$E0,$DA,$99,$06,$FE,$E1,$DA,$29,$09,$FE,$E6,$D2,$29
 
dc.b $09,$D6,$E1,$21,$1C,$05,$DF,$AF,$32,$18,$1C,$E9,$45,$08,$29,$09
 
dc.b $A1,$09,$26,$05,$45,$08,$DD,$21,$F0,$1D,$06,$07,$3E,$01,$32,$19
 
dc.b $1C,$C5,$DD,$CB,$00,$7E,$C4,$45,$05,$11,$30,$00,$DD,$19,$C1,$10
 
dc.b $F0,$CD,$80,$06,$C9,$E5,$E5,$C3,$61,$0C,$D6,$01,$F8,$F5,$FE,$29
 
dc.b $C2,$CD,$05,$3A,$29,$1C,$B7,$CA,$72,$05,$AF,$32,$0A,$1C,$32,$0B
 
dc.b $1C,$32,$0C,$1C,$32,$05,$1C,$32,$06,$1C,$32,$07,$1C,$32,$09,$1C
 
dc.b $F1,$C9,$3A,$16,$1C,$FE,$29,$CA,$D0,$05,$AF,$32,$0A,$1C,$32,$0B
 
dc.b $1C,$32,$0C,$1C,$32,$05,$1C,$32,$06,$1C,$32,$07,$1C,$3A,$3E,$1C
 
dc.b $32,$2D,$1C,$3A,$08,$1C,$32,$2E,$1C,$AF,$32,$08,$1C,$21,$40,$1C
 
dc.b $11,$F0,$1D,$01,$B0,$01,$ED,$B0,$21,$F0,$1D,$11,$30,$00,$06,$09
 
dc.b $7E,$E6,$7F,$CB,$D6,$77,$19,$10,$F7,$3E,$29,$32,$16,$1C,$3A,$24
 
dc.b $1C,$32,$2C,$1C,$2A,$37,$1C,$22,$2A,$1C,$C3,$D0,$05,$CD,$29,$09
 
dc.b $F1,$F5
 
Z80_0x05D2:
 
dc.b $21,$48,$0B
 
dc.b $85,$6F,$8C,$95,$67,$22,$DE,$05,$3A,$48,$0B
 
dc.b $32,$3E,$1C
 
Z80_0x05E3:
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
dc.b $3E,$B6,$32,$02,$40,$00,$3E,$C0,$32,$03,$40
 
dc.b $F1,$0E,$04,$CF,$DF,$E5,$E5,$E7,$22,$37,$1C,$E1,$FD,$E1,$FD,$7E
 
dc.b $05,$32,$13,$1C,$32,$24,$1C,$11,$06,$00,$19,$22,$33,$1C,$21,$85
 
dc.b $06,$22,$35,$1C,$11,$40,$1C,$FD,$46,$02,$FD,$7E,$04,$C5,$2A,$35
 
dc.b $1C,$ED,$A0,$ED,$A0,$12,$13,$22,$35,$1C,$2A,$33,$1C,$ED,$A0,$ED
 
dc.b $A0,$ED,$A0,$ED,$A0,$22,$33,$1C,$CD,$AE,$07,$C1,$10,$DF,$FD,$7E
 
dc.b $03,$B7,$CA,$80,$06,$47,$21,$93,$06,$22,$35,$1C,$11,$60,$1D,$FD
 
dc.b $7E,$04,$C5,$2A,$35,$1C,$ED,$A0,$ED,$A0,$12,$13,$22,$35,$1C,$2A
 
dc.b $33,$1C,$01,$06,$00,$ED,$B0,$22,$33,$1C,$CD,$B5,$07,$C1,$10,$E2
 
dc.b $AF,$32,$09,$1C,$C9,$80,$06,$80,$00,$80,$01,$80,$02,$80,$04,$80
 
dc.b $05,$80,$06,$80,$80,$80,$A0,$80,$C0,$D6,$33,$B7,$C2,$A7,$06,$3A
 
dc.b $28,$1C,$EE,$01,$32,$28,$1C,$08
 
Z80_0x06A8:
 
dc.b $3E, ((SndBank>>$0F))
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
Z80_0x06B7:
 
dc.b $AF,$0E,$06,$32,$19,$1C,$08,$FE,$78
 
dc.b $CA,$F5,$06,$FE,$89,$DA,$EF,$06,$F5,$47,$3A,$25,$1C,$90,$C2,$E4
 
dc.b $06,$3E,$80,$32,$26,$1C,$CF,$F1,$4F,$DF,$23,$23,$23,$7E,$32,$31
 
dc.b $1C,$C3,$80,$06,$AF,$32,$26,$1C,$F1,$32,$25,$1C,$C3,$F5,$06,$F5
 
dc.b $AF,$32,$27,$1C,$F1,$CF,$DF,$E5,$E7,$22,$39,$1C,$AF,$32,$15,$1C
 
dc.b $E1,$E5,$FD,$E1,$FD,$7E,$02,$32,$3B,$1C,$11,$04,$00,$19,$FD,$46
 
dc.b $03,$78,$32,$31,$1C,$C5,$E5,$23,$4E,$CD,$78,$07,$CB,$D6,$DD,$E5
 
dc.b $3A,$19,$1C,$B7,$28,$03,$E1,$FD,$E5,$D1,$E1,$ED,$A0,$1A,$FE,$02
 
dc.b $CC,$5E,$09,$ED,$A0,$3A,$3B,$1C,$12,$13,$ED,$A0,$ED,$A0,$ED,$A0
 
dc.b $ED,$A0,$CD,$AE,$07,$DD,$CB,$00,$7E,$28,$0C,$DD,$7E,$01,$FD,$BE
 
dc.b $01,$20,$04,$FD,$CB,$00,$D6,$E5,$2A,$39,$1C,$3A,$19,$1C,$B7,$28
 
dc.b $04,$FD,$E5,$DD,$E1,$DD,$75,$2A,$DD,$74,$2B,$CD,$58,$03,$CD,$6B
 
dc.b $09,$E1,$C1,$10,$A0,$C3,$80,$06,$CB,$79,$20,$08,$79,$CB,$57,$28
 
dc.b $1A,$3D,$18,$17,$3E,$1F,$CD,$4D,$10,$3E,$FF,$32,$11,$7F,$79,$CB
 
dc.b $3F,$CB,$3F,$CB,$3F,$CB,$3F,$CB,$3F,$C6,$02,$D6,$02,$32,$32,$1C
 
dc.b $F5,$21,$C8,$07,$DF,$E5,$DD,$E1,$F1,$21,$D8,$07,$DF,$C9,$08,$AF
 
dc.b $12,$13,$12,$13,$08,$EB,$36,$30,$23,$36,$C0,$23,$36,$01,$06,$24
 
dc.b $23,$36,$00,$10,$FB,$23,$EB,$C9,$F0,$1D,$20,$1E,$50,$1E,$80,$1E
 
dc.b $B0,$1E,$E0,$1E,$10,$1F,$10,$1F,$D0,$1C,$00,$1D,$30,$1D,$40,$1C
 
dc.b $60,$1D,$90,$1D,$C0,$1D,$C0,$1D,$21,$10,$1C,$7E,$B7,$C8,$FA,$F9
 
dc.b $07,$D1,$3D,$C0,$36,$02,$C3,$72,$09,$AF,$77,$3A,$0D,$1C,$B7,$C2
 
dc.b $29,$09,$DD,$21,$70,$1C,$06,$06,$3A,$11,$1C,$B7,$20,$06,$DD,$CB
 
dc.b $00,$7E,$28,$08,$DD,$4E,$0A,$3E,$B4,$CD,$B5,$00,$11,$30,$00,$DD
 
dc.b $19,$10,$E5,$DD,$21,$40,$1F,$06,$07,$DD,$CB,$00,$7E,$28,$0E,$DD
 
dc.b $CB,$01,$7E,$20,$08,$DD,$4E,$0A,$3E,$B4,$CD,$B5,$00,$11,$30,$00
 
dc.b $DD,$19,$10,$E5,$C9,$3E,$28,$32,$0D,$1C,$3E,$06,$32,$0F,$1C,$32
 
dc.b $0E,$1C,$AF,$32,$40,$1C,$32,$C0,$1D,$32,$60,$1D,$32,$90,$1D,$C3
 
dc.b $A1,$09,$21,$0D,$1C,$7E,$B7,$C8,$FC,$52,$08,$CB,$BE,$3A,$0F,$1C
 
dc.b $3D,$28,$04,$32,$0F,$1C,$C9,$3A,$0E,$1C,$32,$0F,$1C,$3A,$0D,$1C
 
dc.b $3D,$32,$0D,$1C,$CA,$29,$09,$3A,$3E,$1C
 
Z80_0x088A:
 
dc.b $21,$00,$60
 
dc.b $77,$1F,$77,$1F,$77,$1F,$77,$AF,$16,$01,$72,$77,$77,$77,$77
 
Z80_0x089C:
 
dc.b $DD,$21,$40,$1C
 
dc.b $06,$06,$DD,$34,$06,$F2,$AD,$08,$DD,$35,$06,$18,$11,$DD,$CB,$00
 
dc.b $7E,$28,$0B,$DD,$CB,$00,$56,$20,$05,$C5,$CD,$9C,$0C,$C1,$11,$30
 
dc.b $00,$DD,$19,$10,$DD,$C9,$3A,$29,$1C,$B7,$C8,$3A,$3E,$1C
 
Z80_0x08CE:
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
Z80_0x08E0:
 
dc.b $3A,$0E,$1C,$3D,$32,$0E,$1C,$C0,$3A,$0F,$1C,$32,$0E,$1C,$06,$05
 
dc.b $DD,$21,$70,$1C,$11,$30,$00,$DD,$7E,$06,$3D,$DD,$77,$06,$C5,$CD
 
dc.b $9C,$0C,$C1,$DD,$19,$10,$F0,$3A,$29,$1C,$3D,$32,$29,$1C,$C0,$06
 
dc.b $03,$DD,$21,$60,$1D,$11,$30,$00,$DD,$CB,$00,$96,$DD,$19,$10,$F8
 
dc.b $DD,$21,$40,$1C,$DD,$CB,$00,$96,$C9,$21,$0D,$1C,$11,$0E,$1C,$01
 
dc.b $C6,$03,$36,$00,$ED,$B0,$AF,$32,$08,$1C,$DD,$21,$85,$06,$06,$06
 
dc.b $C5,$CD,$DB,$09,$CD,$6B,$09,$DD,$23,$DD,$23,$C1,$10,$F2,$06,$07
 
dc.b $AF,$32,$0D,$1C,$CD,$A1,$09,$0E,$00,$3E,$2B,$CD,$C8,$00,$AF,$32
 
dc.b $12,$1C,$4F,$3E,$27,$CD,$C8,$00,$C3,$80,$06,$3E,$90,$0E,$00,$C3
 
dc.b $EF,$09,$CD,$A1,$09,$C5,$F5,$06,$03,$3E,$B4,$0E,$00,$F5,$CD,$C8
 
dc.b $00,$F1,$3C,$10,$F8,$06,$02,$3E,$B4,$F5,$CD,$D3,$00,$F1,$3C,$10
 
dc.b $F8,$0E,$00,$06,$06,$3E,$28,$F5,$CD,$C8,$00,$0C,$F1,$10,$F8,$F1
 
dc.b $C1,$C5,$06,$04,$3E,$9F,$32,$11,$7F,$C6,$20,$10,$F9,$C1,$C3,$80
 
dc.b $06,$3A,$24,$1C,$21,$13,$1C,$86,$77,$D0,$21,$4B,$1C,$11,$30,$00
 
dc.b $06,$09,$34,$19,$10,$FC,$C9,$21,$0A,$1C,$11,$05,$1C,$ED,$A0,$ED
 
dc.b $A0,$ED,$A0,$AF,$2B,$77,$2B,$77,$2B,$77,$C9,$CD,$EB,$09,$3E,$40
 
dc.b $0E,$7F,$CD,$EF,$09,$DD,$4E,$01,$C3,$64,$03,$3E,$80,$0E,$FF,$06
 
dc.b $04,$F5,$CD,$B5,$00,$F1,$C6,$04,$10,$F7,$C9,$CD,$29,$09,$3E,$01
 
dc.b $32,$3F,$1C,$E1,$C9,$AF,$32,$16,$1C,$3A,$2C,$1C,$32,$24,$1C,$3A
 
dc.b $2E,$1C,$32,$08,$1C,$2A,$2A,$1C,$22,$37,$1C
 
Z80_0x0A1B:
 
dc.b $3A,$2D,$1C,$32,$3E,$1C
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
Z80_0x0A33:
 
dc.b $21,$F0,$1D,$11,$40,$1C,$01,$B0,$01,$ED,$B0,$3A,$40
 
dc.b $1C,$F6,$84,$32,$40,$1C,$DD,$21,$70,$1C,$06,$08,$DD,$7E,$00,$F6
 
dc.b $84,$DD,$77,$00,$DD,$CB,$01,$7E,$C2,$73,$0A,$DD,$CB,$00,$96,$DD
 
dc.b $7E,$06,$C6,$40,$DD,$77,$06,$DD,$7E,$08,$C5,$47,$CD,$80,$04,$CD
 
dc.b $B6,$04,$C1,$11,$30,$00,$DD,$19,$10,$D2,$3E,$40,$32,$29,$1C,$3E
 
dc.b $02,$32,$0F,$1C,$32,$0E,$1C,$C9,$FF,$03,$FF,$03,$FF,$03,$FF,$03
 
dc.b $FF,$03,$FF,$03,$FF,$03,$FF,$03,$FF,$03,$F7,$03,$BE,$03,$88,$03
 
dc.b $56,$03,$26,$03,$F9,$02,$CE,$02,$A5,$02,$80,$02,$5C,$02,$3A,$02
 
dc.b $1A,$02,$FB,$01,$DF,$01,$C4,$01,$AB,$01,$93,$01,$7D,$01,$67,$01
 
dc.b $53,$01,$40,$01,$2E,$01,$1D,$01,$0D,$01,$FE,$00,$EF,$00,$E2,$00
 
dc.b $D6,$00,$C9,$00,$BE,$00,$B4,$00,$A9,$00,$A0,$00,$97,$00,$8F,$00
 
dc.b $87,$00,$7F,$00,$78,$00,$71,$00,$6B,$00,$65,$00,$5F,$00,$5A,$00
 
dc.b $55,$00,$50,$00,$4B,$00,$47,$00,$43,$00,$40,$00,$3C,$00,$39,$00
 
dc.b $36,$00,$33,$00,$30,$00,$2D,$00,$2B,$00,$28,$00,$26,$00,$24,$00
 
dc.b $22,$00,$20,$00,$1F,$00,$1D,$00,$1B,$00,$1A,$00,$18,$00,$17,$00
 
dc.b $16,$00,$15,$00,$13,$00,$12,$00,$11,$00,$10,$00,$00,$00,$00,$00
 
dc.b $84,$02,$AB,$02,$D3,$02,$FE,$02,$2D,$03,$5C,$03,$8F,$03,$C5,$03
 
dc.b $FF,$03,$3C,$04,$7C,$04,$C0,$04
 
BankSelector:
 
dc.b ((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F))
 
dc.b ((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F))
 
dc.b ((Bank1>>$0F)),((Bank1>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
 
dc.b ((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
 
dc.b ((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
 
dc.b ((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
 
dc.b ((Bank2>>$0F)),((Bank1>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
 
dc.b ((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
 
dc.b ((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
 
dc.b ((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
 
dc.b ((Bank2>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
 
dc.b ((Bank3>>$0F)),((Bank0>>$0F)),((Bank2>>$0F)),((Bank0>>$0F))
 
dc.b ((Bank3>>$0F)),((Bank3>>$0F))
 
dc.b $CD,$37,$03,$C0,$DD,$5E
 
dc.b $03,$DD,$56,$04,$1A,$13,$FE,$E0,$D2,$C5,$0B,$B7,$FA,$93,$0B,$1B
 
dc.b $DD,$7E,$0D,$DD,$77,$0D,$FE,$80,$CA,$B5,$0B,$CB,$BF,$D5,$08,$CD
 
dc.b $58,$03,$CD,$5E,$09,$08,$DD,$21,$40,$1C,$DD,$CB,$00,$56,$C2,$B4
 
dc.b $0B,$32,$30,$1C,$D1,$1A,$13,$B7,$F2,$05,$03,$1B,$DD,$7E,$0C,$DD
 
dc.b $77,$0B,$C3,$0B,$03,$21,$CB,$0B,$C3,$D2,$0B,$13,$C3,$84,$0B,$21
 
dc.b $DB,$0B,$E5,$D6,$E0,$21,$DF,$0B,$DF,$1A,$E9,$13,$C3,$82,$02,$33
 
dc.b $0C,$59,$0C,$5D,$0C,$61,$0C,$67,$0C,$83,$0C,$85,$0C,$BD,$0C,$C3
 
dc.b $0C,$47,$0C,$2F,$0C,$CD,$0C,$E3,$0C,$FD,$0C,$03,$0D,$10,$0D,$4F
 
dc.b $0D,$5D,$0D,$69,$0D,$11,$0E,$65,$0D,$30,$0E,$39,$0E,$3F,$0E,$56
 
dc.b $0E,$70,$0E,$83,$0E,$89,$0E,$90,$0E,$B2,$0E,$C0,$0E,$07,$0F,$0E
 
dc.b $0F,$12,$0F,$1A,$0F,$55,$0F,$63,$0F,$72,$0F,$8D,$0F,$96,$0F,$32
 
dc.b $30,$1C,$C9,$0E,$3F,$DD,$7E,$0A,$A1,$D5,$EB,$B6,$DD,$77,$0A,$4F
 
dc.b $3E,$B4,$CD,$B5,$00,$D1,$C9,$21,$27,$1C,$7E,$DD,$86,$05,$DD,$77
 
dc.b $05,$FE,$10,$CA,$57,$0C,$34,$1B,$C9,$DD,$77,$10,$C9,$32,$16,$1C
 
dc.b $C9,$CD,$DB,$09,$C3,$69,$0D,$DD,$CB,$01,$7E,$28,$0D,$CB,$3F,$CB
 
dc.b $3F,$CB,$3F,$EE,$0F,$E6,$0F,$C3,$F9,$0C,$EE,$7F,$E6,$7F,$DD,$77
 
dc.b $06,$18,$19,$13,$1A,$DD,$CB,$01,$7E,$C0,$DD,$86,$06,$F2,$99,$0C
 
dc.b $EA,$97,$0C,$AF,$C3,$99,$0C,$3E,$7F,$DD,$77,$06,$D5,$11,$AE,$04
 
dc.b $DD,$6E,$1C,$DD,$66,$1D,$06,$04,$7E,$B7,$F2,$B0,$0C,$DD,$86,$06
 
dc.b $E6,$7F,$4F,$1A,$CD,$B5,$00,$13,$23,$10,$ED,$D1,$C9,$DD,$CB,$00
 
dc.b $CE,$1B,$C9,$CD,$2D,$03,$DD,$77,$1E,$DD,$77,$1F,$C9,$13,$C6,$28
 
dc.b $4F,$06,$00,$DD,$E5,$E1,$09,$7E,$3D,$CA,$DE,$0C,$13,$C9,$AF,$77
 
dc.b $C3,$39,$0E,$DD,$CB,$01,$7E,$C8,$DD,$CB,$00,$A6,$DD,$35,$17,$DD
 
dc.b $86,$06,$FE,$0F,$DA,$F9,$0C,$3E,$0F,$DD,$77,$06,$C9,$D6,$40,$DD
 
dc.b $77,$05,$C9,$CD,$0A,$0D,$CD,$C8,$00,$C9,$EB,$7E,$23,$4E,$EB,$C9
 
dc.b $DD,$CB,$01,$7E,$20,$30,$CD,$EB,$09,$1A,$DD,$77,$08,$B7,$F2,$3C
 
dc.b $0D,$13,$1A,$DD,$77,$0F,$D5,$DD,$7E,$0F,$D6,$81,$0E,$04,$CF,$DF
 
dc.b $E7,$DD,$7E,$08,$E6,$7F,$47,$CD,$8F,$04,$18,$05,$D5,$47,$CD,$80
 
dc.b $04,$CD,$B6,$04,$D1,$C9,$B7,$F2,$35,$0E,$13,$C3,$35,$0E,$C9,$DD
 
dc.b $73,$20,$DD,$72,$21,$DD,$36,$07,$80,$13,$13,$13,$C9,$13,$DD,$CB
 
dc.b $01,$7E,$20,$01,$1A,$DD,$77,$07,$C9,$DD,$CB,$00,$BE,$3E,$1F,$32
 
dc.b $15,$1C,$CD,$58,$03,$DD,$4E,$01,$DD,$E5,$CD,$78,$07,$3A,$19,$1C
 
dc.b $B7,$28,$77,$AF,$32,$18,$1C,$E5,$2A,$37,$1C,$DD,$E1,$DD,$CB,$00
 
dc.b $96,$DD,$CB,$01,$7E,$20,$68,$DD,$CB,$00,$7E,$28,$5D,$3E,$02,$DD
 
dc.b $BE,$01,$20,$0D,$3E,$4F,$DD,$CB,$00,$46,$20,$02,$E6,$0F,$CD,$E9
 
dc.b $0E,$DD,$7E,$08,$B7,$F2,$BD,$0D,$CD,$26,$0D,$18,$3A,$47,$E5
 
Z80_0x0DBF:
 
dc.b $3A,$3E,$1C
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
Z80_0x0DD4:
 
dc.b $E1,$CD,$8F,$04,$CD,$B6,$04
 
Z80_0x0DDB:
 
dc.b $3E,((SndBank>>$0F))
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
dc.b $DD,$7E,$18,$B7,$F2,$FA
 
dc.b $0D,$DD,$5E,$19,$DD,$56,$1A,$CD,$7C,$0F,$DD,$E1,$E1,$E1,$C9,$DD
 
dc.b $CB,$00,$46,$28,$F5,$DD,$7E,$1A,$B7,$F2,$0F,$0E,$32,$11,$7F,$18
 
dc.b $E9,$DD,$CB,$01,$56,$C0,$3E,$DF,$32,$11,$7F,$1A,$DD,$77,$1A,$DD
 
dc.b $CB,$00,$C6,$B7,$20,$06,$DD,$CB,$00,$86,$3E,$FF,$32,$11,$7F,$C9
 
dc.b $DD,$CB,$01,$7E,$C8,$DD,$77,$08,$C9,$EB,$5E,$23,$56,$1B,$C9,$13
 
dc.b $C6,$28,$4F,$06,$00,$DD,$E5,$E1,$09,$7E,$B7,$20,$02,$1A,$77,$13
 
dc.b $35,$C2,$39,$0E,$13,$C9,$4F,$13,$1A,$47,$C5,$DD,$E5,$E1,$DD,$35
 
dc.b $09,$DD,$4E,$09,$DD,$35,$09,$06,$00,$09,$72,$2B,$73,$D1,$1B,$C9
 
dc.b $DD,$E5,$E1,$DD,$4E,$09,$06,$00,$09,$5E,$23,$56,$DD,$34,$09,$DD
 
dc.b $34,$09,$C9,$DD,$CB,$07,$BE,$1B,$C9,$DD,$86,$05,$DD,$77,$05,$C9
 
dc.b $3A,$26,$1C,$FE,$80,$CA,$A1,$0E,$AF,$32,$25,$1C,$32,$26,$1C,$13
 
dc.b $C9,$3A,$31,$1C,$3D,$32,$31,$1C,$C2,$39,$0E,$AF,$32,$26,$1C,$C3
 
dc.b $39,$0E,$FE,$01,$20,$05,$DD,$CB,$00,$DE,$C9,$DD,$CB,$00,$9E,$C9
 
dc.b $DD,$7E,$01,$FE,$02,$20,$2C,$DD,$CB,$00,$C6,$EB,$CD,$73,$02,$06
 
dc.b $04,$C5,$7E,$23,$E5,$21,$F7,$0E,$87,$4F,$06,$00,$09,$ED,$A0,$ED
 
dc.b $A0,$E1,$C1,$10,$EC,$EB,$1B,$3E,$4F,$32,$12,$1C,$4F,$3E,$27,$CD
 
dc.b $C8,$00,$C9,$13,$13,$13,$C9,$00,$00,$32,$01,$8E,$01,$E4,$01,$34
 
dc.b $02,$7E,$02,$C2,$02,$F0,$02,$21,$1F,$0C,$DF,$13,$1A,$E9,$32,$24
 
dc.b $1C,$C9,$DD,$E5,$CD,$F8,$04,$DD,$E1,$C9,$32,$11,$1C,$B7,$28,$1D
 
dc.b $DD,$E5,$D5,$DD,$21,$40,$1C,$06,$09,$11,$30,$00,$DD,$CB,$00,$BE
 
dc.b $CD,$5E,$03,$DD,$19,$10,$F5,$D1,$DD,$E1,$C3,$A1,$09,$DD,$E5,$D5
 
dc.b $DD,$21,$40,$1C,$06,$09,$11,$30,$00,$DD,$CB,$00,$FE,$DD,$19,$10
 
dc.b $F8,$D1,$DD,$E1,$C9,$EB,$5E,$23,$56,$23,$4E,$06,$00,$23,$EB,$ED
 
dc.b $B0,$1B,$C9,$06,$09,$21,$42,$1C,$C5,$01,$30,$00,$77,$09,$C1,$10
 
dc.b $F7,$C9,$DD,$36,$18,$80,$DD,$73,$19,$DD,$72,$1A,$21,$B2,$04,$06
 
dc.b $04,$1A,$13,$4F,$7E,$23,$CD,$B5,$00,$10,$F6,$1B,$C9,$DD,$77,$18
 
dc.b $13,$1A,$DD,$77,$19,$C9,$AF,$32,$27,$1C,$1B,$C9,$CD,$37,$03,$20
 
dc.b $0D,$CD,$74,$02,$DD,$CB,$00,$66,$C0,$CD,$9B,$03,$18,$0C,$DD,$7E
 
dc.b $1E,$B7,$28,$06,$DD,$35,$1E,$CA,$44,$10,$CD,$6C,$04,$CD,$C6,$03
 
dc.b $DD,$CB,$00,$56,$C0,$DD,$4E,$01,$7D,$E6,$0F,$B1,$32,$11,$7F,$7D
 
dc.b $E6,$F0,$B4,$0F,$0F,$0F,$0F,$32,$11,$7F,$DD,$7E,$08,$B7,$0E,$00
 
dc.b $28,$09,$3D,$0E,$0A,$CF,$DF,$CD,$12,$10,$4F,$DD,$CB,$00,$66,$C0
 
dc.b $DD,$7E,$06,$81,$CB,$67,$28,$02,$3E,$0F,$DD,$B6,$01,$C6,$10,$DD
 
dc.b $CB,$00,$46,$20,$04,$32,$11,$7F,$C9,$C6,$20,$32,$11,$7F,$C9,$DD
 
dc.b $77,$17,$E5,$DD,$4E,$17,$06,$00,$09,$7E,$E1,$CB,$7F,$28,$21,$FE
 
dc.b $83,$28,$0C,$FE,$81,$28,$13,$FE,$80,$28,$0C,$03,$0A,$18,$E0,$DD
 
dc.b $CB,$00,$E6,$E1,$C3,$44,$10,$AF,$18,$D5,$E1,$DD,$CB,$00,$E6,$C9
 
dc.b $DD,$34,$17,$C9,$DD,$CB,$00,$E6,$DD,$CB,$00,$56,$C0,$3E,$1F,$DD
 
dc.b $86,$01,$B7,$F0,$32,$11,$7F,$DD,$CB,$00,$46,$C8,$3E,$FF,$32,$11
 
dc.b $7F,$C9,$F3,$3E,$2B,$0E,$00,$CD,$C8,$00,$FB,$3A,$3F,$1C,$B7,$C2
 
dc.b $FE,$10,$3A,$30,$1C,$B7,$28,$F2,$3E,$2B,$0E,$80,$F3,$CD,$C8,$00
 
dc.b $FB,$FD,$21,$EE,$10,$21,$30,$1C,$7E,$3D,$CB,$FE,$21,$00,$80,$DF
 
dc.b $0E,$80,$7E,$32,$A3,$10,$32,$C0,$10,$23,$5E,$23,$56,$23,$7E,$23
 
dc.b $66,$6F,$06,$0A,$FB,$10,$FE,$F3,$3E,$2A,$32,$00,$40,$7E,$07,$07
 
dc.b $07,$07,$E6,$0F,$32,$BA,$10,$79,$FD,$86,$00,$32,$01,$40,$4F,$06
 
dc.b $0A,$FB,$10,$FE,$F3,$3E,$2A,$32,$00,$40,$7E,$E6,$0F,$32,$D3,$10
 
dc.b $79,$FD,$86,$00,$32,$01,$40,$FB,$4F,$3A,$30,$1C,$B7,$F2,$6A,$10
 
dc.b $23,$1B,$7A,$B3,$C2,$A2,$10,$AF,$32,$30,$1C,$C3,$62,$10,$00,$01
 
dc.b $02,$04,$08,$10,$20,$40,$80,$FF,$FE,$FC,$F8,$F0,$E0,$C0,$F3,$CD
 
dc.b $C7,$09,$3E,$2B,$32,$00,$40,$00,$3E,$80,$32,$01,$40
 
Z80_0x110D:
 
dc.b $3E,((SegaPCMBank>>$0F))
 
dc.b $CD
 
dc.w (((Z80BankSwitch&$1FFF)>>$08)|((Z80BankSwitch&$1FFF)<<$08))&$FFFF
 
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00
 
dc.b $21
 
dc.w (((SegaSnd&$FFFF)|$8000>>$08)|((SegaSnd&$FFFF)|$8000<<$08))&$FFFF
 
dc.b $11,$2F,$5E
 
dc.b $3E,$2A,$32,$00,$40,$00,$7E,$32,$01,$40,$3A,$0A,$1C,$FE,$FE
 
dc.b $28,$0C,$00,$00,$06,$0C,$10,$FE,$23,$1B,$7A,$B3,$20,$E9,$AF,$32
 
dc.b $3F,$1C,$21,$0D,$1C,$CD,$D3,$09,$C3,$62,$10,$FF
 
Z80_0x114C:
 
dc.b $21,$00,$60
 
dc.b $77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77
 
dc.b $AF,$77
 
dc.b $C3,$82,$00
 
Z80BankSwitch0:
 
Z80_0x1170:
 
dc.b $21,$00,$60
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $AF
 
dc.b $16,$01
 
dc.b $72
 
dc.b $77
 
dc.b $77
 
dc.b $77
 
dc.b $77
 
dc.b $C9
 
Z80BankSwitch:
 
dc.b $21, $00, $60
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $1F
 
dc.b $77
 
dc.b $C9
 
DriverDataEnd:
 
 
;-------------------------------------------------------------------------------
 
; Filler to align pointers at 1300h in Z80 Ram
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
dc.b 0,0,0,0,0
 
DriverPointers:
 
dc.w (((MusicPointers&$1FFF)>>$08)|((MusicPointers&$1FFF)<<$08))&$FFFF
 
dc.w (((UniversalVoiceBank&$1FFF)>>$08)|((UniversalVoiceBank&$1FFF)<<$08))&$FFFF
 
dc.w (((MusicPointers&$1FFF)>>$08)|((MusicPointers&$1FFF)<<$08))&$FFFF
 
dc.w (((SndPointers&$1FFF)>>$08)|((SndPointers&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGNoisePointers&$1FFF)>>$08)|((PSGNoisePointers&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGTonePointers&$1FFF)>>$08)|((PSGTonePointers&$1FFF)<<$08))&$FFFF
 
dc.w $3300
 
 
;credit goes to Varion Icaria for finding this index
 
PSGNoisePointers:
 
dc.w (((PSGN_0&$1FFF)>>$08)|((PSGN_0&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGN_1&$1FFF)>>$08)|((PSGN_1&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGN_2&$1FFF)>>$08)|((PSGN_2&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGN_3&$1FFF)>>$08)|((PSGN_3&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGN_4&$1FFF)>>$08)|((PSGN_4&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGN_5&$1FFF)>>$08)|((PSGN_5&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGN_6&$1FFF)>>$08)|((PSGN_6&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGN_7&$1FFF)>>$08)|((PSGN_7&$1FFF)<<$08))&$FFFF
 
 
PSGN_1: binclude sound/PSGN1.bin
 
PSGN_0: binclude sound/PSGN0.bin
 
PSGN_2: binclude sound/PSGN2.bin
 
PSGN_3: binclude sound/PSGN3.bin
 
PSGN_4: binclude sound/PSGN4.bin
 
PSGN_5: binclude sound/PSGN5.bin
 
PSGN_6: binclude sound/PSGN6.bin
 
PSGN_7: binclude sound/PSGN7.bin
 
 
;credit goes to Varion Icaria for finding this index
 
PSGTonePointers:
 
dc.w (((PSGT_00&$1FFF)>>$08)|((PSGT_00&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_01&$1FFF)>>$08)|((PSGT_01&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_02&$1FFF)>>$08)|((PSGT_02&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_03&$1FFF)>>$08)|((PSGT_03&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_04&$1FFF)>>$08)|((PSGT_04&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_05&$1FFF)>>$08)|((PSGT_05&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_06&$1FFF)>>$08)|((PSGT_06&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_07&$1FFF)>>$08)|((PSGT_07&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_08&$1FFF)>>$08)|((PSGT_08&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_09&$1FFF)>>$08)|((PSGT_09&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_0A&$1FFF)>>$08)|((PSGT_0A&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_0B&$1FFF)>>$08)|((PSGT_0B&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_0C&$1FFF)>>$08)|((PSGT_0C&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_0D&$1FFF)>>$08)|((PSGT_0D&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_0E&$1FFF)>>$08)|((PSGT_0E&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_0F&$1FFF)>>$08)|((PSGT_0F&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_10&$1FFF)>>$08)|((PSGT_10&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_11&$1FFF)>>$08)|((PSGT_11&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_12&$1FFF)>>$08)|((PSGT_12&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_13&$1FFF)>>$08)|((PSGT_13&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_14&$1FFF)>>$08)|((PSGT_14&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_15&$1FFF)>>$08)|((PSGT_15&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_16&$1FFF)>>$08)|((PSGT_16&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_17&$1FFF)>>$08)|((PSGT_17&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_18&$1FFF)>>$08)|((PSGT_18&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_19&$1FFF)>>$08)|((PSGT_19&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_1A&$1FFF)>>$08)|((PSGT_1A&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_1B&$1FFF)>>$08)|((PSGT_1B&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_1C&$1FFF)>>$08)|((PSGT_1C&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_1D&$1FFF)>>$08)|((PSGT_1D&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_1E&$1FFF)>>$08)|((PSGT_1E&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_1F&$1FFF)>>$08)|((PSGT_1F&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_20&$1FFF)>>$08)|((PSGT_20&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_21&$1FFF)>>$08)|((PSGT_21&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_22&$1FFF)>>$08)|((PSGT_22&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_23&$1FFF)>>$08)|((PSGT_23&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_24&$1FFF)>>$08)|((PSGT_24&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_25&$1FFF)>>$08)|((PSGT_25&$1FFF)<<$08))&$FFFF
 
dc.w (((PSGT_26&$1FFF)>>$08)|((PSGT_26&$1FFF)<<$08))&$FFFF
 
 
PSGT_00: binclude sound/PSGT00.bin
 
PSGT_01: binclude sound/PSGT01.bin
 
PSGT_02: binclude sound/PSGT02.bin
 
PSGT_03: binclude sound/PSGT03.bin
 
PSGT_04: binclude sound/PSGT04.bin
 
PSGT_05: binclude sound/PSGT05.bin
 
PSGT_06: binclude sound/PSGT06.bin
 
PSGT_07: binclude sound/PSGT07.bin
 
PSGT_08: binclude sound/PSGT08.bin
 
PSGT_09: binclude sound/PSGT09.bin
 
PSGT_0A: binclude sound/PSGT0A.bin
 
PSGT_0B: binclude sound/PSGT0B.bin
 
PSGT_0C: binclude sound/PSGT0C.bin
 
PSGT_0D: binclude sound/PSGT0D.bin
 
PSGT_0E: binclude sound/PSGT0E.bin
 
PSGT_0F: binclude sound/PSGT0F.bin
 
PSGT_10: binclude sound/PSGT10.bin
 
PSGT_11: binclude sound/PSGT11.bin
 
PSGT_12: binclude sound/PSGT12.bin
 
PSGT_13: binclude sound/PSGT13.bin
 
PSGT_14: binclude sound/PSGT14.bin
 
PSGT_15: binclude sound/PSGT15.bin
 
PSGT_16: binclude sound/PSGT16.bin
 
PSGT_17: binclude sound/PSGT17.bin
 
PSGT_18: binclude sound/PSGT18.bin
 
PSGT_19: binclude sound/PSGT19.bin
 
PSGT_1A: binclude sound/PSGT1A.bin
 
PSGT_1B: binclude sound/PSGT1B.bin
 
PSGT_1C: binclude sound/PSGT1C.bin
 
PSGT_1D: binclude sound/PSGT1D.bin
 
PSGT_1E: binclude sound/PSGT1E.bin
 
PSGT_1F: binclude sound/PSGT1F.bin
 
PSGT_20: binclude sound/PSGT20.bin
 
PSGT_21: binclude sound/PSGT21.bin
 
PSGT_22: binclude sound/PSGT22.bin
 
PSGT_23: binclude sound/PSGT23.bin
 
PSGT_24: binclude sound/PSGT24.bin
 
PSGT_25: binclude sound/PSGT25.bin
 
PSGT_26: binclude sound/PSGT26.bin
 
 
MusicPointers:
 
rom_ptr_z80 Angel_Island_1_Snd
 
rom_ptr_z80 Angel_Island_2_Snd
 
rom_ptr_z80 Hidrocity_1_Snd
 
rom_ptr_z80 Hidrocity_2_Snd
 
rom_ptr_z80 Marble_Garden_1_Snd
 
rom_ptr_z80 Marble_Garden_2_Snd
 
rom_ptr_z80 Carnival_Night_1_Snd
 
rom_ptr_z80 Carnival_Night_2_Snd
 
rom_ptr_z80 Flying_Battery_1_Snd
 
rom_ptr_z80 Flying_Battery_2_Snd
 
rom_ptr_z80 Icecap_1_Snd
 
rom_ptr_z80 Icecap_2_Snd
 
rom_ptr_z80 Launch_Base_1_Snd
 
rom_ptr_z80 Launch_Base_2_Snd
 
rom_ptr_z80 Mushroom_Hill_1_Snd
 
rom_ptr_z80 Mushroom_Hill_2_Snd
 
rom_ptr_z80 Sandopolis_1_Snd
 
rom_ptr_z80 Sandopolis_2_Snd
 
rom_ptr_z80 Lava_Reef_1_Snd
 
rom_ptr_z80 Lava_Reef_2_Snd
 
rom_ptr_z80 Sky_Sanctuary_Snd
 
rom_ptr_z80 Death_Egg_1_Snd
 
rom_ptr_z80 Death_Egg_2_Snd
 
rom_ptr_z80 Mini_Boss_SK_Snd
 
rom_ptr_z80 Boss_Snd
 
rom_ptr_z80 The_Doomsday_Snd
 
rom_ptr_z80 Glowing_Spheres_Bonus_Stage_snd
 
rom_ptr_z80 Special_Stage_Snd
 
rom_ptr_z80 Slot_Machine_Bonus_Stage_snd
 
rom_ptr_z80 Gum_Ball_Machine_Bonus_Stage_snd
 
rom_ptr_z80 Knuckles_Theme_Snd
 
rom_ptr_z80 Azure_Lake_Snd
 
rom_ptr_z80 Balloon_Park_Snd
 
rom_ptr_z80 Desert_Palace_Snd
 
rom_ptr_z80 Chrome_Gadget_Snd
 
rom_ptr_z80 Endless_Mine_Snd
 
rom_ptr_z80 Title_Screen_Snd
 
rom_ptr_z80 Credits_Snd
 
rom_ptr_z80 Time_Game_Over_Snd
 
rom_ptr_z80 Continue_Snd
 
rom_ptr_z80 Level_Results_Snd
 
rom_ptr_z80 Extra_Life_Snd
 
rom_ptr_z80 Emerald_Snd
 
rom_ptr_z80 Invencibility_Snd
 
rom_ptr_z80 Competition_Menu_Snd
 
rom_ptr_z80 Mini_Boss_Snd
 
rom_ptr_z80 Menu_Snd
 
rom_ptr_z80 Final_Boss_Snd
 
rom_ptr_z80 Underwater_Timming_Snd
 
rom_ptr_z80 Presented_by_SEGA_Snd
 
 
SndPointers:
 
rom_ptr_z80 Sfx_33_Snd
 
rom_ptr_z80 Sfx_34_Snd
 
rom_ptr_z80 Sfx_35_Snd
 
rom_ptr_z80 Sfx_36_Snd
 
rom_ptr_z80 Sfx_37_Snd
 
rom_ptr_z80 Sfx_38_Snd
 
rom_ptr_z80 Sfx_39_Snd
 
rom_ptr_z80 Sfx_3A_Snd
 
rom_ptr_z80 Sfx_3B_Snd
 
rom_ptr_z80 Sfx_3C_Snd
 
rom_ptr_z80 Sfx_3D_Snd
 
rom_ptr_z80 Sfx_3E_Snd
 
rom_ptr_z80 Sfx_3F_Snd
 
rom_ptr_z80 Sfx_40_Snd
 
rom_ptr_z80 Sfx_41_Snd
 
rom_ptr_z80 Sfx_42_Snd
 
rom_ptr_z80 Sfx_43_Snd
 
rom_ptr_z80 Sfx_44_Snd
 
rom_ptr_z80 Sfx_45_Snd
 
rom_ptr_z80 Sfx_46_Snd
 
rom_ptr_z80 Sfx_47_Snd
 
rom_ptr_z80 Sfx_48_Snd
 
rom_ptr_z80 Sfx_49_Snd
 
rom_ptr_z80 Sfx_4A_Snd
 
rom_ptr_z80 Sfx_4B_Snd
 
rom_ptr_z80 Sfx_4C_Snd
 
rom_ptr_z80 Sfx_4D_Snd
 
rom_ptr_z80 Sfx_4E_Snd
 
rom_ptr_z80 Sfx_4F_Snd
 
rom_ptr_z80 Sfx_50_Snd
 
rom_ptr_z80 Sfx_51_Snd
 
rom_ptr_z80 Sfx_52_Snd
 
rom_ptr_z80 Sfx_53_Snd
 
rom_ptr_z80 Sfx_54_Snd
 
rom_ptr_z80 Sfx_55_Snd
 
rom_ptr_z80 Sfx_56_Snd
 
rom_ptr_z80 Sfx_57_Snd
 
rom_ptr_z80 Sfx_58_Snd
 
rom_ptr_z80 Sfx_59_Snd
 
rom_ptr_z80 Sfx_5A_Snd
 
rom_ptr_z80 Sfx_5B_Snd
 
rom_ptr_z80 Sfx_5C_Snd
 
rom_ptr_z80 Sfx_5D_Snd
 
rom_ptr_z80 Sfx_5E_Snd
 
rom_ptr_z80 Sfx_5F_Snd
 
rom_ptr_z80 Sfx_60_Snd
 
rom_ptr_z80 Sfx_61_Snd
 
rom_ptr_z80 Sfx_62_Snd
 
rom_ptr_z80 Sfx_63_Snd
 
rom_ptr_z80 Sfx_64_Snd
 
rom_ptr_z80 Sfx_65_Snd
 
rom_ptr_z80 Sfx_66_Snd
 
rom_ptr_z80 Sfx_67_Snd
 
rom_ptr_z80 Sfx_68_Snd
 
rom_ptr_z80 Sfx_69_Snd
 
rom_ptr_z80 Sfx_6A_Snd
 
rom_ptr_z80 Sfx_6B_Snd
 
rom_ptr_z80 Sfx_6C_Snd
 
rom_ptr_z80 Sfx_6D_Snd
 
rom_ptr_z80 Sfx_6E_Snd
 
rom_ptr_z80 Sfx_6F_Snd
 
rom_ptr_z80 Sfx_70_Snd
 
rom_ptr_z80 Sfx_71_Snd
 
rom_ptr_z80 Sfx_72_Snd
 
rom_ptr_z80 Sfx_73_Snd
 
rom_ptr_z80 Sfx_74_Snd
 
rom_ptr_z80 Sfx_75_Snd
 
rom_ptr_z80 Sfx_76_Snd
 
rom_ptr_z80 Sfx_77_Snd
 
rom_ptr_z80 Sfx_78_Snd
 
rom_ptr_z80 Sfx_79_Snd
 
rom_ptr_z80 Sfx_7A_Snd
 
rom_ptr_z80 Sfx_7B_Snd
 
rom_ptr_z80 Sfx_7C_Snd
 
rom_ptr_z80 Sfx_7D_Snd
 
rom_ptr_z80 Sfx_7E_Snd
 
rom_ptr_z80 Sfx_7F_Snd
 
rom_ptr_z80 Sfx_80_Snd
 
rom_ptr_z80 Sfx_81_Snd
 
rom_ptr_z80 Sfx_82_Snd
 
rom_ptr_z80 Sfx_83_Snd
 
rom_ptr_z80 Sfx_84_Snd
 
rom_ptr_z80 Sfx_85_Snd
 
rom_ptr_z80 Sfx_86_Snd
 
rom_ptr_z80 Sfx_87_Snd
 
rom_ptr_z80 Sfx_88_Snd
 
rom_ptr_z80 Sfx_89_Snd
 
rom_ptr_z80 Sfx_8A_Snd
 
rom_ptr_z80 Sfx_8B_Snd
 
rom_ptr_z80 Sfx_8C_Snd
 
rom_ptr_z80 Sfx_8D_Snd
 
rom_ptr_z80 Sfx_8E_Snd
 
rom_ptr_z80 Sfx_8F_Snd
 
rom_ptr_z80 Sfx_90_Snd
 
rom_ptr_z80 Sfx_91_Snd
 
rom_ptr_z80 Sfx_92_Snd
 
rom_ptr_z80 Sfx_93_Snd
 
rom_ptr_z80 Sfx_94_Snd
 
rom_ptr_z80 Sfx_95_Snd
 
rom_ptr_z80 Sfx_96_Snd
 
rom_ptr_z80 Sfx_97_Snd
 
rom_ptr_z80 Sfx_98_Snd
 
rom_ptr_z80 Sfx_99_Snd
 
rom_ptr_z80 Sfx_9A_Snd
 
rom_ptr_z80 Sfx_9B_Snd
 
rom_ptr_z80 Sfx_9C_Snd
 
rom_ptr_z80 Sfx_9D_Snd
 
rom_ptr_z80 Sfx_9E_Snd
 
rom_ptr_z80 Sfx_9F_Snd
 
rom_ptr_z80 Sfx_A0_Snd
 
rom_ptr_z80 Sfx_A1_Snd
 
rom_ptr_z80 Sfx_A2_Snd
 
rom_ptr_z80 Sfx_A3_Snd
 
rom_ptr_z80 Sfx_A4_Snd
 
rom_ptr_z80 Sfx_A5_Snd
 
rom_ptr_z80 Sfx_A6_Snd
 
rom_ptr_z80 Sfx_A7_Snd
 
rom_ptr_z80 Sfx_A8_Snd
 
rom_ptr_z80 Sfx_A9_Snd
 
rom_ptr_z80 Sfx_AA_Snd
 
rom_ptr_z80 Sfx_AB_Snd
 
rom_ptr_z80 Sfx_AC_Snd
 
rom_ptr_z80 Sfx_AD_Snd
 
rom_ptr_z80 Sfx_AE_Snd
 
rom_ptr_z80 Sfx_AF_Snd
 
rom_ptr_z80 Sfx_B0_Snd
 
rom_ptr_z80 Sfx_B1_Snd
 
rom_ptr_z80 Sfx_B2_Snd
 
rom_ptr_z80 Sfx_B3_Snd
 
rom_ptr_z80 Sfx_B4_Snd
 
rom_ptr_z80 Sfx_B5_Snd
 
rom_ptr_z80 Sfx_B6_Snd
 
rom_ptr_z80 Sfx_B7_Snd
 
rom_ptr_z80 Sfx_B8_Snd
 
rom_ptr_z80 Sfx_B9_Snd
 
rom_ptr_z80 Sfx_BA_Snd
 
rom_ptr_z80 Sfx_BB_Snd
 
rom_ptr_z80 Sfx_BC_Snd
 
rom_ptr_z80 Sfx_BD_Snd
 
rom_ptr_z80 Sfx_BE_Snd
 
rom_ptr_z80 Sfx_BF_Snd
 
rom_ptr_z80 Sfx_C0_Snd
 
rom_ptr_z80 Sfx_C1_Snd
 
rom_ptr_z80 Sfx_C2_Snd
 
rom_ptr_z80 Sfx_C3_Snd
 
rom_ptr_z80 Sfx_C4_Snd
 
rom_ptr_z80 Sfx_C5_Snd
 
rom_ptr_z80 Sfx_C6_Snd
 
rom_ptr_z80 Sfx_C7_Snd
 
rom_ptr_z80 Sfx_C8_Snd
 
rom_ptr_z80 Sfx_C9_Snd
 
rom_ptr_z80 Sfx_CA_Snd
 
rom_ptr_z80 Sfx_CB_Snd
 
rom_ptr_z80 Sfx_CC_Snd
 
rom_ptr_z80 Sfx_CD_Snd
 
rom_ptr_z80 Sfx_CE_Snd
 
rom_ptr_z80 Sfx_CF_Snd
 
rom_ptr_z80 Sfx_D0_Snd
 
rom_ptr_z80 Sfx_D1_Snd
 
rom_ptr_z80 Sfx_D2_Snd
 
rom_ptr_z80 Sfx_D3_Snd
 
rom_ptr_z80 Sfx_D4_Snd
 
rom_ptr_z80 Sfx_D5_Snd
 
rom_ptr_z80 Sfx_D6_Snd
 
rom_ptr_z80 Sfx_D7_Snd
 
rom_ptr_z80 Sfx_D8_Snd
 
rom_ptr_z80 Sfx_D9_Snd
 
rom_ptr_z80 Sfx_DA_Snd
 
rom_ptr_z80 Sfx_DB_Snd
 
rom_ptr_z80 Sfx_DB_Snd
 
rom_ptr_z80 Sfx_DB_Snd
 
rom_ptr_z80 Sfx_DB_Snd
 
rom_ptr_z80 Sfx_DB_Snd
 
DriverPointersEnd:
 
 
UniversalVoiceBank:
 
binclude "sound/uvb.bin"
 
UniversalVoiceBankEnd:
 
 
align $8000
 
dacBank0Start := *
 
DacBank0:
 
binclude "sound/dac_0.bin"
 
if * > dacBank0Start + $8000
 
fatal "dacBank0 must fit in $8000 bytes but was $\{*-dacBank0Start}. Try moving something to another bank."
 
else
 
;message "dacBank0 has $\{$8000+dacBank0Start-*} bytes free at end."
 
endif
 
 
align $8000
 
bank1Start := *
 
DacBank1:
 
binclude "sound/dac_1.bin"
 
align $8000
 
if * > dacBank1Start + $8000
 
fatal "dacBank1 must fit in $8000 bytes but was $\{*-dacBank1Start}. Try moving something to another bank."
 
else
 
;message "dacBank1 has $\{$8000+dacBank1Start-*} bytes free at end."
 
endif
 
 
align $8000
 
bank2Start := *
 
DacBank2:
 
binclude "sound/dac_2.bin"
 
if * > dacBank2Start + $8000
 
fatal "dacBank2 must fit in $8000 bytes but was $\{*-dacBank2Start}. Try moving something to another bank."
 
else
 
;message "dacBank2 has $\{$8000+dacBank2Start-*} bytes free at end."
 
endif
 
 
align $8000
 
bank0Start := *
 
Bank0:
 
binclude "sound/filler.bin"
 
Mini_Boss_Snd:
 
binclude "sound/miniboss.snd"
 
Final_Boss_Snd:
 
binclude "sound/f_boss.snd"
 
if * > bank0Start + $8000
 
fatal "bank0 must fit in $8000 bytes but was $\{*-bank0Start}. Try moving something to another bank."
 
else
 
;message "bank0 has $\{$8000+bank0Start-*} bytes free at end."
 
endif
 
 
align $8000
 
bank1Start := *
 
Bank1:
 
Angel_Island_1_Snd:
 
binclude "sound/aiz1.snd"
 
Angel_Island_2_Snd:
 
binclude "sound/aiz2.snd"
 
Hidrocity_1_Snd:
 
binclude "sound/hcz1.snd"
 
Hidrocity_2_Snd:
 
binclude "sound/hcz2.snd"
 
Marble_Garden_1_Snd:
 
binclude "sound/mgz1.snd"
 
Marble_Garden_2_Snd:
 
binclude "sound/mgz2.snd"
 
Carnival_Night_2_Snd:
 
binclude "sound/cnz2.snd"
 
Carnival_Night_1_Snd:
 
binclude "sound/cnz1.snd"
 
Flying_Battery_1_Snd:
 
binclude "sound/fbz1.snd"
 
Flying_Battery_2_Snd:
 
binclude "sound/fbz2.snd"
 
The_Doomsday_Snd:
 
binclude "sound/tdz.snd"
 
if * > bank1Start + $8000
 
fatal "bank1 must fit in $8000 bytes but was $\{*-bank1Start}. Try moving something to another bank."
 
else
 
;message "bank1 has $\{$8000+bank1Start-*} bytes free at end."
 
endif
 
 
align $8000
 
bank2Start := *
 
Bank2:
 
Icecap_2_Snd:
 
binclude "sound/iz2.snd"
 
Icecap_1_Snd:
 
binclude "sound/iz1.snd"
 
Launch_Base_2_Snd:
 
binclude "sound/lbz2.snd"
 
Launch_Base_1_Snd:
 
binclude "sound/lbz1.snd"
 
Mushroom_Hill_1_Snd:
 
binclude "sound/mhz1.snd"
 
Mushroom_Hill_2_Snd:
 
binclude "sound/mhz2.snd"
 
Sandopolis_1_Snd:
 
binclude "sound/sz1.snd"
 
Sandopolis_2_Snd:
 
binclude "sound/sz2.snd"
 
Lava_Reef_1_Snd:
 
binclude "sound/lrz1.snd"
 
Lava_Reef_2_Snd:
 
binclude "sound/lrz2.snd"
 
Sky_Sanctuary_Snd:
 
binclude "sound/scz.snd"
 
Death_Egg_1_Snd:
 
binclude "sound/dez1.snd"
 
Death_Egg_2_Snd:
 
binclude "sound/dez2.snd"
 
Mini_Boss_SK_Snd:
 
binclude "sound/mb_sk.snd"
 
Boss_Snd:
 
binclude "sound/boss.snd"
 
Glowing_Spheres_Bonus_Stage_snd:
 
binclude "sound/gs_bs.snd"
 
Special_Stage_Snd:
 
binclude "sound/ss.snd"
 
Level_Results_Snd:
 
binclude "sound/lr.snd"
 
Menu_Snd:
 
binclude "sound/menu.snd"
 
if * > bank2Start + $8000
 
fatal "bank2 must fit in $8000 bytes but was $\{*-bank2Start}. Try moving something to another bank."
 
else
 
;message "bank2 has $\{$8000+bank2Start-*} bytes free at end."
 
endif
 
 
align $8000
 
bank3Start := *
 
Bank3:
 
Slot_Machine_Bonus_Stage_snd:
 
binclude "sound/sm_bs.snd"
 
Gum_Ball_Machine_Bonus_Stage_snd:
 
binclude "sound/gbm_bs.snd"
 
Knuckles_Theme_Snd:
 
binclude "sound/kte.snd"
 
Azure_Lake_Snd:
 
binclude "sound/alz.snd"
 
Balloon_Park_Snd:
 
binclude "sound/bpz.snd"
 
Desert_Palace_Snd:
 
binclude "sound/dpz.snd"
 
Chrome_Gadget_Snd:
 
binclude "sound/cgz.snd"
 
Endless_Mine_Snd:
 
binclude "sound/emz.snd"
 
Title_Screen_Snd:
 
binclude "sound/ts.snd"
 
Credits_Snd:
 
binclude "sound/credits.snd"
 
Time_Game_Over_Snd:
 
binclude "sound/tgovr.snd"
 
Continue_Snd:
 
binclude "sound/continue.snd"
 
Extra_Life_Snd:
 
binclude "sound/1up.snd"
 
Emerald_Snd:
 
binclude "sound/emerald.snd"
 
Invencibility_Snd:
 
binclude "sound/invcblty.snd"
 
Competition_Menu_Snd:
 
binclude "sound/2p_menu.snd"
 
Underwater_Timming_Snd:
 
binclude "sound/panic.snd"
 
Presented_by_SEGA_Snd:
 
binclude "sound/p_sega.snd"
 
if * > bank3Start + $8000
 
fatal "bank3 must fit in $8000 bytes but was $\{*-bank3Start}. Try moving something to another bank."
 
else
 
;message "bank3 has $\{$8000+bank3Start-*} bytes free at end."
 
endif
 
 
align $8000
 
soundBankStart := *
 
SndBank:
 
SegaPCMBank:
 
SegaSnd:
 
binclude "sound/sega.snd"
 
Sfx_33_Snd:
 
binclude "sound/sfx_34.snd"
 
Sfx_34_Snd:
 
binclude "sound/sfx_35.snd"
 
Sfx_35_Snd:
 
binclude "sound/sfx_36.snd"
 
Sfx_36_Snd:
 
binclude "sound/sfx_37.snd"
 
Sfx_37_Snd:
 
binclude "sound/sfx_38.snd"
 
Sfx_38_Snd:
 
binclude "sound/sfx_39.snd"
 
Sfx_39_Snd:
 
binclude "sound/sfx_3A.snd"
 
Sfx_3A_Snd:
 
binclude "sound/sfx_3B.snd"
 
Sfx_3B_Snd:
 
binclude "sound/sfx_3C.snd"
 
Sfx_3C_Snd:
 
binclude "sound/sfx_3D.snd"
 
Sfx_3D_Snd:
 
binclude "sound/sfx_3E.snd"
 
Sfx_3E_Snd:
 
binclude "sound/sfx_3F.snd"
 
Sfx_3F_Snd:
 
binclude "sound/sfx_40.snd"
 
Sfx_40_Snd:
 
binclude "sound/sfx_41.snd"
 
Sfx_41_Snd:
 
binclude "sound/sfx_42.snd"
 
Sfx_42_Snd:
 
binclude "sound/sfx_43.snd"
 
Sfx_43_Snd:
 
binclude "sound/sfx_44.snd"
 
Sfx_44_Snd:
 
binclude "sound/sfx_45.snd"
 
Sfx_45_Snd:
 
binclude "sound/sfx_46.snd"
 
Sfx_46_Snd:
 
binclude "sound/sfx_47.snd"
 
Sfx_47_Snd:
 
binclude "sound/sfx_48.snd"
 
Sfx_48_Snd:
 
binclude "sound/sfx_49.snd"
 
Sfx_49_Snd:
 
binclude "sound/sfx_4A.snd"
 
Sfx_4A_Snd:
 
binclude "sound/sfx_4B.snd"
 
Sfx_4B_Snd:
 
binclude "sound/sfx_4C.snd"
 
Sfx_4C_Snd:
 
binclude "sound/sfx_4D.snd"
 
Sfx_4D_Snd:
 
binclude "sound/sfx_4E.snd"
 
Sfx_4E_Snd:
 
binclude "sound/sfx_4F.snd"
 
Sfx_4F_Snd:
 
binclude "sound/sfx_50.snd"
 
Sfx_50_Snd:
 
binclude "sound/sfx_51.snd"
 
Sfx_51_Snd:
 
binclude "sound/sfx_52.snd"
 
Sfx_52_Snd:
 
binclude "sound/sfx_53.snd"
 
Sfx_53_Snd:
 
binclude "sound/sfx_54.snd"
 
Sfx_54_Snd:
 
binclude "sound/sfx_55.snd"
 
Sfx_55_Snd:
 
binclude "sound/sfx_56.snd"
 
Sfx_56_Snd:
 
binclude "sound/sfx_57.snd"
 
Sfx_57_Snd:
 
binclude "sound/sfx_58.snd"
 
Sfx_58_Snd:
 
binclude "sound/sfx_59.snd"
 
Sfx_59_Snd:
 
binclude "sound/sfx_5A.snd"
 
Sfx_5A_Snd:
 
binclude "sound/sfx_5B.snd"
 
Sfx_5B_Snd:
 
binclude "sound/sfx_5C.snd"
 
Sfx_5C_Snd:
 
binclude "sound/sfx_5D.snd"
 
Sfx_5D_Snd:
 
binclude "sound/sfx_5E.snd"
 
Sfx_5E_Snd:
 
binclude "sound/sfx_5F.snd"
 
Sfx_5F_Snd:
 
binclude "sound/sfx_60.snd"
 
Sfx_60_Snd:
 
binclude "sound/sfx_61.snd"
 
Sfx_61_Snd:
 
binclude "sound/sfx_62.snd"
 
Sfx_62_Snd:
 
binclude "sound/sfx_63.snd"
 
Sfx_63_Snd:
 
binclude "sound/sfx_64.snd"
 
Sfx_64_Snd:
 
binclude "sound/sfx_65.snd"
 
Sfx_65_Snd:
 
binclude "sound/sfx_66.snd"
 
Sfx_66_Snd:
 
binclude "sound/sfx_67.snd"
 
Sfx_67_Snd:
 
binclude "sound/sfx_68.snd"
 
Sfx_68_Snd:
 
binclude "sound/sfx_69.snd"
 
Sfx_69_Snd:
 
binclude "sound/sfx_6A.snd"
 
Sfx_6A_Snd:
 
binclude "sound/sfx_6B.snd"
 
Sfx_6B_Snd:
 
binclude "sound/sfx_6C.snd"
 
Sfx_6C_Snd:
 
binclude "sound/sfx_6D.snd"
 
Sfx_6D_Snd:
 
binclude "sound/sfx_6E.snd"
 
Sfx_6E_Snd:
 
binclude "sound/sfx_6F.snd"
 
Sfx_6F_Snd:
 
binclude "sound/sfx_70.snd"
 
Sfx_70_Snd:
 
binclude "sound/sfx_71.snd"
 
Sfx_71_Snd:
 
binclude "sound/sfx_72.snd"
 
Sfx_72_Snd:
 
binclude "sound/sfx_73.snd"
 
Sfx_73_Snd:
 
binclude "sound/sfx_74.snd"
 
Sfx_74_Snd:
 
binclude "sound/sfx_75.snd"
 
Sfx_75_Snd:
 
binclude "sound/sfx_76.snd"
 
Sfx_76_Snd:
 
binclude "sound/sfx_77.snd"
 
Sfx_77_Snd:
 
binclude "sound/sfx_78.snd"
 
Sfx_78_Snd:
 
binclude "sound/sfx_79.snd"
 
Sfx_79_Snd:
 
binclude "sound/sfx_7A.snd"
 
Sfx_7A_Snd:
 
binclude "sound/sfx_7B.snd"
 
Sfx_7B_Snd:
 
binclude "sound/sfx_7C.snd"
 
Sfx_7C_Snd:
 
binclude "sound/sfx_7D.snd"
 
Sfx_7D_Snd:
 
binclude "sound/sfx_7E.snd"
 
Sfx_7E_Snd:
 
binclude "sound/sfx_7F.snd"
 
Sfx_7F_Snd:
 
binclude "sound/sfx_80.snd"
 
Sfx_80_Snd:
 
binclude "sound/sfx_81.snd"
 
Sfx_81_Snd:
 
binclude "sound/sfx_82.snd"
 
Sfx_82_Snd:
 
binclude "sound/sfx_83.snd"
 
Sfx_83_Snd:
 
binclude "sound/sfx_84.snd"
 
Sfx_84_Snd:
 
binclude "sound/sfx_85.snd"
 
Sfx_85_Snd:
 
binclude "sound/sfx_86.snd"
 
Sfx_86_Snd:
 
binclude "sound/sfx_87.snd"
 
Sfx_87_Snd:
 
binclude "sound/sfx_88.snd"
 
Sfx_88_Snd:
 
binclude "sound/sfx_89.snd"
 
Sfx_89_Snd:
 
binclude "sound/sfx_8A.snd"
 
Sfx_8A_Snd:
 
binclude "sound/sfx_8B.snd"
 
Sfx_8B_Snd:
 
binclude "sound/sfx_8C.snd"
 
Sfx_8C_Snd:
 
binclude "sound/sfx_8D.snd"
 
Sfx_8D_Snd:
 
binclude "sound/sfx_8E.snd"
 
Sfx_8E_Snd:
 
binclude "sound/sfx_8F.snd"
 
Sfx_8F_Snd:
 
binclude "sound/sfx_90.snd"
 
Sfx_90_Snd:
 
binclude "sound/sfx_91.snd"
 
Sfx_91_Snd:
 
binclude "sound/sfx_92.snd"
 
Sfx_92_Snd:
 
binclude "sound/sfx_93.snd"
 
Sfx_93_Snd:
 
binclude "sound/sfx_94.snd"
 
Sfx_94_Snd:
 
binclude "sound/sfx_95.snd"
 
Sfx_95_Snd:
 
binclude "sound/sfx_96.snd"
 
Sfx_96_Snd:
 
binclude "sound/sfx_97.snd"
 
Sfx_97_Snd:
 
binclude "sound/sfx_98.snd"
 
Sfx_98_Snd:
 
binclude "sound/sfx_99.snd"
 
Sfx_99_Snd:
 
binclude "sound/sfx_9A.snd"
 
Sfx_9A_Snd:
 
binclude "sound/sfx_9B.snd"
 
Sfx_9B_Snd:
 
binclude "sound/sfx_9C.snd"
 
Sfx_9C_Snd:
 
binclude "sound/sfx_9D.snd"
 
Sfx_9D_Snd:
 
binclude "sound/sfx_9E.snd"
 
Sfx_9E_Snd:
 
binclude "sound/sfx_9F.snd"
 
Sfx_9F_Snd:
 
binclude "sound/sfx_A0.snd"
 
Sfx_A0_Snd:
 
binclude "sound/sfx_A1.snd"
 
Sfx_A1_Snd:
 
binclude "sound/sfx_A2.snd"
 
Sfx_A2_Snd:
 
binclude "sound/sfx_A3.snd"
 
Sfx_A3_Snd:
 
binclude "sound/sfx_A4.snd"
 
Sfx_A4_Snd:
 
binclude "sound/sfx_A5.snd"
 
Sfx_A5_Snd:
 
binclude "sound/sfx_A6.snd"
 
Sfx_A6_Snd:
 
binclude "sound/sfx_A7.snd"
 
Sfx_A7_Snd:
 
binclude "sound/sfx_A8.snd"
 
Sfx_A8_Snd:
 
binclude "sound/sfx_A9.snd"
 
Sfx_A9_Snd:
 
binclude "sound/sfx_AA.snd"
 
Sfx_AA_Snd:
 
binclude "sound/sfx_AB.snd"
 
Sfx_AB_Snd:
 
binclude "sound/sfx_AC.snd"
 
Sfx_AC_Snd:
 
binclude "sound/sfx_AD.snd"
 
Sfx_AD_Snd:
 
binclude "sound/sfx_AE.snd"
 
Sfx_AE_Snd:
 
binclude "sound/sfx_AF.snd"
 
Sfx_AF_Snd:
 
binclude "sound/sfx_B0.snd"
 
Sfx_B0_Snd:
 
binclude "sound/sfx_B1.snd"
 
Sfx_B1_Snd:
 
binclude "sound/sfx_B2.snd"
 
Sfx_B2_Snd:
 
binclude "sound/sfx_B3.snd"
 
Sfx_B3_Snd:
 
binclude "sound/sfx_B4.snd"
 
Sfx_B4_Snd:
 
binclude "sound/sfx_B5.snd"
 
Sfx_B5_Snd:
 
binclude "sound/sfx_B6.snd"
 
Sfx_B6_Snd:
 
binclude "sound/sfx_B7.snd"
 
Sfx_B7_Snd:
 
binclude "sound/sfx_B8.snd"
 
Sfx_B8_Snd:
 
binclude "sound/sfx_B9.snd"
 
Sfx_B9_Snd:
 
binclude "sound/sfx_BA.snd"
 
Sfx_BA_Snd:
 
binclude "sound/sfx_BB.snd"
 
Sfx_BB_Snd:
 
binclude "sound/sfx_BC.snd"
 
Sfx_BC_Snd:
 
binclude "sound/sfx_BD.snd"
 
Sfx_BD_Snd:
 
binclude "sound/sfx_BE.snd"
 
Sfx_BE_Snd:
 
binclude "sound/sfx_BF.snd"
 
Sfx_BF_Snd:
 
binclude "sound/sfx_C0.snd"
 
Sfx_C0_Snd:
 
binclude "sound/sfx_C1.snd"
 
Sfx_C1_Snd:
 
binclude "sound/sfx_C2.snd"
 
Sfx_C2_Snd:
 
binclude "sound/sfx_C3.snd"
 
Sfx_C3_Snd:
 
binclude "sound/sfx_C4.snd"
 
Sfx_C4_Snd:
 
binclude "sound/sfx_C5.snd"
 
Sfx_C5_Snd:
 
binclude "sound/sfx_C6.snd"
 
Sfx_C6_Snd:
 
binclude "sound/sfx_C7.snd"
 
Sfx_C7_Snd:
 
binclude "sound/sfx_C8.snd"
 
Sfx_C8_Snd:
 
binclude "sound/sfx_C9.snd"
 
Sfx_C9_Snd:
 
binclude "sound/sfx_CA.snd"
 
Sfx_CB_Snd:
 
binclude "sound/sfx_CB.snd"
 
Sfx_CA_Snd:
 
binclude "sound/sfx_CC.snd"
 
Sfx_CB_Snd:
 
binclude "sound/sfx_CD.snd"
 
Sfx_CD_Snd:
 
binclude "sound/sfx_CE.snd"
 
Sfx_CE_Snd:
 
binclude "sound/sfx_CF.snd"
 
Sfx_CF_Snd:
 
binclude "sound/sfx_D0.snd"
 
Sfx_D0_Snd:
 
binclude "sound/sfx_D1.snd"
 
Sfx_D1_Snd:
 
binclude "sound/sfx_D2.snd"
 
Sfx_D2_Snd:
 
binclude "sound/sfx_D3.snd"
 
Sfx_D3_Snd:
 
binclude "sound/sfx_D4.snd"
 
Sfx_D4_Snd:
 
binclude "sound/sfx_D5.snd"
 
Sfx_D5_Snd:
 
binclude "sound/sfx_D6.snd"
 
Sfx_D6_Snd:
 
binclude "sound/sfx_D7.snd"
 
Sfx_D7_Snd:
 
binclude "sound/sfx_D8.snd"
 
Sfx_D8_Snd:
 
binclude "sound/sfx_D9.snd"
 
Sfx_D9_Snd:
 
binclude "sound/sfx_DA.snd"
 
Sfx_DA_Snd:
 
binclude "sound/sfx_DB.snd"
 
Sfx_DB_Snd:
 
binclude "sound/sfx_DC.snd"
 
 
if * > soundBankStart + $8000
 
fatal "soundBank must fit in $8000 bytes but was $\{*-soundBankStart}. Try moving something to another bank."
 
else
 
;message "soundBank has $\{$8000+soundBankStart-*} bytes free at end."
 
endif
 
</asm>
 
 
==Upgrading the Playback Routines==
 
==Upgrading the Playback Routines==
 
Now we have the code to load the new driver, time to add the new playback routines.
 
Now we have the code to load the new driver, time to add the new playback routines.
Line 1,559: Line 95:
 
===Upgrade Music Routine===
 
===Upgrade Music Routine===
 
First the PlayMusic routine, locate:
 
First the PlayMusic routine, locate:
<asm>
+
<pre>
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; If Music_to_play is clear, move d0 into Music_to_play,
 
; If Music_to_play is clear, move d0 into Music_to_play,
Line 1,573: Line 109:
 
rts
 
rts
 
; End of function PlayMusic
 
; End of function PlayMusic
</asm>
+
</pre>
 
and we will replace it with '''this''' code:
 
and we will replace it with '''this''' code:
<asm>
+
<pre>
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 
; Subroutine to play a music track
 
; Subroutine to play a music track
Line 1,594: Line 130:
 
jmp SetTempo
 
jmp SetTempo
  
stopZ80
+
+ stopZ80
 
move.b d0,($A01C0A).l
 
move.b d0,($A01C0A).l
 
startZ80
 
startZ80
 
rts
 
rts
 
; End of function PlaySound
 
; End of function PlaySound
</asm>
+
</pre>
  
 
===Upgrade Sound Routines===
 
===Upgrade Sound Routines===
 
now find:
 
now find:
<asm>
+
<pre>
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; play a sound if the source is onscreen
 
; play a sound if the source is onscreen
Line 1,614: Line 150:
 
rts
 
rts
 
; End of function PlaySoundLocal
 
; End of function PlaySoundLocal
</asm>
+
</pre>
 
and replace it with:
 
and replace it with:
<asm>
+
<pre>
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; play a sound if the source is onscreen
 
; play a sound if the source is onscreen
Line 1,625: Line 161:
 
bra.s PlaySound
 
bra.s PlaySound
 
; End of function PlaySoundLocal
 
; End of function PlaySoundLocal
</asm>
+
</pre>
 
now we will find:
 
now we will find:
<asm>
+
<pre>
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
Line 1,644: Line 180:
 
rts
 
rts
 
; End of function PlaySoundStereo
 
; End of function PlaySoundStereo
</asm>
+
</pre>
 
and replace it with:
 
and replace it with:
<asm>
+
<pre>
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
Line 1,685: Line 221:
 
rts
 
rts
  
</asm>
+
</pre>
 +
 
 
==Upgrading Pause / Resume Routines==
 
==Upgrading Pause / Resume Routines==
 
Now the playback routines are fixed and we have a routine to set the tempo the way the sneakers do, which we will elaberate later on, but we still have to update the pause / resume routines to the Sonic 3 equivilents.
 
Now the playback routines are fixed and we have a routine to set the tempo the way the sneakers do, which we will elaberate later on, but we still have to update the pause / resume routines to the Sonic 3 equivilents.
  
 
Find:
 
Find:
<asm>
+
<pre>
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 
; Subroutine to pause the game
 
; Subroutine to pause the game
Line 1,751: Line 288:
 
rts
 
rts
 
; End of function PauseGame
 
; End of function PauseGame
</asm>
+
</pre>
 
and replace it with:
 
and replace it with:
<asm>
+
<pre>
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 
; Subroutine to pause the game
 
; Subroutine to pause the game
Line 1,783: Line 320:
 
btst #button_A,(Ctrl_1_Press).w
 
btst #button_A,(Ctrl_1_Press).w
 
beq.s Pause_ChkBC
 
beq.s Pause_ChkBC
move.b #$GameModeID_TitleScreen,(Game_Mode).w ; Go To Title Screen
+
move.b #GameModeID_TitleScreen,(Game_Mode).w ; Go To Title Screen
 
nop
 
nop
 
bra.s Pause_Resume
 
bra.s Pause_Resume
Line 1,817: Line 354:
 
rts
 
rts
 
; End of function PauseGame
 
; End of function PauseGame
</asm>
+
</pre>
 +
now find:
 +
<pre>
 +
; loc_541A:
 +
SpecialStage_Unpause:
 +
move.b #MusID_Unpause,(Music_to_play).w
 +
move.b #8,(Vint_routine).w
 +
bra.w WaitForVint
 +
</pre>
 +
replace the line right after the label with:
 +
<pre>
 +
stopZ80
 +
move.b #$80,($A01C10).l
 +
startZ80
 +
</pre>
  
 
==Driver Data Files==
 
==Driver Data Files==
then unpack this into the 'sound' folder and, optionally, remove the original files since we no longer need them anymore:
+
Unpack this into the 'sound' folder and, optionally, remove the original files since we no longer need them anymore:
 
{{Download|file=s3driverdata.7z|filesize=131kb|title=The Sonic 3 Driver data files|plural=1}}
 
{{Download|file=s3driverdata.7z|filesize=131kb|title=The Sonic 3 Driver data files|plural=1}}
  
Line 1,827: Line 378:
 
===Music===
 
===Music===
 
Go to '''MusID__First''' and you will notice '''this''':
 
Go to '''MusID__First''' and you will notice '''this''':
<asm>
+
<pre>
 +
; Music IDs
 +
offset := zMasterPlaylist
 +
ptrsize := 1
 +
idstart := $81
 +
; $80 is reserved for silence, so if you make idstart $80 or less,
 +
; you may need to insert a dummy zMusIDPtr in the $80 slot
 +
 
 
MusID__First = idstart
 
MusID__First = idstart
 
MusID_2PResult = id(zMusIDPtr_2PResult) ; 81
 
MusID_2PResult = id(zMusIDPtr_2PResult) ; 81
Line 1,861: Line 419:
 
MusID_Countdown = id(zMusIDPtr_Countdown) ; 9F
 
MusID_Countdown = id(zMusIDPtr_Countdown) ; 9F
 
MusID__End = id(zMusIDPtr__End) ; A0
 
MusID__End = id(zMusIDPtr__End) ; A0
</asm>
+
</pre>
 
That may be good if you were using the Sonic 2 driver, but obviously you are not, so we need to change it.
 
That may be good if you were using the Sonic 2 driver, but obviously you are not, so we need to change it.
<asm>
+
<pre>
MusID__First = 0
+
MusID__First = 1
 
MusID_AIZ1 = 1
 
MusID_AIZ1 = 1
 
MusID_AIZ2 = 2
 
MusID_AIZ2 = 2
Line 1,935: Line 493:
 
MusID_SuperSonic = MusID_Invincible
 
MusID_SuperSonic = MusID_Invincible
 
MusID__End = $33
 
MusID__End = $33
</asm>
+
</pre>
 
The original music IDs in the compatibility section can be set to whichever ones you want in the above (I wouldn't recommend editing the 2PResult one though)
 
The original music IDs in the compatibility section can be set to whichever ones you want in the above (I wouldn't recommend editing the 2PResult one though)
 +
 
===Sound Effects===
 
===Sound Effects===
 
Okay, now we actually have the music working (well, sorta working, fades and music stops aren't working yet though and we will fix that very soon), so it is time to get those sound effects working as they should.
 
Okay, now we actually have the music working (well, sorta working, fades and music stops aren't working yet though and we will fix that very soon), so it is time to get those sound effects working as they should.
 
We want to start with '''SndID__First'''.  you may notice that this area looks like this:
 
We want to start with '''SndID__First'''.  you may notice that this area looks like this:
<asm>
+
<pre>
 +
; Sound IDs
 +
offset := SoundIndex
 +
ptrsize := 2
 +
idstart := $A0
 +
; $80 is reserved for silence, so if you make idstart $80 or less,
 +
; you may need to insert a dummy SndPtr in the $80 slot
 +
 
 
SndID__First = idstart
 
SndID__First = idstart
 
SndID_Jump = id(SndPtr_Jump) ; A0
 
SndID_Jump = id(SndPtr_Jump) ; A0
Line 2,027: Line 593:
 
endif
 
endif
 
     endif
 
     endif
</asm>
+
</pre>
 
Yikes!  that last section about IDs really has to go! But on another note, this code seems best for the Sonic 2 driver, it needs fixing.
 
Yikes!  that last section about IDs really has to go! But on another note, this code seems best for the Sonic 2 driver, it needs fixing.
 
the fixed version is below:
 
the fixed version is below:
<asm>
+
<pre>
 
SndID__First = $33
 
SndID__First = $33
 
SndID_RingRight = $33
 
SndID_RingRight = $33
Line 2,219: Line 785:
 
SndID_Signpost2P = SndID_Sparkle2
 
SndID_Signpost2P = SndID_Sparkle2
 
SndID_OOZLidPop = SndID_ArrowFiring
 
SndID_OOZLidPop = SndID_ArrowFiring
SndID_SlidingSpike = SNDID_SSZEggRoboFly
+
SndID_SlidingSpike = SndID_SSZEggRoboFly
 
SndID_PlatformKnock = SndID_Chop
 
SndID_PlatformKnock = SndID_Chop
 
SndID_BonusBumper = SndID_Bounce
 
SndID_BonusBumper = SndID_Bounce
Line 2,239: Line 805:
 
SndID_Scatter = SndID_Unk14
 
SndID_Scatter = SndID_Unk14
 
SndID__End = $E0
 
SndID__End = $E0
</asm>
+
</pre>
 +
 
 
==Fixing the special sounds==
 
==Fixing the special sounds==
 
Any time you update the sound driver, you need to change these sounds:
 
Any time you update the sound driver, you need to change these sounds:
<asm>
+
<pre>
 
; Special sound IDs
 
; Special sound IDs
  
Line 2,253: Line 820:
 
MusID_Pause = $7E+$80 ; FE
 
MusID_Pause = $7E+$80 ; FE
 
MusID_Unpause = $7F+$80 ; FF
 
MusID_Unpause = $7F+$80 ; FF
</asm>
+
</pre>
First of all, speed up and slow down are no longer sounds, they are called by a completely different routine, but new equates for those are still useful. Second, pause and unpause are no longer sounds but are directly handled by the '''PauseGame''' routine that we upgraded above. No equates are necessary for those two. StopSFX is not used in the sonic3 driver as far as I know, so we will treat it as a compat id. the resulting lists will look like THIS:
+
First of all, speed up and slow down are no longer sounds, they are called by a completely different routine, but new equates for those are still useful. Second, pause and unpause are no longer sounds but are directly handled by the '''PauseGame''' routine that we upgraded above. No equates are necessary for those two. StopSFX is not used in the Sonic 3 driver as far as I know, so we will treat it as a compatibility ID. The resulting lists will look like THIS:
<asm>
+
<pre>
 
; Special sound IDs
 
; Special sound IDs
  
Line 2,268: Line 835:
 
Tempo_SpeedUp = 8
 
Tempo_SpeedUp = 8
 
Tempo_SlowDown = 0
 
Tempo_SlowDown = 0
</asm>
+
</pre>
  
==Fixing the Sneaker==
+
==Fixing the Sneakers==
I bet you expected that the sneaker would be fixed with the previous section, but no, sonic3 uses a different routine for the sneaker speed up / slow down.
+
I bet you expected that the sneakers would be fixed with the previous section, but no, Sonic 3 uses a different routine for the sneaker speed up / slow down.
first we will go to '''super_shoes+'''.  What we will see is this:
+
First, we will go to '''super_shoes_Tails''' and, beyond the +, we'll find this:
<asm>
+
<pre>
 
move.w #MusID_SpeedUp,d0
 
move.w #MusID_SpeedUp,d0
 
jmp (PlayMusic).l ; Speed up tempo
 
jmp (PlayMusic).l ; Speed up tempo
</asm>
+
</pre>
that will not work the way we want it to. It will actually cause a compiler error, so we need to fix it:
+
That will not work the way we want it to. It will actually cause an error during assembly of the ROM, so we need to fix it:
<asm>
+
<pre>
 
move.w #Tempo_SpeedUp,d0
 
move.w #Tempo_SpeedUp,d0
 
jmp (SetTempo).l ; Speed up tempo
 
jmp (SetTempo).l ; Speed up tempo
</asm>
+
</pre>
the music now speeds up, but we need it to slow down when the sneaker wears off, so find:
+
The music now speeds up, but we need it to slow down when the sneakers wear off, so find:
<asm>
+
<pre>
 
; loc_1A14A:
 
; loc_1A14A:
 
Obj01_RmvSpeed:
 
Obj01_RmvSpeed:
Line 2,289: Line 856:
 
move.w #MusID_SlowDown,d0 ; Slow down tempo
 
move.w #MusID_SlowDown,d0 ; Slow down tempo
 
jmp (PlayMusic).l
 
jmp (PlayMusic).l
;</asm>
+
</pre>
there are 2 lines that need editing here, just as before.
+
There are 2 lines that need editing here, just as before.
<asm>
+
<pre>
 
; loc_1A14A:
 
; loc_1A14A:
 
Obj01_RmvSpeed:
 
Obj01_RmvSpeed:
Line 2,297: Line 864:
 
move.w #Tempo_SlowDown,d0 ; Slow down tempo
 
move.w #Tempo_SlowDown,d0 ; Slow down tempo
 
jmp (SetTempo).l
 
jmp (SetTempo).l
</asm>
+
</pre>
do the exact same thing to '''Obj02_ChkShoes'''. Now the sneakers should be working as intended.
+
This will fix it for Sonic, but for Tails, do the exact same thing to '''Obj02_ChkShoes'''. Now the sneakers should be working as intended.
==Optional: Fix the level select==
+
==Optional: Apply New Sounds to Existing Objects==
 
''(coming soon)''
 
''(coming soon)''
 +
 +
==Optional: Fix the 2P VS Screen==
 +
You will probably notice that the 2 player mode level select is still playing the same music as the options screen, but sonic 3 has its own 2 player mode music.  Here we will fix that.  locate this code:
 +
<pre>
 +
move.b #MusID_Options,d0
 +
bsr.w JmpTo_PlayMusic
 +
move.w #$707,(Demo_Time_left).w
 +
clr.w (Two_player_mode).w
 +
clr.l (Camera_X_pos).w
 +
clr.l (Camera_Y_pos).w
 +
move.b #$16,(Vint_routine).w
 +
bsr.w WaitForVint
 +
move.w (VDP_Reg1_val).w,d0
 +
ori.b #$40,d0
 +
move.w d0,(VDP_control_port).l
 +
bsr.w Pal_FadeFromBlack
 +
 +
;loc_8DA8:
 +
LevelSelect2P_Main:
 +
</pre>
 +
and change the music id to '''MusID_2PVS'''.<br>
 +
the result should be:
 +
<pre>
 +
move.b #MusID_2PVS,d0
 +
bsr.w JmpTo_PlayMusic
 +
move.w #$707,(Demo_Time_left).w
 +
clr.w (Two_player_mode).w
 +
clr.l (Camera_X_pos).w
 +
clr.l (Camera_Y_pos).w
 +
move.b #$16,(Vint_routine).w
 +
bsr.w WaitForVint
 +
move.w (VDP_Reg1_val).w,d0
 +
ori.b #$40,d0
 +
move.w d0,(VDP_control_port).l
 +
bsr.w Pal_FadeFromBlack
 +
 +
;loc_8DA8:
 +
LevelSelect2P_Main:
 +
</pre>
 +
 +
==Optional: Fix the Sound Test==
 +
Okay, I assume that you would want the sound test working too, so I added a section on that. First, we want to go to '''OptionScreen_Choices'''.
 +
Here is what we have:
 +
<pre>
 +
OptionScreen_Choices:
 +
dc.l (3-1)<<24|(Player_option&$FFFFFF)
 +
dc.l (2-1)<<24|(Two_player_items&$FFFFFF)
 +
dc.l ($80-1)<<24|(Sound_test_sound&$FFFFFF)
 +
</pre>
 +
change that last line to:
 +
<pre>
 +
OptionScreen_Choices:
 +
dc.l ($FF)<<24|(Sound_test_sound&$FFFFFF)
 +
</pre>
 +
now we have a full range, but it is not fixed yet, so we will locate:
 +
<pre>
 +
move.w d2,(a1)
 +
cmpi.b #2,(Options_menu_box).w
 +
bne.s + ; rts
 +
andi.w #button_B_mask|button_C_mask,d0
 +
beq.s + ; rts
 +
move.w (Sound_test_sound).w,d0
 +
addi.w #$80,d0
 +
bsr.w JmpTo_PlayMusic
 +
lea (level_select_cheat).l,a0
 +
lea (continues_cheat).l,a2
 +
lea (Level_select_flag).w,a1
 +
moveq #0,d2 ; flag to tell the routine to enable the continues cheat
 +
bsr.w CheckCheats
 +
 +
+
 +
</pre>
 +
see that '''addi.w #$80,d0''' line?  It needs to go.  the result will be:
 +
<pre>
 +
move.w d2,(a1)
 +
cmpi.b #2,(Options_menu_box).w
 +
bne.s + ; rts
 +
andi.w #button_B_mask|button_C_mask,d0
 +
beq.s + ; rts
 +
move.w (Sound_test_sound).w,d0
 +
bsr.w JmpTo_PlayMusic
 +
lea (level_select_cheat).l,a0
 +
lea (continues_cheat).l,a2
 +
lea (Level_select_flag).w,a1
 +
moveq #0,d2 ; flag to tell the routine to enable the continues cheat
 +
bsr.w CheckCheats
 +
 +
+
 +
</pre>
 +
okay, that fixes the options screen, but not the level select.  We will do that next. go to '''LevSelControls_CheckLR'''.  Below I have shown the code:
 +
<pre>
 +
; loc_9522:
 +
LevSelControls_CheckLR:
 +
cmpi.w #$15,(Level_select_zone).w ; are we in the sound test?
 +
bne.s LevSelControls_SwitchSide ; no
 +
move.w (Sound_test_sound).w,d0
 +
move.b (Ctrl_1_Press).w,d1
 +
btst #button_left,d1
 +
beq.s +
 +
subq.b #1,d0
 +
bcc.s +
 +
moveq #$7F,d0
 +
 +
+
 +
btst #button_right,d1
 +
beq.s +
 +
addq.b #1,d0
 +
cmpi.w #$80,d0
 +
blo.s +
 +
moveq #0,d0
 +
 +
+
 +
btst #button_A,d1
 +
beq.s +
 +
addi.b #$10,d0
 +
andi.b #$7F,d0
 +
 +
+
 +
move.w d0,(Sound_test_sound).w
 +
andi.w #button_B_mask|button_C_mask,d1
 +
beq.s + ; rts
 +
move.w (Sound_test_sound).w,d0
 +
addi.w #$80,d0
 +
bsr.w JmpTo_PlayMusic
 +
lea (debug_cheat).l,a0
 +
lea (super_sonic_cheat).l,a2
 +
lea (Debug_options_flag).w,a1
 +
moveq #1,d2 ; flag to tell the routine to enable the Super Sonic cheat
 +
bsr.w CheckCheats
 +
 +
+
 +
rts
 +
</pre>
 +
First of all, it checks when you press left to see if the sound test value is -1, since the sound driver uses the whole byte for the sound ID, we don't want it to rest to 127 like it usually does.  It is very likely clear what you need to change there.  Next it checks when you press right if the value is 128, at that point we do not want it resetting to 0 for the same reason above, then there is that andi.b on the sound test value of 127 that caps the value at $7F, that needs to go. Also just before playing the sound, 128 is added to the sound test value, which we don't want, just in case you haven't figured it out, I outlined the changes below:
 +
<pre>
 +
; loc_9522:
 +
LevSelControls_CheckLR:
 +
cmpi.w #$15,(Level_select_zone).w ; are we in the sound test?
 +
bne.s LevSelControls_SwitchSide ; no
 +
move.w (Sound_test_sound).w,d0
 +
move.b (Ctrl_1_Press).w,d1
 +
btst #button_left,d1
 +
beq.s +
 +
subq.b #1,d0
 +
;bcc.s +                      ;<-- remove this line
 +
;moveq #$7F,d0          ;<-- remove this line
 +
 +
+
 +
btst #button_right,d1
 +
beq.s +
 +
addq.b #1,d0
 +
;cmpi.w #$80,d0        ;<-- remove this line
 +
;blo.s +                  ;<-- remove this line
 +
;moveq #0,d0            ;<-- remove this line
 +
 +
+
 +
btst #button_A,d1
 +
beq.s +
 +
addi.b #$10,d0
 +
;andi.b #$7F,d0      ;<-- remove this line
 +
 +
+
 +
move.w d0,(Sound_test_sound).w
 +
andi.w #button_B_mask|button_C_mask,d1
 +
beq.s + ; rts
 +
move.w (Sound_test_sound).w,d0
 +
;addi.w #$80,d0        ;<-- remove this line
 +
bsr.w JmpTo_PlayMusic
 +
lea (debug_cheat).l,a0
 +
lea (super_sonic_cheat).l,a2
 +
lea (Debug_options_flag).w,a1 ; Also S1_hidden_credits_flag
 +
moveq #1,d2 ; flag to tell the routine to enable the Super Sonic cheat
 +
bsr.w CheckCheats
 +
 +
+
 +
rts
 +
</pre>
 +
 +
===Note from WBilgini===
 +
 +
Alright, there is a chance when you compile, you'll a error about this line:
 +
 +
; share these symbols externally (WARNING: don't rename, move or remove these labels!)
 +
shared word_728C_user,Obj5F_MapUnc_7240,off_3A294,MapRUnc_Sonic,movewZ80CompSize
 +
 +
Remove the movewZ80CompSize and you'll be good.
 +
 +
Also, I noticed a bug. In the title screen, after you choose a option, for a second the sound will go earrape. I don't know how to fix this though. If you do, please edit this page to fix it!
  
 
{{S2Howtos}}
 
{{S2Howtos}}
[[Category:SCHG How-tos|{{PAGENAME}}]]
+
|{{PAGENAME}}]]

Latest revision as of 10:46, 5 April 2022

(Original guide by Kram1024)

Updated and fixed by User:WBilgini

You probably saw my method of placing the Sonic 3 sound driver in Sonic 1. Well, we are going to put it in Sonic 2 Rev01 this time. The changes are very similar to that of the Sonic 1 port. Over the years, I found that the S3 driver actually works without a Sonic game with minimal hacking (it just needs a wait routine to time it). Thus it is actually possible to put it into Sonic 2 with relative ease as well and into a homebrew too, though in homebrew it might not be legal anyways due to IP laws but Sega no longer enforces them on Genesis games anyways, thus why nobody gets sued for Sonic hacks, but let's get back to the hack.

Overview

First off, Sonic 3's sound driver has the V_Int reloader built into it so it is not needed, some routines need replacement, sounds need fixing, and we need to replace the sounds and music. We will be using the latest Github version of Sonic 2, if you wish to do it via a different version, I am sure you can come up with a way that works by seeing what changes I made in the Github version.

Preparing to Use Sonic 3/K/3K Sound System

The Vertical Interrupt and Horizontal Interrupt need to be fixed, since the Sonic 1/2 system uses them but the Sonic 3/K/3K system doesn't.

Removal of all Callbacks to the S2 Driver in the Vertical Interrupt

Unlike the S1 driver, Sonic 2 actually calls the driver over and over again after stopping the Z80 then restarting the Z80. The PlaySound routine of our new driver will do that automatically, so we do not really need any of that kind of code. We will search for all instances of:

	stopZ80			; stop the Z80
	bsr.w	sndDriverInput	; give input to the sound driver
	startZ80		; start the Z80

and comment it out or just plain remove it. I prefer to replace it with a nop instruction, but even comments or removal work as well. In case you are a little lazy, here is a list of routines with this code:

  • VintSub0
  • Loc_54A
  • Vint0_noWater (only touch the " bsr.w sndDriverInput ; give input to the sound driver" line)
  • loc_748 (only touch the " bsr.w sndDriverInput ; give input to the sound driver" line)
  • Vint_Pause_specialStage (only touch the " jsr (sndDriverInput).l)
  • off_97A (only touch the " jsr (sndDriverInput).l)
  • loc_BD6 (only touch the " jsr (sndDriverInput).l)
  • VintSub18 (only touch the " bsr.w sndDriverInput)
  • VintSub16 (only touch the " bsr.w sndDriverInput)
  • Loc_EFE (only touch the " bsr.w sndDriverInput)

Removal of sndDriverInput

Okay, we disabled the Sonic 2 Z80 sound driver junk, but we still have a vestige of the old driver taking up valuable ROM space. Locate:

sndDriverInput:
	lea	(Music_to_play&$00FFFFFF).l,a0
	lea	(Z80_RAM+zAbsVar).l,a1 ; $A01B80
	cmpi.b	#$80,zVar.QueueToPlay(a1)	; If this (zReadyFlag) isn't $80, the driver is processing a previous sound request.
	bne.s	loc_10C4	; So we'll wait until at least the next frame before putting anything in there.
	_move.b	0(a0),d0
	beq.s	loc_10A4
	_clr.b	0(a0)
	bra.s	loc_10AE
; ---------------------------------------------------------------------------

loc_10A4:
	move.b	4(a0),d0	; If there was something in Music_to_play_2, check what that was. Else, just go to the loop.
	beq.s	loc_10C4
	clr.b	4(a0)

loc_10AE:		; Check that the sound is not FE or FF
	move.b	d0,d1	; If it is, we need to put it in $A01B83 as $7F or $80 respectively
	subi.b	#MusID_Pause,d1
	bcs.s	loc_10C0
	addi.b	#$7F,d1
	move.b	d1,zVar.StopMusic(a1)
	bra.s	loc_10C4
; ---------------------------------------------------------------------------

loc_10C0:
	move.b	d0,zVar.QueueToPlay(a1)

loc_10C4:
	moveq	#4-1,d1
				; FFE4 (Music_to_play_2) goes to 1B8C (zMusicToPlay),
-	move.b	1(a0,d1.w),d0	; FFE3 (unk_FFE3) goes to 1B8B, (unknown)
	beq.s	+		; FFE2 (SFX_to_play_2) goes to 1B8A (zSFXToPlay2),
	tst.b	zVar.SFXToPlay(a1,d1.w)	; FFE1 (SFX_to_play) goes to 1B89 (zSFXToPlay).
	bne.s	+
	clr.b	1(a0,d1.w)
	move.b	d0,zVar.SFXToPlay(a1,d1.w)
+
	dbf	d1,-
	rts
; End of function sndDriverInput

and remove it. We don't need it anymore because the Sonic 3 driver does this stuff on its own, in its own way.

Upgrading the SoundDriverLoad Routine

Okay, now we are finally ready to install the Sonic 3 sound driver itself. SoundDriverLoad is located at the end of the ROM in Sonic 2 instead of the beginning, but we have some artwork entangled with it as well. We will have to relocate it while we insert the new code.

Delete everything from SoundDriverLoad until the line "; end of 'ROM'"

In its place, paste the code inside this file:

Download.svg Download The Sonic 3 Sound Driver Load code
File: SoundDriverLoadCode.asm (54 kB) (info)
Note: Linux systems and some mac installs have a case sensitive filesystem  and that can cause build errors,
to fix, simply rename all non-sound effects to lowercase names.

Upgrading the Playback Routines

Now we have the code to load the new driver, time to add the new playback routines.

Upgrade Music Routine

First the PlayMusic routine, locate:

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
; If Music_to_play is clear, move d0 into Music_to_play,
; else move d0 into Music_to_play_2.
; sub_135E:
PlayMusic:
	tst.b	(Music_to_play).w
	bne.s	+
	move.b	d0,(Music_to_play).w
	rts
+
	move.b	d0,(Music_to_play_2).w
	rts
; End of function PlayMusic

and we will replace it with this code:

; ---------------------------------------------------------------------------
; Subroutine to	play a music track
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


PlayMusic:
		cmpi.w	#$FB,d0
		blt.s	++
		bhi.s	+
		move	#8,d0
		jmp	SetTempo
+		cmpi.w	#$FC,d0
		bne.s	+
		clr.w	d0
		jmp	SetTempo

+		stopZ80
		move.b	d0,($A01C0A).l
		startZ80
		rts
; End of function PlaySound

Upgrade Sound Routines

now find:

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
; play a sound if the source is onscreen
; sub_137C:
PlaySoundLocal:
	tst.b	render_flags(a0)
	bpl.s	+	; rts
	move.b	d0,(SFX_to_play).w
+
	rts
; End of function PlaySoundLocal

and replace it with:

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
; play a sound if the source is onscreen
; sub_137C:
PlaySoundLocal:
		tst.b	render_flags(A0)
		bpl.s	SkipPlaySound
		bra.s	PlaySound
; End of function PlaySoundLocal

now we will find:

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

; sub_1370
PlaySound:
	move.b	d0,(SFX_to_play).w
	rts
; End of function PlaySound


; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
; play a sound in alternating speakers (as in the ring collection sound)
; sub_1376:
PlaySoundStereo:
	move.b	d0,(SFX_to_play_2).w
	rts
; End of function PlaySoundStereo

and replace it with:

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

; sub_1370
PlaySound:
		stopZ80
		cmp.b	($A01C0B).l,d0
		beq.s	++
		tst.b	($A01C0B).l
		bne.s	+
		move.b	d0,($A01C0B).l
		startZ80
		rts

+		move.b	d0,($A01C0C).l

+		move.w	#0,($A11100).l

SkipPlaySound:
		rts
; End of function PlaySound


; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
; play a sound in alternating speakers (as in the ring collection sound)
; sub_1376:
PlaySoundStereo:
		bra.s	PlaySound
; End of function PlaySoundStereo

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
; change the music tempo

SetTempo:
		stopZ80
		move.b	D0,($A01C08).l
		startZ80
		rts

Upgrading Pause / Resume Routines

Now the playback routines are fixed and we have a routine to set the tempo the way the sneakers do, which we will elaberate later on, but we still have to update the pause / resume routines to the Sonic 3 equivilents.

Find:

; ---------------------------------------------------------------------------
; Subroutine to pause the game
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

; sub_1388:
PauseGame:
	nop
	tst.b	(Life_count).w	; do you have any lives left?
	beq.w	Unpause		; if not, branch
	tst.w	(Game_paused).w	; is game already paused?
	bne.s	+		; if yes, branch
	move.b	(Ctrl_1_Press).w,d0 ; is Start button pressed?
	or.b	(Ctrl_2_Press).w,d0 ; (either player)
	andi.b	#button_start_mask,d0
	beq.s	Pause_DoNothing	; if not, branch
+
	move.w	#1,(Game_paused).w	; freeze time
	move.b	#MusID_Pause,(Music_to_play).w	; pause music
; loc_13B2:
Pause_Loop:
	move.b	#$10,(Vint_routine).w
	bsr.w	WaitForVint
	tst.b	(Slow_motion_flag).w	; is slow-motion cheat on?
	beq.s	Pause_ChkStart		; if not, branch
	btst	#button_A,(Ctrl_1_Press).w	; is button A pressed?
	beq.s	Pause_ChkBC		; if not, branch
	move.b	#GameModeID_TitleScreen,(Game_Mode).w	; => TitleScreen
	nop
	bra.s	Pause_Resume
; ===========================================================================
; loc_13D4:
Pause_ChkBC:
	btst	#button_B,(Ctrl_1_Held).w ; is button B pressed?
	bne.s	Pause_SlowMo		; if yes, branch
	btst	#button_C,(Ctrl_1_Press).w ; is button C pressed?
	bne.s	Pause_SlowMo		; if yes, branch
; loc_13E4:
Pause_ChkStart:
	move.b	(Ctrl_1_Press).w,d0	; is Start button pressed?
	or.b	(Ctrl_2_Press).w,d0	; (either player)
	andi.b	#button_start_mask,d0
	beq.s	Pause_Loop	; if not, branch
; loc_13F2:
Pause_Resume:
	move.b	#MusID_Unpause,(Music_to_play).w
; loc_13F8:
Unpause:
	move.w	#0,(Game_paused).w
; return_13FE:
Pause_DoNothing:
	rts
; ===========================================================================
; loc_1400:
Pause_SlowMo:
	move.w	#1,(Game_paused).w
	move.b	#MusID_Unpause,(Music_to_play).w
	rts
; End of function PauseGame

and replace it with:

; ---------------------------------------------------------------------------
; Subroutine to pause the game
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

; sub_1388:
PauseGame:
		nop
		tst.b	(Life_count).w
		beq	Unpause
		tst.w	(Game_paused).w
		bne.s	+
		move.b	(Ctrl_1_Press).w,d0
		or.b	(Ctrl_2_Press).w,d0
		andi.b	#$80,d0
		beq	Pause_DoNothing
+		move.w	#1,(Game_paused).w
		stopZ80
		move.b	#1,($A01C10).l
		startZ80

Pause_Loop:
		move.b	#$10,(Vint_routine).w
		jsr	WaitForVint
		tst.b	(Slow_motion_flag).w
		beq.s	Pause_ChkStart
		btst	#button_A,(Ctrl_1_Press).w
		beq.s	Pause_ChkBC
		move.b	#GameModeID_TitleScreen,(Game_Mode).w ; Go To Title Screen
		nop
		bra.s	Pause_Resume

Pause_ChkBC:
		btst	#button_B,(Ctrl_1_Held).w
		bne.s	Pause_SlowMo
		btst	#button_C,(Ctrl_1_Press).w
		bne.s	Pause_SlowMo

Pause_ChkStart:
	move.b	(Ctrl_1_Press).w,d0	; is Start button pressed?
	or.b	(Ctrl_2_Press).w,d0	; (either player)
	andi.b	#button_start_mask,d0
	beq.s	Pause_Loop	; if not, branch

Pause_Resume:
		stopZ80
		move.b	#$80,($A01C10).l
		startZ80

Unpause:
		move.w	#0,(Game_paused).w

Pause_DoNothing:
		rts

Pause_SlowMo:
		move.w	#1,(Game_paused).w
		stopZ80
		move.b	#$80,($A01C10).l
		startZ80
		rts
; End of function PauseGame

now find:

; loc_541A:
SpecialStage_Unpause:
	move.b	#MusID_Unpause,(Music_to_play).w
	move.b	#8,(Vint_routine).w
	bra.w	WaitForVint

replace the line right after the label with:

		stopZ80
		move.b	#$80,($A01C10).l
		startZ80

Driver Data Files

Unpack this into the 'sound' folder and, optionally, remove the original files since we no longer need them anymore:

Download.svg Download The Sonic 3 Driver data files
File: s3driverdata.7z (131 kB) (info)

Fixing the Music and Sound Effects

Now we will open s2.constants.asm.

Music

Go to MusID__First and you will notice this:

; Music IDs
offset :=	zMasterPlaylist
ptrsize :=	1
idstart :=	$81
; $80 is reserved for silence, so if you make idstart $80 or less,
; you may need to insert a dummy zMusIDPtr in the $80 slot

MusID__First = idstart
MusID_2PResult =	id(zMusIDPtr_2PResult)	; 81
MusID_EHZ =		id(zMusIDPtr_EHZ)	; 82
MusID_MCZ_2P =		id(zMusIDPtr_MCZ_2P)	; 83
MusID_OOZ =		id(zMusIDPtr_OOZ)	; 84
MusID_MTZ =		id(zMusIDPtr_MTZ)	; 85
MusID_HTZ =		id(zMusIDPtr_HTZ)	; 86
MusID_ARZ =		id(zMusIDPtr_ARZ)	; 87
MusID_CNZ_2P =		id(zMusIDPtr_CNZ_2P)	; 88
MusID_CNZ =		id(zMusIDPtr_CNZ)	; 89
MusID_DEZ =		id(zMusIDPtr_DEZ)	; 8A
MusID_MCZ =		id(zMusIDPtr_MCZ)	; 8B
MusID_EHZ_2P =		id(zMusIDPtr_EHZ_2P)	; 8C
MusID_SCZ =		id(zMusIDPtr_SCZ)	; 8D
MusID_CPZ =		id(zMusIDPtr_CPZ)	; 8E
MusID_WFZ =		id(zMusIDPtr_WFZ)	; 8F
MusID_HPZ =		id(zMusIDPtr_HPZ)	; 90
MusID_Options =		id(zMusIDPtr_Options)	; 91
MusID_SpecStage =	id(zMusIDPtr_SpecStage)	; 92
MusID_Boss =		id(zMusIDPtr_Boss)	; 93
MusID_EndBoss =		id(zMusIDPtr_EndBoss)	; 94
MusID_Ending =		id(zMusIDPtr_Ending)	; 95
MusID_SuperSonic =	id(zMusIDPtr_SuperSonic); 96
MusID_Invincible =	id(zMusIDPtr_Invincible); 97
MusID_ExtraLife =	id(zMusIDPtr_ExtraLife)	; 98
MusID_Title =		id(zMusIDPtr_Title)	; 99
MusID_EndLevel =	id(zMusIDPtr_EndLevel)	; 9A
MusID_GameOver =	id(zMusIDPtr_GameOver)	; 9B
MusID_Continue =	id(zMusIDPtr_Continue)	; 9C
MusID_Emerald =		id(zMusIDPtr_Emerald)	; 9D
MusID_Credits =		id(zMusIDPtr_Credits)	; 9E
MusID_Countdown =	id(zMusIDPtr_Countdown)	; 9F
MusID__End =		id(zMusIDPtr__End)	; A0

That may be good if you were using the Sonic 2 driver, but obviously you are not, so we need to change it.

MusID__First = 1
MusID_AIZ1 =		1
MusID_AIZ2 =		2
MusID_HCZ1 =		3
MusID_HCZ2 =		4
MusID_MGZ1 =	5
MusID_MGZ2 =	6
MusID_CNZ1 =		7
MusID_CNZ2 =		8
MusID_FBZ1 =		9
MusID_FBZ2 =		$A
MusID_ICZ1 =		$B
MusID_ICZ2 =		$C
MusID_LBZ1 =		$D
MusID_LBZ2 =		$E
MusID_MHZ1 =	$F
MusID_MHZ2 =	$10
MusID_SZ1 =		$11
MusID_SZ2 =		$12
MusID_LRZ1 =		$13
MusID_LRZ2 =		$14
MusID_SSZ =		$15
MusID_DEZ1 =		$16
MusID_DEZ2 =		$17
MusID_MBSK =	$18
MusID_Boss =		$19
MusID_TDZ =		$1A
MusID_GSBonus =	$1B
MusID_SpecStage =	$1C
MusID_SMBonus =	$1D
MusID_GBMBonus =	$1E
MusID_KTE =		$1F
MusID_ALZ =		$20
MusID_BPZ =		$21
MusID_DPZ =		$22
MusID_CGZ =		$23
MusID_EMZ =		$24
MusID_Title =		$25
MusID_Credits =	$26
MusID_GameOver =	$27
MusID_Continue =	$28
MusID_EndLevel =	$29
MusID_ExtraLife =	$2A
MusID_Emerald =		$2B
MusID_Invincible =	$2C
MusID_2PVS =		$2D
MusID_MB =		$2E
MusID_Options =		$2F
MusID_EndBoss =		$30
MusID_Countdown =	$31
MusID_Ending =		$32

    ; for compatibility with Sonic 2
MusID_2PResult =	MusID_Continue
MusID_EHZ =		MusID_AIZ1
MusID_MCZ_2P =	MusID_MHZ2
MusID_OOZ =		MusID_DPZ
MusID_MTZ =		MusID_DEZ1
MusID_HTZ =		MusID_LRZ1
MusID_ARZ =		MusID_HCZ1
MusID_CNZ_2P =		MusID_CNZ2
MusID_CNZ =		MusID_CNZ1
MusID_DEZ =		MusID_DEZ2
MusID_MCZ =		MusID_EMZ
MusID_EHZ_2P =		MusID_AIZ2
MusID_SCZ =		MusID_FBZ1
MusID_CPZ =		MusID_HCZ2
MusID_WFZ =		MusID_FBZ2
MusID_HPZ =		MusID_LRZ1
MusID_SuperSonic =	MusID_Invincible
MusID__End =		$33

The original music IDs in the compatibility section can be set to whichever ones you want in the above (I wouldn't recommend editing the 2PResult one though)

Sound Effects

Okay, now we actually have the music working (well, sorta working, fades and music stops aren't working yet though and we will fix that very soon), so it is time to get those sound effects working as they should. We want to start with SndID__First. you may notice that this area looks like this:

; Sound IDs
offset :=	SoundIndex
ptrsize :=	2
idstart :=	$A0
; $80 is reserved for silence, so if you make idstart $80 or less,
; you may need to insert a dummy SndPtr in the $80 slot

SndID__First = idstart
SndID_Jump =		id(SndPtr_Jump)			; A0
SndID_Checkpoint =	id(SndPtr_Checkpoint)		; A1
SndID_SpikeSwitch =	id(SndPtr_SpikeSwitch)		; A2
SndID_Hurt =		id(SndPtr_Hurt)			; A3
SndID_Skidding =	id(SndPtr_Skidding)		; A4
SndID_BlockPush =	id(SndPtr_BlockPush)		; A5
SndID_HurtBySpikes =	id(SndPtr_HurtBySpikes)		; A6
SndID_Sparkle =		id(SndPtr_Sparkle)		; A7
SndID_Beep =		id(SndPtr_Beep)			; A8
SndID_Bwoop =		id(SndPtr_Bwoop)		; A9
SndID_Splash =		id(SndPtr_Splash)		; AA
SndID_Swish =		id(SndPtr_Swish)		; AB
SndID_BossHit =		id(SndPtr_BossHit)		; AC
SndID_InhalingBubble =	id(SndPtr_InhalingBubble)	; AD
SndID_ArrowFiring =	id(SndPtr_ArrowFiring)		; AE
SndID_LavaBall =	id(SndPtr_LavaBall)		; AE
SndID_Shield =		id(SndPtr_Shield)		; AF
SndID_LaserBeam =	id(SndPtr_LaserBeam)		; B0
SndID_Zap =		id(SndPtr_Zap)			; B1
SndID_Drown =		id(SndPtr_Drown)		; B2
SndID_FireBurn =	id(SndPtr_FireBurn)		; B3
SndID_Bumper =		id(SndPtr_Bumper)		; B4
SndID_Ring =		id(SndPtr_Ring)			; B5
SndID_RingRight =	id(SndPtr_RingRight)		; B5
SndID_SpikesMove =	id(SndPtr_SpikesMove)		; B6
SndID_Rumbling =	id(SndPtr_Rumbling)		; B7
SndID_Smash =		id(SndPtr_Smash)		; B9
SndID_DoorSlam =	id(SndPtr_DoorSlam)		; BB
SndID_SpindashRelease =	id(SndPtr_SpindashRelease)	; BC
SndID_Hammer =		id(SndPtr_Hammer)		; BD
SndID_Roll =		id(SndPtr_Roll)			; BE
SndID_ContinueJingle =	id(SndPtr_ContinueJingle)	; BF
SndID_CasinoBonus =	id(SndPtr_CasinoBonus)		; C0
SndID_Explosion =	id(SndPtr_Explosion)		; C1
SndID_WaterWarning =	id(SndPtr_WaterWarning)		; C2
SndID_EnterGiantRing =	id(SndPtr_EnterGiantRing)	; C3
SndID_BossExplosion =	id(SndPtr_BossExplosion)	; C4
SndID_TallyEnd =	id(SndPtr_TallyEnd)		; C5
SndID_RingSpill =	id(SndPtr_RingSpill)		; C6
SndID_Flamethrower =	id(SndPtr_Flamethrower)		; C8
SndID_Bonus =		id(SndPtr_Bonus)		; C9
SndID_SpecStageEntry =	id(SndPtr_SpecStageEntry)	; CA
SndID_SlowSmash =	id(SndPtr_SlowSmash)		; CB
SndID_Spring =		id(SndPtr_Spring)		; CC
SndID_Blip =		id(SndPtr_Blip)			; CD
SndID_RingLeft =	id(SndPtr_RingLeft)		; CE
SndID_Signpost =	id(SndPtr_Signpost)		; CF
SndID_CNZBossZap =	id(SndPtr_CNZBossZap)		; D0
SndID_Signpost2P =	id(SndPtr_Signpost2P)		; D3
SndID_OOZLidPop =	id(SndPtr_OOZLidPop)		; D4
SndID_SlidingSpike =	id(SndPtr_SlidingSpike)		; D5
SndID_CNZElevator =	id(SndPtr_CNZElevator)		; D6
SndID_PlatformKnock =	id(SndPtr_PlatformKnock)	; D7
SndID_BonusBumper =	id(SndPtr_BonusBumper)		; D8
SndID_LargeBumper =	id(SndPtr_LargeBumper)		; D9
SndID_Gloop =		id(SndPtr_Gloop)		; DA
SndID_PreArrowFiring =	id(SndPtr_PreArrowFiring)	; DB
SndID_Fire =		id(SndPtr_Fire)			; DC
SndID_ArrowStick =	id(SndPtr_ArrowStick)		; DD
SndID_Helicopter =	id(SndPtr_Helicopter)		; DE
SndID_SuperTransform =	id(SndPtr_SuperTransform)	; DF
SndID_SpindashRev =	id(SndPtr_SpindashRev)		; E0
SndID_Rumbling2 =	id(SndPtr_Rumbling2)		; E1
SndID_CNZLaunch =	id(SndPtr_CNZLaunch)		; E2
SndID_Flipper =		id(SndPtr_Flipper)		; E3
SndID_HTZLiftClick =	id(SndPtr_HTZLiftClick)		; E4
SndID_Leaves =		id(SndPtr_Leaves)		; E5
SndID_MegaMackDrop =	id(SndPtr_MegaMackDrop)		; E6
SndID_DrawbridgeMove =	id(SndPtr_DrawbridgeMove)	; E7
SndID_QuickDoorSlam =	id(SndPtr_QuickDoorSlam)	; E8
SndID_DrawbridgeDown =	id(SndPtr_DrawbridgeDown)	; E9
SndID_LaserBurst =	id(SndPtr_LaserBurst)		; EA
SndID_Scatter =		id(SndPtr_Scatter)		; EB
SndID_LaserFloor =	id(SndPtr_LaserFloor)		; EB
SndID_Teleport =	id(SndPtr_Teleport)		; EC
SndID_Error =		id(SndPtr_Error)		; ED
SndID_MechaSonicBuzz =	id(SndPtr_MechaSonicBuzz)	; EE
SndID_LargeLaser =	id(SndPtr_LargeLaser)		; EF
SndID_OilSlide =	id(SndPtr_OilSlide)		; F0
SndID__End =		id(SndPtr__End)			; F1
    if MOMPASS == 2
	if SndID__End > MusID_StopSFX
		fatal "You have too many SndPtrs. SndID__End ($\{SndID__End}) can't exceed MusID_StopSFX ($\{MusID_StopSFX})."
	endif
    endif

Yikes! that last section about IDs really has to go! But on another note, this code seems best for the Sonic 2 driver, it needs fixing. the fixed version is below:

SndID__First = $33
SndID_RingRight =	$33
SndID_RingLeft =	$34
SndID_Hurt =		$35
SndID_Skidding =	$36
SndID_HurtBySpikes =	$37
SndID_InhalingBubble =	$38
SndID_Splash =		$39
SndID_Shield =		$3A
SndID_Drown =		$3B
SndID_Roll =		$3C
SndID_Explosion =	$3D
SndID_ShieldFire =	$3E
SndID_ShieldWater =	$3F
SndID_UnkSpark =	$40
SndID_ShieldMagnet =	$41
SndID_ShieldInstant =	$42
SndID_ShieldFAction =	$43
SndID_ShieldWAction =	$44
SndID_ShieldMAction =	$45
SndID_SSMonitor =	$46
SndID_Unk1 =		$47
SndID_RhinoCharge =	$48
SndID_PunchVehic =	$49
SndID_TailsCatch =	$4A
SndID_RockAppear =	$4B
SndID_KTEDrop =		$4C
SndID_BotShoot =	$4D
SndID_LargeLaser =	$4E
SndID_FireBurn =	$4F
SndID_MechLBZDoorSlam =	$50
SndID_BotThrow =	$51
SndID_SpikeSwitch =	$52
SndID_TeleportStart =	$53
SndID_LargeLaser2 =	$54
SndID_HTZLiftClick =	$55
SndID_UnkDrop =		$56
SndID_BigSplash =	$57
SndID_DoorSlam =	$58
SndID_Smash =		$59
SndID_S3DLauncher =	$5A
SndID_SwitchButton =	$5B
SndID_MetMalfunction =	$5C
SndID_KTEThud =		$5D
SndID_LaserBeam =	$5E
SndID_Hammer =		$5F
SndID_MGZBossWhirr =	$60
SndID_MechCrash =	$61
SndID_Jump =		$62
SndID_Checkpoint =	$63
SndID_SpikesMove =	$64
SndID_SSSphere =	$65
SndID_SSComplete =	$66
SndID_PreArrowFiring =	$67
SndID_Unlock =		$68
SndID_BlockPush =	$69
SndID_SpecStageExit =	$6A
SndID_S1SSSpecial =	$6B
SndID_Splash2 =		$6C
SndID_MObjMove =	$6D
SndID_BossHit =		$6E
SndID_Rumbling =	$6F
SndID_LavaBall =	$70
SndID_ShieldAgain =	$71
SndID_AntiGravTube =	$72
SndID_TeleportEnd =	$73
SndID_Repel	 =	$74
SndID_PlatformRise =	$75
SndID_Trapdoor =	$76
SndID_BalloonPop =	$77
SndID_S3DZapper =	$78
SndID_Zap =		$79
SndID_Unk2 =		$7A
SndID_Bounce =		$7B
SndID_ArrowFiring =	$7C
SndID_Unk3 =		$7D
SndID_Unk4 =		$7E
SndID_Flamethrower2 =	$7E
SndID_IZIceSpikeball =	$80
SndID_LBZCannon =	$81
SndID_Unk5 =		$82
SndID_KTEBlowBridge =	$83
SndID_Unk6 =		$84
SndID_Unk7 =		$85
SndID_LBZAlarm =	$86
SndID_ShroomBounce =	$87
SndID_MHZHandlePull =	$88
SndID_Beep =		$89
SndID_GhostFlee =	$8A
SndID_Chop =		$8B
SndID_BotDash =		$8C
SndID_Unk8 =		$8D
SndID_Unk9 =		$8E
SndID_SZStoneDoor =	$8F
SndID_SZDoorTimer =	$90
SndID_SZDoorClose =	$91
SndID_GhostCome =	$92
SndID_SZBossIllusion =	$93
SndID_LRZPlatformBelt =	$94
SndID_LRZMBArm =	$95
SndID_CrushingBlk =	$96
SndID_Unk10 =		$97
SndID_Unk20 =		$98
SndID_Unk11 =		$99
SndID_SpringPltfrm =		$9A
SndID_GolemBossWalk =		$9B
SndID_Sparkle =		$9C
SndID_SMLaser =		$9D
SndID_Unk12 =		$9E
SndID_Teleport2 =		$9F
SndID_SSZEggRoboFly	 =	$A0
SndID_Unk13 =		$A1
SndID_Unk14 =		$A2
SndID_CNZElevator =	$A3
SndID_Unk15 =		$A4
SndID_Unk16 =		$A5
SndID_Unk17 =		$A6
SndID_Ready =		$A7
SndID_MechaSonicBuzz =	$A8
SndID_WaterWarning =	$A9
SndID_Bumper =		$AA
SndID_SpindashRev =	$AB
SndID_ContinueJingle =	$AC
SndID_Go =		$AD
SndID_Catapult =	$AE
SndID_SpecStageEntry =	$AF
SndID_TallyEnd =	$B0
SndID_Spring =		$B1
SndID_Error =		$B2
SndID_EnterGiantRing =	$B3
SndID_BossExpOld =	$B4
SndID_SpecStageGlass =	$B5
SndID_SpindashRelease =	$B6
SndID_CasinoBonus =	$B7
SndID_Sparkle2 =	$B8
SndID_RingSpill =	$B9
SndID_TailsFly =	$BA
SndID_TailsExhaust =	$BB
SndID_Unk18 =		$BC
SndID_FBFlyBy 	=	$BD
SndID_EggmobileMHZ =	$BE
SndID_MBHCZSwirl =	$BF
SndID_Propeller2 =	$C0
SndID_Propeller =	$C1
SndID_Flamethrower =	$C2
SndID_OrbitOrb =	$C3
SndID_MBDEZAngry =	$C4
SndID_Unk19 =		$C5
SndID_Levitate =		$C6
SndID_CNZCannon =		$C7
SndID_OilSlide =	$C8
SndID_MGZMace =		$C9
SndID_RaceTrackDEZ =	$CA
SndID_Rumbling2 =	$CB
SndID_Crumbling =	$CC
SndID_DeathEggFly =	$CD
SndID_Unk21 =		$CE
SndID_Unk22 =		$CF
SndID_MPltfrmRise =	$D0
SndID_Unk23 =		$D1
SndID_Chain =		$D2
SndID_Unk24 =		$D3
SndID_KTEBlower =	$D4
SndID_Lavafall =	$D5
SndID_Unk25 =		$D6
SndID_Chain2 =		$D7
SndID_Unk26 =		$D8
SndID_DEZTube =		$D9
SndID_Unk27 =		$DA
SndID_Unk28 =		$DB
Snd_Open1 =		$DC
Snd_Open2 =		$DD
Snd_Open3 =		$DE
Snd_Open4 =		$DF

;compatibility sfx
SndID_Ring =		SndID_RingRight
SndID_Teleport =	SndID_TeleportEnd
SndID_BossExplosion =	SndID_Explosion ;for original sound, use SndID_BossExpOld
SndID_Bwoop =		SndID_Lavafall
SndID_Swish =		SndID_Unk28
SndID_Blip =		SndID_SwitchButton
SndID_SlowSmash =	SndID_Smash
SndID_Signpost =	SndID_Sparkle2
SndID_Bonus =		SndID_BotDash
SndID_CNZBossZap =	SndID_S3DZapper
SndID_Signpost2P =	SndID_Sparkle2
SndID_OOZLidPop =	SndID_ArrowFiring
SndID_SlidingSpike =	SndID_SSZEggRoboFly
SndID_PlatformKnock =	SndID_Chop
SndID_BonusBumper =	SndID_Bounce
SndID_LargeBumper =	SndID_Catapult
SndID_Gloop =		SndID_Lavafall
SndID_Fire =		SndID_FireBurn
SndID_ArrowStick =	SndID_KTEDrop
SndID_Helicopter =	SndID_TailsFly
SndID_SuperTransform =	SndID_Teleport2
SndID_CNZLaunch =	SndID_KTEBlowBridge
SndID_Flipper =		SndID_Catapult
SndID_Leaves =		SndID_Unk28
SndID_MegaMackDrop =	SndID_Unk28
SndID_DrawbridgeMove =	SndID_Trapdoor
SndID_QuickDoorSlam =	SndID_DoorSlam
SndID_DrawbridgeDown =	SndID_Trapdoor
SndID_LaserBurst =	SndID_LargeLaser
SndID_LaserFloor =	SndID_LargeLaser2
SndID_Scatter =		SndID_Unk14
SndID__End =		$E0

Fixing the special sounds

Any time you update the sound driver, you need to change these sounds:

; Special sound IDs

MusID_StopSFX =		$78+$80			; F8
MusID_FadeOut =		$79+$80			; F9
SndID_SegaSound =	$7A+$80			; FA
MusID_SpeedUp =		$7B+$80			; FB
MusID_SlowDown =	$7C+$80			; FC
MusID_Stop =		$7D+$80			; FD
MusID_Pause =		$7E+$80			; FE
MusID_Unpause =		$7F+$80			; FF

First of all, speed up and slow down are no longer sounds, they are called by a completely different routine, but new equates for those are still useful. Second, pause and unpause are no longer sounds but are directly handled by the PauseGame routine that we upgraded above. No equates are necessary for those two. StopSFX is not used in the Sonic 3 driver as far as I know, so we will treat it as a compatibility ID. The resulting lists will look like THIS:

; Special sound IDs

MusID_FadeOut =		$E1
MusID_Stop =		$E0
SndID_SegaSound =	$FF

;these are here for compatibility
MusID_StopSFX =		MusID_Stop

;Tempo IDs
Tempo_SpeedUp =		8
Tempo_SlowDown =	0

Fixing the Sneakers

I bet you expected that the sneakers would be fixed with the previous section, but no, Sonic 3 uses a different routine for the sneaker speed up / slow down. First, we will go to super_shoes_Tails and, beyond the +, we'll find this:

	move.w	#MusID_SpeedUp,d0
	jmp	(PlayMusic).l	; Speed up tempo

That will not work the way we want it to. It will actually cause an error during assembly of the ROM, so we need to fix it:

	move.w	#Tempo_SpeedUp,d0
	jmp	(SetTempo).l	; Speed up tempo

The music now speeds up, but we need it to slow down when the sneakers wear off, so find:

; loc_1A14A:
Obj01_RmvSpeed:
	bclr	#2,status_secondary(a0)
	move.w	#MusID_SlowDown,d0	; Slow down tempo
	jmp	(PlayMusic).l

There are 2 lines that need editing here, just as before.

; loc_1A14A:
Obj01_RmvSpeed:
	bclr	#2,status_secondary(a0)
	move.w	#Tempo_SlowDown,d0	; Slow down tempo
	jmp	(SetTempo).l

This will fix it for Sonic, but for Tails, do the exact same thing to Obj02_ChkShoes. Now the sneakers should be working as intended.

Optional: Apply New Sounds to Existing Objects

(coming soon)

Optional: Fix the 2P VS Screen

You will probably notice that the 2 player mode level select is still playing the same music as the options screen, but sonic 3 has its own 2 player mode music. Here we will fix that. locate this code:

	move.b	#MusID_Options,d0
	bsr.w	JmpTo_PlayMusic
	move.w	#$707,(Demo_Time_left).w
	clr.w	(Two_player_mode).w
	clr.l	(Camera_X_pos).w
	clr.l	(Camera_Y_pos).w
	move.b	#$16,(Vint_routine).w
	bsr.w	WaitForVint
	move.w	(VDP_Reg1_val).w,d0
	ori.b	#$40,d0
	move.w	d0,(VDP_control_port).l
	bsr.w	Pal_FadeFromBlack

;loc_8DA8:
LevelSelect2P_Main:

and change the music id to MusID_2PVS.
the result should be:

	move.b	#MusID_2PVS,d0
	bsr.w	JmpTo_PlayMusic
	move.w	#$707,(Demo_Time_left).w
	clr.w	(Two_player_mode).w
	clr.l	(Camera_X_pos).w
	clr.l	(Camera_Y_pos).w
	move.b	#$16,(Vint_routine).w
	bsr.w	WaitForVint
	move.w	(VDP_Reg1_val).w,d0
	ori.b	#$40,d0
	move.w	d0,(VDP_control_port).l
	bsr.w	Pal_FadeFromBlack

;loc_8DA8:
LevelSelect2P_Main:

Optional: Fix the Sound Test

Okay, I assume that you would want the sound test working too, so I added a section on that. First, we want to go to OptionScreen_Choices. Here is what we have:

OptionScreen_Choices:
	dc.l (3-1)<<24|(Player_option&$FFFFFF)
	dc.l (2-1)<<24|(Two_player_items&$FFFFFF)
	dc.l ($80-1)<<24|(Sound_test_sound&$FFFFFF)

change that last line to:

OptionScreen_Choices:
	dc.l ($FF)<<24|(Sound_test_sound&$FFFFFF)

now we have a full range, but it is not fixed yet, so we will locate:

	move.w	d2,(a1)
	cmpi.b	#2,(Options_menu_box).w
	bne.s	+	; rts
	andi.w	#button_B_mask|button_C_mask,d0
	beq.s	+	; rts
	move.w	(Sound_test_sound).w,d0
	addi.w	#$80,d0
	bsr.w	JmpTo_PlayMusic
	lea	(level_select_cheat).l,a0
	lea	(continues_cheat).l,a2
	lea	(Level_select_flag).w,a1
	moveq	#0,d2	; flag to tell the routine to enable the continues cheat
	bsr.w	CheckCheats

+

see that addi.w #$80,d0 line? It needs to go. the result will be:

	move.w	d2,(a1)
	cmpi.b	#2,(Options_menu_box).w
	bne.s	+	; rts
	andi.w	#button_B_mask|button_C_mask,d0
	beq.s	+	; rts
	move.w	(Sound_test_sound).w,d0
	bsr.w	JmpTo_PlayMusic
	lea	(level_select_cheat).l,a0
	lea	(continues_cheat).l,a2
	lea	(Level_select_flag).w,a1
	moveq	#0,d2	; flag to tell the routine to enable the continues cheat
	bsr.w	CheckCheats

+

okay, that fixes the options screen, but not the level select. We will do that next. go to LevSelControls_CheckLR. Below I have shown the code:

; loc_9522:
LevSelControls_CheckLR:
	cmpi.w	#$15,(Level_select_zone).w	; are we in the sound test?
	bne.s	LevSelControls_SwitchSide	; no
	move.w	(Sound_test_sound).w,d0
	move.b	(Ctrl_1_Press).w,d1
	btst	#button_left,d1
	beq.s	+
	subq.b	#1,d0
	bcc.s	+
	moveq	#$7F,d0

+
	btst	#button_right,d1
	beq.s	+
	addq.b	#1,d0
	cmpi.w	#$80,d0
	blo.s	+
	moveq	#0,d0

+
	btst	#button_A,d1
	beq.s	+
	addi.b	#$10,d0
	andi.b	#$7F,d0

+
	move.w	d0,(Sound_test_sound).w
	andi.w	#button_B_mask|button_C_mask,d1
	beq.s	+	; rts
	move.w	(Sound_test_sound).w,d0
	addi.w	#$80,d0
	bsr.w	JmpTo_PlayMusic
	lea	(debug_cheat).l,a0
	lea	(super_sonic_cheat).l,a2
	lea	(Debug_options_flag).w,a1	
	moveq	#1,d2	; flag to tell the routine to enable the Super Sonic cheat
	bsr.w	CheckCheats

+
	rts

First of all, it checks when you press left to see if the sound test value is -1, since the sound driver uses the whole byte for the sound ID, we don't want it to rest to 127 like it usually does. It is very likely clear what you need to change there. Next it checks when you press right if the value is 128, at that point we do not want it resetting to 0 for the same reason above, then there is that andi.b on the sound test value of 127 that caps the value at $7F, that needs to go. Also just before playing the sound, 128 is added to the sound test value, which we don't want, just in case you haven't figured it out, I outlined the changes below:

; loc_9522:
LevSelControls_CheckLR:
	cmpi.w	#$15,(Level_select_zone).w	; are we in the sound test?
	bne.s	LevSelControls_SwitchSide	; no
	move.w	(Sound_test_sound).w,d0
	move.b	(Ctrl_1_Press).w,d1
	btst	#button_left,d1
	beq.s	+
	subq.b	#1,d0
	;bcc.s	+                      ;<-- remove this line
	;moveq	#$7F,d0           ;<-- remove this line

+
	btst	#button_right,d1
	beq.s	+
	addq.b	#1,d0
	;cmpi.w	#$80,d0        ;<-- remove this line
	;blo.s	+                   ;<-- remove this line
	;moveq	#0,d0            ;<-- remove this line

+
	btst	#button_A,d1
	beq.s	+
	addi.b	#$10,d0
	;andi.b	#$7F,d0       ;<-- remove this line

+
	move.w	d0,(Sound_test_sound).w
	andi.w	#button_B_mask|button_C_mask,d1
	beq.s	+	; rts
	move.w	(Sound_test_sound).w,d0
	;addi.w	#$80,d0         ;<-- remove this line
	bsr.w	JmpTo_PlayMusic
	lea	(debug_cheat).l,a0
	lea	(super_sonic_cheat).l,a2
	lea	(Debug_options_flag).w,a1	; Also S1_hidden_credits_flag
	moveq	#1,d2	; flag to tell the routine to enable the Super Sonic cheat
	bsr.w	CheckCheats

+
	rts

Note from WBilgini

Alright, there is a chance when you compile, you'll a error about this line:

; share these symbols externally (WARNING: don't rename, move or remove these labels!) shared word_728C_user,Obj5F_MapUnc_7240,off_3A294,MapRUnc_Sonic,movewZ80CompSize

Remove the movewZ80CompSize and you'll be good.

Also, I noticed a bug. In the title screen, after you choose a option, for a second the sound will go earrape. I don't know how to fix this though. If you do, please edit this page to fix it!

SCHG How-To Guide: Sonic the Hedgehog 2 (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix Super Sonic Bugs | Use Correct Height When Roll Jumping | Fix Jump Height Bug When Exiting Water | Fix Screen Boundary Spin Dash Bug | Correct Drowning Bugs | Fix Camera Y Position for Tails | Fix Tails Subanimation Error | Fix Tails' Respawn Speeds | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix Rexon Crash | Fix Monitor Collision Bug | Fix EHZ Deformation Bug | Correct CPZ Boss Attack Behavior | Fix Bug in ARZ Boss Arrow's Platform Behavior | Fix ARZ Boss Walking on Air Glitch | Fix ARZ Boss Sprite Behavior | Fix Multiple CNZ Boss Bugs | Fix HTZ Background Scrolling Mountains | Fix OOZ Launcher Speed Up Glitch | Fix DEZ Giant Mech Collision Glitch | Fix Boss Deconstruction Behavior | Fix Speed Bugs | Fix 14 Continues Cheat | Fix Debug Mode Crash | Fix 99+ Lives | Fix Sonic 2's Sega Screen
Design Choices
Remove the Air Speed Cap | Disable Floor Collision While Dying | Modify Super Sonic Transformation Methods & Behavior | Enable/Disable Tails in Certain Levels | Collide with Water After Being Hurt | Retain Rings When Returning at a Star Post | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Insert LZ Water Ripple Effect | Restore Lost CPZ Boss Feature | Prevent SCZ Tornado Spin Dash Death | Improve ObjectMove Subroutines | Port S3K Rings Manager | Port S3K Object Manager | Port S3K Priority Manager | Edit Level Order with ASM‎ | Alter Ring Requirements in Special Stages | Make Special Stage Characters Use Normal DPLCs | Speed Up Ring Loss Process | Change spike behaviour in Sonic 2
Adding Features
Create Insta-kill and High Jump Monitors | Create Clone and Special Stage Monitors | Port Knuckles
Sound Features
Expand Music Index to Start at $00 | Port Sonic 1 Sound Driver | Port Sonic 2 Clone Driver | Port Sonic 3 Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Expand the Music Index to Start at $00 (Sonic 2 Clone Driver Version) | Play Different Songs Per Act
Extending the Game
Extend the Level Index Past $10 | Extend the Level Select | Extend Water Tables | Add Extra Characters | Free Up 2 Universal SSTs

|Port Sonic 3's Sound Driver to Sonic 2]]