Actions

SCHG How-to

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

From Sonic Retro

(What comes next)
(Replacing 68k driver with new Z80 driver)
Line 4,606: Line 4,606:
  
 
==Replacing 68k driver with new Z80 driver==
 
==Replacing 68k driver with new Z80 driver==
We need the sound driver itself if we are going to have any sound and music, so we locate:
+
We need the sound driver itself if we are going to have any sound and music, so we open s1.sounddriver.asm and delete all of this:
 
<syntaxhighlight lang="asm">
 
<syntaxhighlight lang="asm">
align 2
+
; ---------------------------------------------------------------------------
 
+
; Go_SoundTypes:
Go_SoundTypes: dc.l SoundTypes ; XREF: Sound_Play
+
Go_SoundPriorities: dc.l SoundPriorities
Go_SoundD0: dc.l SoundD0Index ; XREF: Sound_D0toDF
+
; Go_SoundD0:
Go_MusicIndex: dc.l MusicIndex ; XREF: Sound_81to9F
+
Go_SpecSoundIndex: dc.l SpecSoundIndex
Go_SoundIndex: dc.l SoundIndex ; XREF: Sound_A0toCF
+
Go_MusicIndex: dc.l MusicIndex
off_719A0: dc.l byte_71A94 ; XREF: Sound_81to9F
+
Go_SoundIndex: dc.l SoundIndex
Go_PSGIndex: dc.l PSG_Index ; XREF: sub_72926
+
; off_719A0:
 +
Go_SpeedUpIndex: dc.l SpeedUpIndex
 +
Go_PSGIndex: dc.l PSG_Index
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 
; PSG instruments used in music
 
; PSG instruments used in music
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
PSG_Index: dc.l PSG1, PSG2, PSG3
+
PSG_Index:
 +
dc.l PSG1, PSG2, PSG3
 
dc.l PSG4, PSG5, PSG6
 
dc.l PSG4, PSG5, PSG6
 
dc.l PSG7, PSG8, PSG9
 
dc.l PSG7, PSG8, PSG9
PSG1: binclude sound\psg1.bin
+
PSG1: binclude "sound/psg/psg1.bin"
PSG2: binclude sound\psg2.bin
+
PSG2: binclude "sound/psg/psg2.bin"
PSG3: binclude sound\psg3.bin
+
PSG3: binclude "sound/psg/psg3.bin"
PSG4: binclude sound\psg4.bin
+
PSG4: binclude "sound/psg/psg4.bin"
PSG6: binclude sound\psg6.bin
+
PSG6: binclude "sound/psg/psg6.bin"
PSG5: binclude sound\psg5.bin
+
PSG5: binclude "sound/psg/psg5.bin"
PSG7: binclude sound\psg7.bin
+
PSG7: binclude "sound/psg/psg7.bin"
PSG8: binclude sound\psg8.bin
+
PSG8: binclude "sound/psg/psg8.bin"
PSG9: binclude sound\psg9.bin
+
PSG9: binclude "sound/psg/psg9.bin"
 +
; ---------------------------------------------------------------------------
 +
; New tempos for songs during speed shoes
 +
; ---------------------------------------------------------------------------
 +
; DANGER! several songs will use the first few bytes of MusicIndex as their main
 +
; tempos while speed shoes are active. If you don't want that, you should add
 +
; their "correct" sped-up main tempos to the list.
 +
; byte_71A94:
 +
SpeedUpIndex:
 +
dc.b 7 ; GHZ
 +
dc.b $72 ; LZ
 +
dc.b $73 ; MZ
 +
dc.b $26 ; SLZ
 +
dc.b $15 ; SYZ
 +
dc.b 8 ; SBZ
 +
dc.b $FF ; Invincibility
 +
dc.b 5 ; Extra Life
 +
;dc.b ? ; Special Stage
 +
;dc.b ? ; Title Screen
 +
;dc.b ? ; Ending
 +
;dc.b ? ; Boss
 +
;dc.b ? ; FZ
 +
;dc.b ? ; Sonic Got Through
 +
;dc.b ? ; Game Over
 +
;dc.b ? ; Continue Screen
 +
;dc.b ? ; Credits
 +
;dc.b ? ; Drowning
 +
;dc.b ? ; Get Emerald
  
byte_71A94: dc.b 7, $72, $73, $26, $15, 8, $FF, 5
 
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 
; Music Pointers
 
; Music Pointers
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
MusicIndex: dc.l Music81, Music82
+
MusicIndex:
dc.l Music83, Music84
+
ptr_mus81: dc.l Music81
dc.l Music85, Music86
+
ptr_mus82: dc.l Music82
dc.l Music87, Music88
+
ptr_mus83: dc.l Music83
dc.l Music89, Music8A
+
ptr_mus84: dc.l Music84
dc.l Music8B, Music8C
+
ptr_mus85: dc.l Music85
dc.l Music8D, Music8E
+
ptr_mus86: dc.l Music86
dc.l Music8F, Music90
+
ptr_mus87: dc.l Music87
dc.l Music91, Music92
+
ptr_mus88: dc.l Music88
dc.l Music93
+
ptr_mus89: dc.l Music89
 +
ptr_mus8A: dc.l Music8A
 +
ptr_mus8B: dc.l Music8B
 +
ptr_mus8C: dc.l Music8C
 +
ptr_mus8D: dc.l Music8D
 +
ptr_mus8E: dc.l Music8E
 +
ptr_mus8F: dc.l Music8F
 +
ptr_mus90: dc.l Music90
 +
ptr_mus91: dc.l Music91
 +
ptr_mus92: dc.l Music92
 +
ptr_mus93: dc.l Music93
 +
ptr_musend
 +
; ---------------------------------------------------------------------------
 +
; Priority of sound. New music or SFX must have a priority higher than or equal
 +
; to what is stored in v_sndprio or it won't play. If bit 7 of new priority is
 +
; set ($80 and up), the new music or SFX will not set its priority -- meaning
 +
; any music or SFX can override it (as long as it can override whatever was
 +
; playing before). Usually, SFX will only override SFX, special SFX ($D0-$DF)
 +
; will only override special SFX and music will only override music.
 +
; ---------------------------------------------------------------------------
 +
; SoundTypes:
 +
SoundPriorities:
 +
dc.b    $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90 ; $81
 +
dc.b $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90 ; $90
 +
dc.b $80,$70,$70,$70,$70,$70,$70,$70,$70,$70,$68,$70,$70,$70,$60,$70 ; $A0
 +
dc.b $70,$60,$70,$60,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$7F ; $B0
 +
dc.b $60,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70 ; $C0
 +
dc.b $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80 ; $D0
 +
dc.b $90,$90,$90,$90,$90                                            ; $E0
 +
 
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
; Type of sound being played ($90 = music; $70 = normal sound effect)
+
; Subroutine to update music more than once per frame
 +
; (Called by horizontal & vert. interrupts)
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
SoundTypes: dc.b $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90
 
dc.b $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $90, $80
 
dc.b $70, $70, $70, $70, $70, $70, $70, $70, $70, $68, $70, $70, $70, $60, $70, $70
 
dc.b $60, $70, $60, $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $7F, $60
 
dc.b $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $70, $80
 
dc.b $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $90
 
dc.b $90, $90, $90, $90
 
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 
+
; sub_71B4C:
sub_71B4C: ; XREF: loc_B10; PalToCRAM
+
UpdateMusic:
move.w #$100,($A11100).l ; stop the Z80
+
stopZ80
 
nop
 
nop
 
nop
 
nop
 
nop
 
nop
 +
; loc_71B5A:
 +
.updateloop:
 +
btst #0,(z80_bus_request).l ; Is the z80 busy?
 +
bne.s .updateloop ; If so, wait
  
loc_71B5A:
+
btst #7,(z80_dac_status).l ; Is DAC accepting new samples?
btst #0,($A11100).l
+
beq.s .driverinput ; Branch if yes
bne.s loc_71B5A
+
startZ80
 
 
btst #7,($A01FFD).l
 
beq.s loc_71B82
 
move.w #0,($A11100).l ; start the Z80
 
 
nop
 
nop
 
nop
 
nop
Line 4,678: Line 4,730:
 
nop
 
nop
 
nop
 
nop
bra.s sub_71B4C
+
bra.s UpdateMusic
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_71B82:
loc_71B82:
+
.driverinput:
lea ($FFF000).l,a6
+
lea (v_snddriver_ram&$FFFFFF).l,a6
clr.b $E(a6)
+
clr.b f_voice_selector(a6)
tst.b 3(a6) ; is music paused?
+
tst.b f_stopmusic(a6) ; is music paused?
bne.w loc_71E50 ; if yes, branch
+
bne.w PauseMusic ; if yes, branch
subq.b #1,1(a6)
+
subq.b #1,v_main_tempo_timeout(a6) ; Has main tempo timer expired?
bne.s loc_71B9E
+
bne.s .skipdelay
jsr sub_7260C(pc)
+
jsr TempoWait(pc)
 
+
; loc_71B9E:
loc_71B9E:
+
.skipdelay:
move.b 4(a6),d0
+
move.b v_fadeout_counter(a6),d0
beq.s loc_71BA8
+
beq.s .skipfadeout
jsr sub_72504(pc)
+
jsr DoFadeOut(pc)
 
+
; loc_71BA8:
loc_71BA8:
+
.skipfadeout:
tst.b $24(a6)
+
tst.b f_fadein_flag(a6)
beq.s loc_71BB2
+
beq.s .skipfadein
jsr sub_7267C(pc)
+
jsr DoFadeIn(pc)
 
+
; loc_71BB2:
loc_71BB2:
+
.skipfadein:
tst.w $A(a6) ; is music or sound being played?
+
; DANGER! The following line only checks v_playsnd1 and v_playsnd2, breaking v_playnull.
beq.s loc_71BBC ; if not, branch
+
tst.w v_playsnd1(a6) ; is a music or sound queued for played?
 +
beq.s .nosndinput ; if not, branch
 
jsr Sound_Play(pc)
 
jsr Sound_Play(pc)
 
+
; loc_71BBC:
loc_71BBC:
+
.nosndinput:
cmpi.b #$80,9(a6)
+
cmpi.b #$80,v_playsnd0(a6) ; is song queue set for silence (empty)?
beq.s loc_71BC8
+
beq.s .nonewsound ; If yes, branch
 
jsr Sound_ChkValue(pc)
 
jsr Sound_ChkValue(pc)
 +
; loc_71BC8:
 +
.nonewsound:
 +
lea v_music_dac_track(a6),a5
 +
tst.b zTrackPlaybackControl(a5) ; Is DAC track playing?
 +
bpl.s .dacdone ; Branch if not
 +
jsr UpdateDAC(pc)
 +
; loc_71BD4:
 +
.dacdone:
 +
clr.b f_updating_dac(a6)
 +
moveq #((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7 ; 6 FM tracks
 +
; loc_71BDA:
 +
.bgmfmloop:
 +
adda.w #zTrackSz,a5
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .bgmfmnext ; Branch if not
 +
jsr FMUpdateTrack(pc)
 +
; loc_71BE6:
 +
.bgmfmnext:
 +
dbf d7,.bgmfmloop
  
loc_71BC8:
+
moveq #((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7 ; 3 PSG tracks
lea $40(a6),a5
+
; loc_71BEC:
tst.b (a5)
+
.bgmpsgloop:
bpl.s loc_71BD4
+
adda.w #zTrackSz,a5
jsr sub_71C4E(pc)
+
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .bgmpsgnext ; Branch if not
 +
jsr PSGUpdateTrack(pc)
 +
; loc_71BF8:
 +
.bgmpsgnext:
 +
dbf d7,.bgmpsgloop
  
loc_71BD4:
+
move.b #$80,f_voice_selector(a6) ; Now at SFX tracks
clr.b 8(a6)
+
moveq #((v_sfx_fm_tracks_end-v_sfx_fm_tracks)/zTrackSz)-1,d7 ; 3 FM tracks (SFX)
moveq #5,d7
+
; loc_71C04:
 +
.sfxfmloop:
 +
adda.w #zTrackSz,a5
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .sfxfmnext ; Branch if not
 +
jsr FMUpdateTrack(pc)
 +
; loc_71C10:
 +
.sfxfmnext:
 +
dbf d7,.sfxfmloop
  
loc_71BDA:
+
moveq #((v_sfx_psg_tracks_end-v_sfx_psg_tracks)/zTrackSz)-1,d7 ; 3 PSG tracks (SFX)
adda.w #$30,a5
+
; loc_71C16:
tst.b (a5)
+
.sfxpsgloop:
bpl.s loc_71BE6
+
adda.w #zTrackSz,a5
jsr sub_71CCA(pc)
+
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .sfxpsgnext ; Branch of not
 +
jsr PSGUpdateTrack(pc)
 +
; loc_71C22:
 +
.sfxpsgnext:
 +
dbf d7,.sfxpsgloop
 +
 +
move.b #$40,f_voice_selector(a6) ; Now at special SFX tracks
 +
adda.w #zTrackSz,a5
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .specfmdone ; Branch if not
 +
jsr FMUpdateTrack(pc)
 +
; loc_71C38:
 +
.specfmdone:
 +
adda.w #zTrackSz,a5
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing
 +
bpl.s DoStartZ80 ; Branch if not
 +
jsr PSGUpdateTrack(pc)
 +
; loc_71C44:
 +
DoStartZ80:
 +
startZ80
 +
rts
 +
; End of function UpdateMusic
  
loc_71BE6:
 
dbf d7,loc_71BDA
 
  
moveq #2,d7
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
loc_71BEC:
+
; sub_71C4E:
adda.w #$30,a5
+
UpdateDAC:
tst.b (a5)
+
subq.b #1,zTrackDurationTimeout(a5) ; Has DAC sample timeout expired?
bpl.s loc_71BF8
+
bne.s .locret ; Return if not
jsr sub_72850(pc)
+
move.b #$80,f_updating_dac(a6) ; Set flag to indicate this is the DAC
 +
movea.l zTrackDataPointer(a5),a4 ; DAC track data pointer
 +
; loc_71C5E:
 +
.sampleloop:
 +
moveq #0,d5
 +
move.b (a4)+,d5 ; Get next SMPS unit
 +
cmpi.b #$E0,d5 ; Is it a coord. flag?
 +
blo.s .notcoord ; Branch if not
 +
jsr CoordFlag(pc)
 +
bra.s .sampleloop
 +
; ===========================================================================
 +
; loc_71C6E:
 +
.notcoord:
 +
tst.b d5 ; Is it a sample?
 +
bpl.s .gotduration ; Branch if not (duration)
 +
move.b d5,zTrackSavedDAC(a5) ; Store new sample
 +
move.b (a4)+,d5 ; Get another byte
 +
bpl.s .gotduration ; Branch if it is a duration
 +
subq.w #1,a4 ; Put byte back
 +
move.b zTrackSavedDuration(a5),zTrackDurationTimeout(a5) ; Use last duration
 +
bra.s .gotsampleduration
 +
; ===========================================================================
 +
; loc_71C84:
 +
.gotduration:
 +
jsr SetDuration(pc)
 +
; loc_71C88:
 +
.gotsampleduration:
 +
move.l a4,zTrackDataPointer(a5) ; Save pointer
 +
btst #2,zTrackPlaybackControl(a5) ; Is track being overridden?
 +
bne.s .locret ; Return if yes
 +
moveq #0,d0
 +
move.b zTrackSavedDAC(a5),d0 ; Get sample
 +
cmpi.b #$80,d0 ; Is it a rest?
 +
beq.s .locret ; Return if yes
 +
btst #3,d0 ; Is bit 3 set (samples between $88-$8F)?
 +
bne.s .timpani ; Various timpani
 +
move.b d0,(z80_dac_sample).l
 +
; locret_71CAA:
 +
.locret:
 +
rts
 +
; ===========================================================================
 +
; loc_71CAC:
 +
.timpani:
 +
subi.b #$88,d0 ; Convert into an index
 +
move.b DAC_sample_rate(pc,d0.w),d0
 +
; Warning: this affects the raw pitch of sample $83, meaning it will
 +
; use this value from then on.
 +
move.b d0,(z80_dac3_pitch).l
 +
move.b #$83,(z80_dac_sample).l ; Use timpani
 +
rts
 +
; End of function UpdateDAC
  
loc_71BF8:
+
; ===========================================================================
dbf d7,loc_71BEC
+
; Note: this only defines rates for samples $88-$8D, meaning $8E-$8F are invalid.
 +
; Also, $8C-$8D are so slow you may want to skip them.
 +
; byte_71CC4:
 +
DAC_sample_rate: dc.b $12, $15, $1C, $1D, $FF, $FF
  
move.b #$80,$E(a6)
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
moveq #2,d7
 
  
loc_71C04:
+
; sub_71CCA:
adda.w #$30,a5
+
FMUpdateTrack:
tst.b (a5)
+
subq.b #1,zTrackDurationTimeout(a5) ; Update duration timeout
bpl.s loc_71C10
+
bne.s .notegoing ; Branch if it hasn't expired
jsr sub_71CCA(pc)
+
bclr #4,zTrackPlaybackControl(a5) ; Clear 'do not attack next note' bit
 +
jsr FMDoNext(pc)
 +
jsr FMPrepareNote(pc)
 +
bra.w FMNoteOn
 +
; ===========================================================================
 +
; loc_71CE0:
 +
.notegoing:
 +
jsr NoteFillUpdate(pc)
 +
jsr DoModulation(pc)
 +
bra.w FMUpdateFreq
 +
; End of function FMUpdateTrack
  
loc_71C10:
 
dbf d7,loc_71C04
 
  
moveq #2,d7
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
loc_71C16:
+
; sub_71CEC:
adda.w #$30,a5
+
FMDoNext:
tst.b (a5)
+
movea.l zTrackDataPointer(a5),a4 ; Track data pointer
bpl.s loc_71C22
+
bclr #1,zTrackPlaybackControl(a5) ; Clear 'track at rest' bit
jsr sub_72850(pc)
+
; loc_71CF4:
 +
.noteloop:
 +
moveq #0,d5
 +
move.b (a4)+,d5 ; Get byte from track
 +
cmpi.b #$E0,d5 ; Is this a coord. flag?
 +
blo.s .gotnote ; Branch if not
 +
jsr CoordFlag(pc)
 +
bra.s .noteloop
 +
; ===========================================================================
 +
; loc_71D04:
 +
.gotnote:
 +
jsr FMNoteOff(pc)
 +
tst.b d5 ; Is this a note?
 +
bpl.s .gotduration ; Branch if not
 +
jsr FMSetFreq(pc)
 +
move.b (a4)+,d5 ; Get another byte
 +
bpl.s .gotduration ; Branch if it is a duration
 +
subq.w #1,a4 ; Otherwise, put it back
 +
bra.w FinishTrackUpdate
 +
; ===========================================================================
 +
; loc_71D1A:
 +
.gotduration:
 +
jsr SetDuration(pc)
 +
bra.w FinishTrackUpdate
 +
; End of function FMDoNext
  
loc_71C22:
 
dbf d7,loc_71C16
 
move.b #$40,$E(a6)
 
adda.w #$30,a5
 
tst.b (a5)
 
bpl.s loc_71C38
 
jsr sub_71CCA(pc)
 
  
loc_71C38:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
adda.w #$30,a5
 
tst.b (a5)
 
bpl.s loc_71C44
 
jsr sub_72850(pc)
 
  
loc_71C44:
+
; sub_71D22:
move.w #0,($A11100).l ; start the Z80
+
FMSetFreq:
 +
subi.b #$80,d5 ; Make it a zero-based index
 +
beq.s TrackSetRest
 +
add.b zTrackTranspose(a5),d5 ; Add track transposition
 +
andi.w #$7F,d5 ; Clear high byte and sign bit
 +
lsl.w #1,d5
 +
lea FM_Notes(pc),a0
 +
move.w (a0,d5.w),d6
 +
move.w d6,zTrackFreq(a5) ; Store new frequency
 
rts
 
rts
; End of function sub_71B4C
+
; End of function FMSetFreq
  
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 +
; sub_71D40:
 +
SetDuration:
 +
move.b d5,d0
 +
move.b zTrackTempoDivider(a5),d1 ; Get dividing timing
 +
; loc_71D46:
 +
.multloop:
 +
subq.b #1,d1
 +
beq.s .donemult
 +
add.b d5,d0
 +
bra.s .multloop
 +
; ===========================================================================
 +
; loc_71D4E:
 +
.donemult:
 +
move.b d0,zTrackSavedDuration(a5) ; Save duration
 +
move.b d0,zTrackDurationTimeout(a5) ; Save duration timeout
 +
rts
 +
; End of function SetDuration
  
sub_71C4E: ; XREF: sub_71B4C
+
; ===========================================================================
subq.b #1,$E(a5)
+
; loc_71D58:
bne.s locret_71CAA
+
TrackSetRest:
move.b #$80,8(a6)
+
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
movea.l 4(a5),a4
+
clr.w zTrackFreq(a5) ; Clear frequency
  
loc_71C5E:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
moveq #0,d5
 
move.b (a4)+,d5
 
cmpi.b #-$20,d5
 
bcs.s loc_71C6E
 
jsr sub_72A5A(pc)
 
bra.s loc_71C5E
 
; ===========================================================================
 
  
loc_71C6E:
+
; sub_71D60:
tst.b d5
+
FinishTrackUpdate:
bpl.s loc_71C84
+
move.l a4,zTrackDataPointer(a5) ; Store new track position
move.b d5,$10(a5)
+
move.b zTrackSavedDuration(a5),zTrackDurationTimeout(a5) ; Reset note timeout
move.b (a4)+,d5
+
btst #4,zTrackPlaybackControl(a5) ; Is track set to not attack note?
bpl.s loc_71C84
+
bne.s .locret ; If so, branch
subq.w #1,a4
+
move.b zTrackNoteFillMaster(a5),zTrackNoteFillTimeout(a5) ; Reset note fill timeout
move.b $F(a5),$E(a5)
+
clr.b zTrackVolFlutter(a5) ; Reset PSG flutter index (even on FM tracks...)
bra.s loc_71C88
+
btst #3,zTrackPlaybackControl(a5) ; Is modulation on?
; ===========================================================================
+
beq.s .locret ; If not, return
 +
movea.l zTrackModulationPtr(a5),a0 ; Modulation data pointer
 +
move.b (a0)+,zTrackModulationWait(a5) ; Reset wait
 +
move.b (a0)+,zTrackModulationSpeed(a5) ; Reset speed
 +
move.b (a0)+,zTrackModulationDelta(a5) ; Reset delta
 +
move.b (a0)+,d0 ; Get steps
 +
lsr.b #1,d0 ; Halve them
 +
move.b d0,zTrackModulationSteps(a5) ; Then store
 +
clr.w zTrackModulationVal(a5) ; Reset frequency change
 +
; locret_71D9C:
 +
.locret:
 +
rts
 +
; End of function FinishTrackUpdate
  
loc_71C84:
 
jsr sub_71D40(pc)
 
  
loc_71C88:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
move.l a4,4(a5)
 
btst #2,(a5)
 
bne.s locret_71CAA
 
moveq #0,d0
 
move.b $10(a5),d0
 
cmpi.b #$80,d0
 
beq.s locret_71CAA
 
btst #3,d0
 
bne.s loc_71CAC
 
move.b d0,($A01FFF).l
 
  
locret_71CAA:
+
; sub_71D9E:
 +
NoteFillUpdate:
 +
tst.b zTrackNoteFillTimeout(a5) ; Is note fill on?
 +
beq.s .locret
 +
subq.b #1,zTrackNoteFillTimeout(a5) ; Update note fill timeout
 +
bne.s .locret ; Return if it hasn't expired
 +
bset #1,zTrackPlaybackControl(a5) ; Put track at rest
 +
tst.b zTrackVoiceControl(a5) ; Is this a psg track?
 +
bmi.w .psgnoteoff ; If yes, branch
 +
jsr FMNoteOff(pc)
 +
addq.w #4,sp ; Do not return to caller
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_71DBE:
loc_71CAC:
+
.psgnoteoff:
subi.b #$88,d0
+
jsr PSGNoteOff(pc)
move.b byte_71CC4(pc,d0.w),d0
+
addq.w #4,sp ; Do not return to caller
move.b d0,($A000EA).l
+
; locret_71DC4:
move.b #$83,($A01FFF).l
+
.locret:
 
rts
 
rts
; End of function sub_71C4E
+
; End of function NoteFillUpdate
  
; ===========================================================================
 
byte_71CC4: dc.b $12, $15, $1C, $1D, $FF, $FF
 
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 
+
; sub_71DC6:
sub_71CCA: ; XREF: sub_71B4C
+
DoModulation:
subq.b #1,$E(a5)
+
addq.w #4,sp ; Do not return to caller (but see below)
bne.s loc_71CE0
+
btst #3,zTrackPlaybackControl(a5) ; Is modulation active?
bclr #4,(a5)
+
beq.s .locret ; Return if not
jsr sub_71CEC(pc)
+
tst.b zTrackModulationWait(a5) ; Has modulation wait expired?
jsr sub_71E18(pc)
+
beq.s .waitdone ; If yes, branch
bra.w loc_726E2
+
subq.b #1,zTrackModulationWait(a5) ; Update wait timeout
 +
rts
 +
; ===========================================================================
 +
; loc_71DDA:
 +
.waitdone:
 +
subq.b #1,zTrackModulationSpeed(a5) ; Update speed
 +
beq.s .updatemodulation ; If it expired, want to update modulation
 +
rts
 +
; ===========================================================================
 +
; loc_71DE2:
 +
.updatemodulation:
 +
movea.l zTrackModulationPtr(a5),a0 ; Get modulation data
 +
move.b 1(a0),zTrackModulationSpeed(a5) ; Restore modulation speed
 +
tst.b zTrackModulationSteps(a5) ; Check number of steps
 +
bne.s .calcfreq ; If nonzero, branch
 +
move.b 3(a0),zTrackModulationSteps(a5) ; Restore from modulation data
 +
neg.b zTrackModulationDelta(a5) ; Negate modulation delta
 +
rts
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_71DFE:
loc_71CE0:
+
.calcfreq:
jsr sub_71D9E(pc)
+
subq.b #1,zTrackModulationSteps(a5) ; Update modulation steps
jsr sub_71DC6(pc)
+
move.b zTrackModulationDelta(a5),d6 ; Get modulation delta
bra.w loc_71E24
+
ext.w d6
; End of function sub_71CCA
+
add.w zTrackModulationVal(a5),d6 ; Add cumulative modulation change
 +
move.w d6,zTrackModulationVal(a5) ; Store it
 +
add.w zTrackFreq(a5),d6 ; Add note frequency to it
 +
subq.w #4,sp ; In this case, we want to return to caller after all
 +
; locret_71E16:
 +
.locret:
 +
rts
 +
; End of function DoModulation
  
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 
+
; sub_71E18:
sub_71CEC: ; XREF: sub_71CCA
+
FMPrepareNote:
movea.l 4(a5),a4
+
btst #1,zTrackPlaybackControl(a5) ; Is track resting?
bclr #1,(a5)
+
bne.s locret_71E48 ; Return if so
 
+
move.w zTrackFreq(a5),d6 ; Get current note frequency
loc_71CF4:
+
beq.s FMSetRest ; Branch if zero
moveq #0,d5
+
; loc_71E24:
move.b (a4)+,d5
+
FMUpdateFreq:
cmpi.b #-$20,d5
+
move.b zTrackDetune(a5),d0 ; Get detune value
bcs.s loc_71D04
+
ext.w d0
jsr sub_72A5A(pc)
+
add.w d0,d6 ; Add note frequency
bra.s loc_71CF4
+
btst #2,zTrackPlaybackControl(a5) ; Is track being overridden?
 +
bne.s locret_71E48 ; Return if so
 +
move.w d6,d1
 +
lsr.w #8,d1
 +
move.b #$A4,d0 ; Register for upper 6 bits of frequency
 +
jsr WriteFMIorII(pc)
 +
move.b d6,d1
 +
move.b #$A0,d0 ; Register for lower 8 bits of frequency
 +
jsr WriteFMIorII(pc) ; (It would be better if this were a jmp)
 +
; locret_71E48:
 +
locret_71E48:
 +
rts
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_71E4A:
 +
FMSetRest:
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
rts
 +
; End of function FMPrepareNote
  
loc_71D04:
 
jsr sub_726FE(pc)
 
tst.b d5
 
bpl.s loc_71D1A
 
jsr sub_71D22(pc)
 
move.b (a4)+,d5
 
bpl.s loc_71D1A
 
subq.w #1,a4
 
bra.w sub_71D60
 
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_71E50:
 +
PauseMusic:
 +
bmi.s .unpausemusic ; Branch if music is being unpaused
 +
cmpi.b #2,f_stopmusic(a6)
 +
beq.w .unpausedallfm
 +
move.b #2,f_stopmusic(a6)
 +
moveq #2,d3
 +
move.b #$B4,d0 ; Command to set AMS/FMS/panning
 +
moveq #0,d1 ; No panning, AMS or FMS
 +
; loc_71E6A:
 +
.killpanloop:
 +
jsr WriteFMI(pc)
 +
jsr WriteFMII(pc)
 +
addq.b #1,d0
 +
dbf d3,.killpanloop
  
loc_71D1A:
+
moveq #2,d3
jsr sub_71D40(pc)
+
moveq #$28,d0 ; Key on/off register
bra.w sub_71D60
+
; loc_71E7C:
; End of function sub_71CEC
+
.noteoffloop:
 +
move.b d3,d1 ; FM1, FM2, FM3
 +
jsr WriteFMI(pc)
 +
addq.b #4,d1 ; FM4, FM5, FM6
 +
jsr WriteFMI(pc)
 +
dbf d3,.noteoffloop
  
 +
jsr PSGSilenceAll(pc)
 +
bra.w DoStartZ80
 +
; ===========================================================================
 +
; loc_71E94:
 +
.unpausemusic:
 +
clr.b f_stopmusic(a6)
 +
moveq #zTrackSz,d3
 +
lea v_music_fmdac_tracks(a6),a5
 +
moveq #((v_music_fmdac_tracks_end-v_music_fmdac_tracks)/zTrackSz)-1,d4 ; 6 FM + 1 DAC tracks
 +
; loc_71EA0:
 +
.bgmfmloop:
 +
btst #7,zTrackPlaybackControl(a5) ; Is track playing?
 +
beq.s .bgmfmnext ; Branch if not
 +
btst #2,zTrackPlaybackControl(a5) ; Is track being overridden?
 +
bne.s .bgmfmnext ; Branch if yes
 +
move.b #$B4,d0 ; Command to set AMS/FMS/panning
 +
move.b zTrackAMSFMSPan(a5),d1 ; Get value from track RAM
 +
jsr WriteFMIorII(pc)
 +
; loc_71EB8:
 +
.bgmfmnext:
 +
adda.w d3,a5
 +
dbf d4,.bgmfmloop
  
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
lea v_sfx_fm_tracks(a6),a5
 +
moveq #((v_sfx_fm_tracks_end-v_sfx_fm_tracks)/zTrackSz)-1,d4 ; 3 FM tracks (SFX)
 +
; loc_71EC4:
 +
.sfxfmloop:
 +
btst #7,zTrackPlaybackControl(a5) ; Is track playing?
 +
beq.s .sfxfmnext ; Branch if not
 +
btst #2,zTrackPlaybackControl(a5) ; Is track being overridden?
 +
bne.s .sfxfmnext ; Branch if yes
 +
move.b #$B4,d0 ; Command to set AMS/FMS/panning
 +
move.b zTrackAMSFMSPan(a5),d1 ; Get value from track RAM
 +
jsr WriteFMIorII(pc)
 +
; loc_71EDC:
 +
.sfxfmnext:
 +
adda.w d3,a5
 +
dbf d4,.sfxfmloop
  
 +
lea v_spcsfx_track_ram(a6),a5
 +
btst #7,(a5) ; Is track playing? (zTrackPlaybackControl)
 +
beq.s .unpausedallfm ; Branch if not
 +
btst #2,(a5) ; Is track being overridden? (zTrackPlaybackControl)
 +
bne.s .unpausedallfm ; Branch if yes
 +
move.b #$B4,d0 ; Command to set AMS/FMS/panning
 +
move.b zTrackAMSFMSPan(a5),d1 ; Get value from track RAM
 +
jsr WriteFMIorII(pc)
 +
; loc_71EFE:
 +
.unpausedallfm:
 +
bra.w DoStartZ80
  
sub_71D22: ; XREF: sub_71CEC
+
; ---------------------------------------------------------------------------
subi.b #$80,d5
+
; Subroutine to play a sound or music track
beq.s loc_71D58
+
; ---------------------------------------------------------------------------
add.b 8(a5),d5
 
andi.w #$7F,d5
 
lsl.w #1,d5
 
lea word_72790(pc),a0
 
move.w (a0,d5.w),d6
 
move.w d6,$10(a5)
 
rts
 
; End of function sub_71D22
 
 
 
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
  
sub_71D40: ; XREF: sub_71C4E; sub_71CEC; sub_72878
+
Sound_Play:
move.b d5,d0
+
movea.l (Go_SoundPriorities).l,a0
move.b 2(a5),d1
+
lea v_playsnd1(a6),a1 ; load music track number
 
+
_move.b v_sndprio(a6),d3 ; Get priority of currently playing SFX
loc_71D46:
+
moveq #2,d4 ; Number of queues-1 (v_playsnd1, v_playsnd2, v_playnull)
subq.b #1,d1
+
; loc_71F12:
beq.s loc_71D4E
+
.inputloop:
add.b d5,d0
+
move.b (a1),d0 ; move track number to d0
bra.s loc_71D46
+
move.b d0,d1
 +
clr.b (a1)+ ; Clear entry
 +
subi.b #bgm__First,d0 ; Make it into 0-based index
 +
blo.s .nextinput ; If negative (i.e., it was $80 or lower), branch
 +
cmpi.b #$80,v_playsnd0(a6) ; Is v_playsnd0 a $80 (silence/empty)?
 +
beq.s .havesound ; If yes, branch
 +
move.b d1,v_playsnd1(a6) ; Put sound into v_playsnd1
 +
bra.s .nextinput
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_71F2C:
 +
.havesound:
 +
andi.w #$7F,d0 ; Clear high byte and sign bit
 +
move.b (a0,d0.w),d2 ; Get sound type
 +
cmp.b d3,d2 ; Is it a lower priority sound?
 +
blo.s .nextinput ; Branch if yes
 +
move.b d2,d3 ; Store new priority
 +
move.b d1,v_playsnd0(a6) ; Queue sound for play
 +
; loc_71F3E:
 +
.nextinput:
 +
dbf d4,.inputloop
  
loc_71D4E:
+
tst.b d3 ; We don't want to change sound priority if it is negative
move.b d0,$F(a5)
+
bmi.s .locret
move.b d0,$E(a5)
+
_move.b d3,v_sndprio(a6) ; Set new sound priority
 +
; locret_71F4A:
 +
.locret:
 
rts
 
rts
; End of function sub_71D40
+
; End of function Sound_Play
  
; ===========================================================================
 
 
loc_71D58: ; XREF: sub_71D22
 
bset #1,(a5)
 
clr.w $10(a5)
 
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
  
sub_71D60: ; XREF: sub_71CEC; sub_72878; sub_728AC
+
Sound_ChkValue:
move.l a4,4(a5)
+
moveq #0,d7
move.b $F(a5),$E(a5)
+
move.b v_playsnd0(a6),d7
btst #4,(a5)
+
beq.w StopSoundAndMusic
bne.s locret_71D9C
+
bpl.s .locret ; If >= 0, return (not a valid sound, bgm or command)
move.b $13(a5),$12(a5)
+
move.b #$80,v_playsnd0(a6) ; reset music flag
clr.b $C(a5)
+
; DANGER! Music ends at $93, yet this checks until $9F; attempting to
btst #3,(a5)
+
; play sounds $94-$9F will cause a crash! Remove the '+$C' to fix this.
beq.s locret_71D9C
+
; See LevSel_NoCheat for more.
movea.l $14(a5),a0
+
cmpi.b #bgm__Last+$C,d7 ; Is this music ($81-$9F)?
move.b (a0)+,$18(a5)
+
bls.w Sound_PlayBGM ; Branch if yes
move.b (a0)+,$19(a5)
+
cmpi.b #sfx__First,d7 ; Is this after music but before sfx? (redundant check)
move.b (a0)+,$1A(a5)
+
blo.w .locret ; Return if yes
move.b (a0)+,d0
+
cmpi.b #sfx__Last,d7 ; Is this sfx ($A0-$CF)?
lsr.b #1,d0
+
bls.w Sound_PlaySFX ; Branch if yes
move.b d0,$1B(a5)
+
cmpi.b #spec__First,d7 ; Is this after sfx but before special sfx? (redundant check)
clr.w $1C(a5)
+
blo.w .locret ; Return if yes
 
+
; DANGER! Special SFXes end at $D0, yet this checks until $DF; attempting to
locret_71D9C:
+
; play sounds $D1-$DF will cause a crash! Remove the '+$10' and change the 'blo' to a 'bls'
 +
; and uncomment the two lines below to fix this.
 +
cmpi.b #spec__Last+$10,d7 ; Is this special sfx ($D0-$DF)?
 +
blo.w Sound_PlaySpecial ; Branch if yes
 +
;cmpi.b #flg__First,d7 ; Is this after special sfx but before $E0?
 +
;blo.w .locret ; Return if yes
 +
cmpi.b #flg__Last,d7 ; Is this $E0-$E4?
 +
bls.s Sound_E0toE4 ; Branch if yes
 +
; locret_71F8C:
 +
.locret:
 
rts
 
rts
; End of function sub_71D60
+
; ===========================================================================
  
 +
Sound_E0toE4:
 +
subi.b #flg__First,d7
 +
lsl.w #2,d7
 +
jmp Sound_ExIndex(pc,d7.w)
 +
; ===========================================================================
  
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
Sound_ExIndex:
 +
ptr_flgE0: bra.w FadeOutMusic ; $E0
 +
ptr_flgE1: bra.w PlaySega ; $E1
 +
ptr_flgE2: bra.w SpeedUpMusic ; $E2
 +
ptr_flgE3: bra.w SlowDownMusic ; $E3
 +
ptr_flgE4: bra.w StopSoundAndMusic ; $E4
 +
ptr_flgend
 +
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Play "Say-gaa" PCM sound
 +
; ---------------------------------------------------------------------------
 +
; Sound_E1:
 +
PlaySega:
 +
move.b #$88,(z80_dac_sample).l ; Queue Sega PCM
 +
startZ80
 +
move.w #$11,d1
 +
; loc_71FC0:
 +
.busyloop_outer:
 +
move.w #-1,d0
 +
; loc_71FC4:
 +
.busyloop:
 +
nop
 +
dbf d0,.busyloop
  
 +
dbf d1,.busyloop_outer
  
sub_71D9E: ; XREF: sub_71CCA; sub_72850
+
addq.w #4,sp ; Tamper return value so we don't return to caller
tst.b $12(a5)
 
beq.s locret_71DC4
 
subq.b #1,$12(a5)
 
bne.s locret_71DC4
 
bset #1,(a5)
 
tst.b 1(a5)
 
bmi.w loc_71DBE
 
jsr sub_726FE(pc)
 
addq.w #4,sp
 
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Play music track $81-$9F
 +
; ---------------------------------------------------------------------------
 +
; Sound_81to9F:
 +
Sound_PlayBGM:
 +
cmpi.b #bgm_ExtraLife,d7 ; is the "extra life" music to be played?
 +
bne.s .bgmnot1up ; if not, branch
 +
tst.b f_1up_playing(a6) ; Is a 1-up music playing?
 +
bne.w .locdblret ; if yes, branch
 +
lea v_music_track_ram(a6),a5
 +
moveq #((v_music_track_ram_end-v_music_track_ram)/zTrackSz)-1,d0 ; 1 DAC + 6 FM + 3 PSG tracks
 +
; loc_71FE6:
 +
.clearsfxloop:
 +
bclr #2,zTrackPlaybackControl(a5) ; Clear 'SFX is overriding' bit
 +
adda.w #zTrackSz,a5
 +
dbf d0,.clearsfxloop
  
loc_71DBE:
+
lea v_sfx_track_ram(a6),a5
jsr sub_729A0(pc)
+
moveq #((v_sfx_track_ram_end-v_sfx_track_ram)/zTrackSz)-1,d0 ; 3 FM + 3 PSG tracks (SFX)
addq.w #4,sp
+
; loc_71FF8:
 +
.cleartrackplayloop:
 +
bclr #7,zTrackPlaybackControl(a5) ; Clear 'track is playing' bit
 +
adda.w #zTrackSz,a5
 +
dbf d0,.cleartrackplayloop
  
locret_71DC4:
+
_clr.b v_sndprio(a6) ; Clear priority
rts
+
movea.l a6,a0
; End of function sub_71D9E
+
lea v_1up_ram_copy(a6),a1
 
+
move.w #((v_music_track_ram_end-v_startofvariables)/4)-1,d0 ; Backup $220 bytes: all variables and music track data
 
+
; loc_72012:
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
.backupramloop:
 +
move.l (a0)+,(a1)+
 +
dbf d0,.backupramloop
  
 
+
move.b #$80,f_1up_playing(a6)
sub_71DC6: ; XREF: sub_71CCA; sub_72850
+
_clr.b v_sndprio(a6) ; Clear priority again (?)
addq.w #4,sp
+
bra.s .bgm_loadMusic
btst #3,(a5)
 
beq.s locret_71E16
 
tst.b $18(a5)
 
beq.s loc_71DDA
 
subq.b #1,$18(a5)
 
rts
 
; ===========================================================================
 
 
 
loc_71DDA:
 
subq.b #1,$19(a5)
 
beq.s loc_71DE2
 
rts
 
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_72024:
 +
.bgmnot1up:
 +
clr.b f_1up_playing(a6)
 +
clr.b v_fadein_counter(a6)
 +
; loc_7202C:
 +
.bgm_loadMusic:
 +
jsr InitMusicPlayback(pc)
 +
movea.l (Go_SpeedUpIndex).l,a4
 +
subi.b #bgm__First,d7
 +
move.b (a4,d7.w),v_speeduptempo(a6)
 +
movea.l (Go_MusicIndex).l,a4
 +
lsl.w #2,d7
 +
movea.l (a4,d7.w),a4 ; a4 now points to (uncompressed) song data
 +
moveq #0,d0
 +
move.w (a4),d0 ; load voice pointer
 +
add.l a4,d0 ; It is a relative pointer
 +
move.l d0,v_voice_ptr(a6)
 +
move.b 5(a4),d0 ; load tempo
 +
move.b d0,v_tempo_mod(a6)
 +
tst.b f_speedup(a6)
 +
beq.s .nospeedshoes
 +
move.b v_speeduptempo(a6),d0
 +
; loc_72068:
 +
.nospeedshoes:
 +
move.b d0,v_main_tempo(a6)
 +
move.b d0,v_main_tempo_timeout(a6)
 +
moveq #0,d1
 +
movea.l a4,a3
 +
addq.w #6,a4 ; Point past header
 +
moveq #0,d7
 +
move.b 2(a3),d7 ; load number of FM+DAC tracks
 +
beq.w .bgm_fmdone ; branch if zero
 +
subq.b #1,d7
 +
move.b #$C0,d1 ; Default AMS+FMS+Panning
 +
move.b 4(a3),d4 ; load tempo dividing timing
 +
moveq #zTrackSz,d6
 +
move.b #1,d5 ; Note duration for first "note"
 +
lea v_music_fmdac_tracks(a6),a1
 +
lea FMDACInitBytes(pc),a2
 +
; loc_72098:
 +
.bmg_fmloadloop:
 +
bset #7,zTrackPlaybackControl(a1) ; Initial playback control: set 'track playing' bit
 +
move.b (a2)+,zTrackVoiceControl(a1) ; Voice control bits
 +
move.b d4,zTrackTempoDivider(a1)
 +
move.b d6,zTrackStackPointer(a1) ; set "gosub" (coord flag F8h) stack init value
 +
move.b d1,zTrackAMSFMSPan(a1) ; Set AMS/FMS/Panning
 +
move.b d5,zTrackDurationTimeout(a1) ; Set duration of first "note"
 +
moveq #0,d0
 +
move.w (a4)+,d0 ; load DAC/FM pointer
 +
add.l a3,d0 ; Relative pointer
 +
move.l d0,zTrackDataPointer(a1) ; Store track pointer
 +
move.w (a4)+,zTrackTranspose(a1) ; load FM channel modifier
 +
adda.w d6,a1
 +
dbf d7,.bmg_fmloadloop
 +
cmpi.b #7,2(a3) ; Are 7 FM tracks defined?
 +
bne.s .silencefm6
 +
moveq #$2B,d0 ; DAC enable/disable register
 +
moveq #0,d1 ; Disable DAC
 +
jsr WriteFMI(pc)
 +
bra.w .bgm_fmdone
 +
; ===========================================================================
 +
; loc_720D8:
 +
.silencefm6:
 +
moveq #$28,d0 ; Key on/off register
 +
moveq #6,d1 ; Note off on all operators of channel 6
 +
jsr WriteFMI(pc)
 +
move.b #$42,d0 ; TL for operator 1 of FM6
 +
moveq #$7F,d1 ; Total silence
 +
jsr WriteFMII(pc)
 +
move.b #$4A,d0 ; TL for operator 3 of FM6
 +
moveq #$7F,d1 ; Total silence
 +
jsr WriteFMII(pc)
 +
move.b #$46,d0 ; TL for operator 2 of FM6
 +
moveq #$7F,d1 ; Total silence
 +
jsr WriteFMII(pc)
 +
move.b #$4E,d0 ; TL for operator 4 of FM6
 +
moveq #$7F,d1 ; Total silence
 +
jsr WriteFMII(pc)
 +
move.b #$B6,d0 ; AMS/FMS/panning of FM6
 +
move.b #$C0,d1 ; Stereo
 +
jsr WriteFMII(pc)
 +
; loc_72114:
 +
.bgm_fmdone:
 +
moveq #0,d7
 +
move.b 3(a3),d7 ; Load number of PSG tracks
 +
beq.s .bgm_psgdone ; branch if zero
 +
subq.b #1,d7
 +
lea v_music_psg_tracks(a6),a1
 +
lea PSGInitBytes(pc),a2
 +
; loc_72126:
 +
.bgm_psgloadloop:
 +
bset #7,zTrackPlaybackControl(a1) ; Initial playback control: set 'track playing' bit
 +
move.b (a2)+,zTrackVoiceControl(a1) ; Voice control bits
 +
move.b d4,zTrackTempoDivider(a1)
 +
move.b d6,zTrackStackPointer(a1) ; set "gosub" (coord flag F8h) stack init value
 +
move.b d5,zTrackDurationTimeout(a1) ; Set duration of first "note"
 +
moveq #0,d0
 +
move.w (a4)+,d0 ; load PSG channel pointer
 +
add.l a3,d0 ; Relative pointer
 +
move.l d0,zTrackDataPointer(a1) ; Store track pointer
 +
move.w (a4)+,zTrackTranspose(a1) ; load PSG modifier
 +
move.b (a4)+,d0 ; load redundant byte
 +
move.b (a4)+,zTrackVoiceIndex(a1) ; Initial PSG tone
 +
adda.w d6,a1
 +
dbf d7,.bgm_psgloadloop
 +
; loc_72154:
 +
.bgm_psgdone:
 +
lea v_sfx_track_ram(a6),a1
 +
moveq #((v_sfx_track_ram_end-v_sfx_track_ram)/zTrackSz)-1,d7 ; 6 SFX tracks
 +
; loc_7215A:
 +
.sfxstoploop:
 +
tst.b zTrackPlaybackControl(a1) ; Is SFX playing?
 +
bpl.w .sfxnext ; Branch if not
 +
moveq #0,d0
 +
move.b zTrackVoiceControl(a1),d0 ; Get voice control bits
 +
bmi.s .sfxpsgchannel ; Branch if this is a PSG channel
 +
subq.b #2,d0 ; SFX can't have FM1 or FM2
 +
lsl.b #2,d0 ; Convert to index
 +
bra.s .gotchannelindex
 +
; ===========================================================================
 +
; loc_7216E:
 +
.sfxpsgchannel:
 +
lsr.b #3,d0 ; Convert to index
 +
; loc_72170:
 +
.gotchannelindex:
 +
lea SFX_BGMChannelRAM(pc),a0
 +
movea.l (a0,d0.w),a0
 +
bset #2,zTrackPlaybackControl(a0) ; Set 'SFX is overriding' bit
 +
; loc_7217C:
 +
.sfxnext:
 +
adda.w d6,a1
 +
dbf d7,.sfxstoploop
  
loc_71DE2:
+
tst.w v_spcsfx_fm4_track+zTrackPlaybackControl(a6) ; Is special SFX being played?
movea.l $14(a5),a0
+
bpl.s .checkspecialpsg ; Branch if not
move.b 1(a0),$19(a5)
+
bset #2,v_music_fm4_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
tst.b $1B(a5)
+
; loc_7218E:
bne.s loc_71DFE
+
.checkspecialpsg:
move.b 3(a0),$1B(a5)
+
tst.w v_spcsfx_psg3_track+zTrackPlaybackControl(a6) ; Is special SFX being played?
neg.b $1A(a5)
+
bpl.s .sendfmnoteoff ; Branch if not
 +
bset #2,v_music_psg3_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
 +
; loc_7219A:
 +
.sendfmnoteoff:
 +
lea v_music_fm_tracks(a6),a5
 +
moveq #((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d4 ; 6 FM tracks
 +
; loc_721A0:
 +
.fmnoteoffloop:
 +
jsr FMNoteOff(pc)
 +
adda.w d6,a5
 +
dbf d4,.fmnoteoffloop ; run all FM tracks
 +
moveq #((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d4 ; 3 PSG tracks
 +
; loc_721AC:
 +
.psgnoteoffloop:
 +
jsr PSGNoteOff(pc)
 +
adda.w d6,a5
 +
dbf d4,.psgnoteoffloop ; run all PSG tracks
 +
; loc_721B6:
 +
.locdblret:
 +
addq.w #4,sp ; Tamper with return value to not return to caller
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 +
; byte_721BA:
 +
FMDACInitBytes: dc.b 6, 0, 1, 2, 4, 5, 6 ; first byte is for DAC; then notice the 0, 1, 2 then 4, 5, 6; this is the gap between parts I and II for YM2612 port writes
 +
even
 +
; byte_721C2:
 +
PSGInitBytes: dc.b $80, $A0, $C0 ; Specifically, these configure writes to the PSG port for each channel
 +
even
 +
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Play normal sound effect
 +
; ---------------------------------------------------------------------------
 +
; Sound_A0toCF:
 +
Sound_PlaySFX:
 +
tst.b f_1up_playing(a6) ; Is 1-up playing?
 +
bne.w .clear_sndprio ; Exit is it is
 +
tst.b v_fadeout_counter(a6) ; Is music being faded out?
 +
bne.w .clear_sndprio ; Exit if it is
 +
tst.b f_fadein_flag(a6) ; Is music being faded in?
 +
bne.w .clear_sndprio ; Exit if it is
 +
cmpi.b #sfx_Ring,d7 ; is ring sound effect played?
 +
bne.s .sfx_notRing ; if not, branch
 +
tst.b v_ring_speaker(a6) ; Is the ring sound playing on right speaker?
 +
bne.s .gotringspeaker ; Branch if not
 +
move.b #sfx_RingLeft,d7 ; play ring sound in left speaker
 +
; loc_721EE:
 +
.gotringspeaker:
 +
bchg #0,v_ring_speaker(a6) ; change speaker
 +
; Sound_notB5:
 +
.sfx_notRing:
 +
cmpi.b #sfx_Push,d7 ; is "pushing" sound played?
 +
bne.s .sfx_notPush ; if not, branch
 +
tst.b f_push_playing(a6) ; Is pushing sound already playing?
 +
bne.w .locret ; Return if not
 +
move.b #$80,f_push_playing(a6) ; Mark it as playing
 +
; Sound_notA7:
 +
.sfx_notPush:
 +
movea.l (Go_SoundIndex).l,a0
 +
subi.b #sfx__First,d7 ; Make it 0-based
 +
lsl.w #2,d7 ; Convert sfx ID into index
 +
movea.l (a0,d7.w),a3 ; SFX data pointer
 +
movea.l a3,a1
 +
moveq #0,d1
 +
move.w (a1)+,d1 ; Voice pointer
 +
add.l a3,d1 ; Relative pointer
 +
move.b (a1)+,d5 ; Dividing timing
 +
; DANGER! there is a missing 'moveq #0,d7' here, without which SFXes whose
 +
; index entry is above $3F will cause a crash. This is actually the same way that
 +
; this bug is fixed in Ristar's driver.
 +
move.b (a1)+,d7 ; Number of tracks (FM + PSG)
 +
subq.b #1,d7
 +
moveq #zTrackSz,d6
 +
; loc_72228:
 +
.sfx_loadloop:
 +
moveq #0,d3
 +
move.b 1(a1),d3 ; Channel assignment bits
 +
move.b d3,d4
 +
bmi.s .sfxinitpsg ; Branch if PSG
 +
subq.w #2,d3 ; SFX can only have FM3, FM4 or FM5
 +
lsl.w #2,d3
 +
lea SFX_BGMChannelRAM(pc),a5
 +
movea.l (a5,d3.w),a5
 +
bset #2,zTrackPlaybackControl(a5) ; Mark music track as being overridden
 +
bra.s .sfxoverridedone
 +
; ===========================================================================
 +
; loc_72244:
 +
.sfxinitpsg:
 +
lsr.w #3,d3
 +
lea SFX_BGMChannelRAM(pc),a5
 +
movea.l (a5,d3.w),a5
 +
bset #2,zTrackPlaybackControl(a5) ; Mark music track as being overridden
 +
cmpi.b #$C0,d4 ; Is this PSG 3?
 +
bne.s .sfxoverridedone ; Branch if not
 +
move.b d4,d0
 +
ori.b #$1F,d0 ; Command to silence PSG 3
 +
move.b d0,(psg_input).l
 +
bchg #5,d0 ; Command to silence noise channel
 +
move.b d0,(psg_input).l
 +
; loc_7226E:
 +
.sfxoverridedone:
 +
movea.l SFX_SFXChannelRAM(pc,d3.w),a5
 +
movea.l a5,a2
 +
moveq #(zTrackSz/4)-1,d0 ; $30 bytes
 +
; loc_72276:
 +
.clearsfxtrackram:
 +
clr.l (a2)+
 +
dbf d0,.clearsfxtrackram
  
loc_71DFE:
+
move.w (a1)+,zTrackPlaybackControl(a5) ; Initial playback control bits
subq.b #1,$1B(a5)
+
move.b d5,zTrackTempoDivider(a5) ; Initial voice control bits
move.b $1A(a5),d6
+
moveq #0,d0
ext.w d6
+
move.w (a1)+,d0 ; Track data pointer
add.w $1C(a5),d6
+
add.l a3,d0 ; Relative pointer
move.w d6,$1C(a5)
+
move.l d0,zTrackDataPointer(a5) ; Store track pointer
add.w $10(a5),d6
+
move.w (a1)+,zTrackTranspose(a5) ; load FM/PSG channel modifier
subq.w #4,sp
+
move.b #1,zTrackDurationTimeout(a5) ; Set duration of first "note"
 
+
move.b d6,zTrackStackPointer(a5) ; set "gosub" (coord flag F8h) stack init value
locret_71E16:
+
tst.b d4 ; Is this a PSG channel?
rts
+
bmi.s .sfxpsginitdone ; Branch if yes
; End of function sub_71DC6
+
move.b #$C0,zTrackAMSFMSPan(a5) ; AMS/FMS/Panning
 
+
move.l d1,zTrackVoicePtr(a5) ; Voice pointer
 
+
; loc_722A8:
 
+
.sfxpsginitdone:
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
dbf d7,.sfx_loadloop
 
 
 
 
sub_71E18: ; XREF: sub_71CCA
 
btst #1,(a5)
 
bne.s locret_71E48
 
move.w $10(a5),d6
 
beq.s loc_71E4A
 
 
 
loc_71E24: ; XREF: sub_71CCA
 
move.b $1E(a5),d0
 
ext.w d0
 
add.w d0,d6
 
btst #2,(a5)
 
bne.s locret_71E48
 
move.w d6,d1
 
lsr.w #8,d1
 
move.b #-$5C,d0
 
jsr sub_72722(pc)
 
move.b d6,d1
 
move.b #-$60,d0
 
jsr sub_72722(pc)
 
  
locret_71E48:
+
tst.b v_sfx_fm4_track+zTrackPlaybackControl(a6) ; Is special SFX being played?
 +
bpl.s .doneoverride ; Branch if not
 +
bset #2,v_spcsfx_fm4_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
 +
; loc_722B8:
 +
.doneoverride:
 +
tst.b v_sfx_psg3_track+zTrackPlaybackControl(a6) ; Is special SFX being played?
 +
bpl.s .locret ; Branch if not
 +
bset #2,v_spcsfx_psg3_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
 +
; locret_722C4:
 +
.locret:
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_722C6:
loc_71E4A:
+
.clear_sndprio:
bset #1,(a5)
+
_clr.b v_sndprio(a6) ; Clear priority
 
rts
 
rts
; End of function sub_71E18
 
 
 
; ===========================================================================
 
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; RAM addresses for FM and PSG channel variables used by the SFX
 +
; ---------------------------------------------------------------------------
 +
; dword_722CC: BGMChannelRAM:
 +
SFX_BGMChannelRAM:
 +
dc.l (v_snddriver_ram+v_music_fm3_track)&$FFFFFF
 +
dc.l 0
 +
dc.l (v_snddriver_ram+v_music_fm4_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_music_fm5_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_music_psg1_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_music_psg2_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_music_psg3_track)&$FFFFFF ; Plain PSG3
 +
dc.l (v_snddriver_ram+v_music_psg3_track)&$FFFFFF ; Noise
 +
; dword_722EC: SFXChannelRAM:
 +
SFX_SFXChannelRAM:
 +
dc.l (v_snddriver_ram+v_sfx_fm3_track)&$FFFFFF
 +
dc.l 0
 +
dc.l (v_snddriver_ram+v_sfx_fm4_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_sfx_fm5_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_sfx_psg1_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_sfx_psg2_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_sfx_psg3_track)&$FFFFFF ; Plain PSG3
 +
dc.l (v_snddriver_ram+v_sfx_psg3_track)&$FFFFFF ; Noise
 +
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Play GHZ waterfall sound
 +
; ---------------------------------------------------------------------------
 +
; Sound_D0toDF:
 +
Sound_PlaySpecial:
 +
tst.b f_1up_playing(a6) ; Is 1-up playing?
 +
bne.w .locret ; Return if so
 +
tst.b v_fadeout_counter(a6) ; Is music being faded out?
 +
bne.w .locret ; Exit if it is
 +
tst.b f_fadein_flag(a6) ; Is music being faded in?
 +
bne.w .locret ; Exit if it is
 +
movea.l (Go_SpecSoundIndex).l,a0
 +
subi.b #spec__First,d7 ; Make it 0-based
 +
lsl.w #2,d7
 +
movea.l (a0,d7.w),a3
 +
movea.l a3,a1
 +
moveq #0,d0
 +
move.w (a1)+,d0 ; Voice pointer
 +
add.l a3,d0 ; Relative pointer
 +
move.l d0,v_special_voice_ptr(a6) ; Store voice pointer
 +
move.b (a1)+,d5 ; Dividing timing
 +
; DANGER! there is a missing 'moveq #0,d7' here, without which special SFXes whose
 +
; index entry is above $3F will cause a crash. This instance was not fixed in Ristar's driver.
 +
move.b (a1)+,d7 ; Number of tracks (FM + PSG)
 +
subq.b #1,d7
 +
moveq #zTrackSz,d6
 +
; loc_72348:
 +
.sfxloadloop:
 +
move.b 1(a1),d4 ; Voice control bits
 +
bmi.s .sfxoverridepsg ; Branch if PSG
 +
bset #2,v_music_fm4_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
 +
lea v_spcsfx_fm4_track(a6),a5
 +
bra.s .sfxinitpsg
 +
; ===========================================================================
 +
; loc_7235A:
 +
.sfxoverridepsg:
 +
bset #2,v_music_psg3_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
 +
lea v_spcsfx_psg3_track(a6),a5
 +
; loc_72364:
 +
.sfxinitpsg:
 +
movea.l a5,a2
 +
moveq #(zTrackSz/4)-1,d0 ; $30 bytes
 +
; loc_72368:
 +
.clearsfxtrackram:
 +
clr.l (a2)+
 +
dbf d0,.clearsfxtrackram
  
loc_71E50: ; XREF: sub_71B4C
+
move.w (a1)+,zTrackPlaybackControl(a5) ; Initial playback control bits & voice control bits
bmi.s loc_71E94
+
move.b d5,zTrackTempoDivider(a5)
cmpi.b #2,3(a6)
+
moveq #0,d0
beq.w loc_71EFE
+
move.w (a1)+,d0 ; Track data pointer
move.b #2,3(a6)
+
add.l a3,d0 ; Relative pointer
moveq #2,d3
+
move.l d0,zTrackDataPointer(a5) ; Store track pointer
move.b #-$4C,d0
+
move.w (a1)+,zTrackTranspose(a5) ; load FM/PSG channel modifier
moveq #0,d1
+
move.b #1,zTrackDurationTimeout(a5) ; Set duration of first "note"
 
+
move.b d6,zTrackStackPointer(a5) ; set "gosub" (coord flag F8h) stack init value
loc_71E6A:
+
tst.b d4 ; Is this a PSG channel?
jsr sub_7272E(pc)
+
bmi.s .sfxpsginitdone ; Branch if yes
jsr sub_72764(pc)
+
move.b #$C0,zTrackAMSFMSPan(a5) ; AMS/FMS/Panning
addq.b #1,d0
+
; loc_72396:
dbf d3,loc_71E6A
+
.sfxpsginitdone:
 +
dbf d7,.sfxloadloop
  
moveq #2,d3
+
tst.b v_sfx_fm4_track+zTrackPlaybackControl(a6) ; Is track playing?
moveq #$28,d0
+
bpl.s .doneoverride ; Branch if not
 
+
bset #2,v_spcsfx_fm4_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
loc_71E7C:
+
; loc_723A6:
move.b d3,d1
+
.doneoverride:
jsr sub_7272E(pc)
+
tst.b v_sfx_psg3_track+zTrackPlaybackControl(a6) ; Is track playing?
addq.b #4,d1
+
bpl.s .locret ; Branch if not
jsr sub_7272E(pc)
+
bset #2,v_spcsfx_psg3_track+zTrackPlaybackControl(a6) ; Set 'SFX is overriding' bit
dbf d3,loc_71E7C
+
ori.b #$1F,d4 ; Command to silence channel
 +
move.b d4,(psg_input).l
 +
bchg #5,d4 ; Command to silence noise channel
 +
move.b d4,(psg_input).l
 +
; locret_723C6:
 +
.locret:
 +
rts
 +
; End of function Sound_ChkValue
  
jsr sub_729B6(pc)
 
bra.w loc_71C44
 
 
; ===========================================================================
 
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Unused RAM addresses for FM and PSG channel variables used by the Special SFX
 +
; ---------------------------------------------------------------------------
 +
; The first block would have been used for overriding the music tracks
 +
; as they have a lower priority, just as they are in Sound_PlaySFX
 +
; The third block would be used to set up the Special SFX
 +
; The second block, however, is for the SFX tracks, which have a higher priority
 +
; and would be checked for if they're currently playing
 +
; If they are, then the third block would be used again, this time to mark
 +
; the new tracks as 'currently playing'
  
loc_71E94: ; XREF: loc_71E50
+
; These were actually used in Moonwalker's driver (and other SMPS 68k Type 1a drivers)
clr.b 3(a6)
 
moveq #$30,d3
 
lea $40(a6),a5
 
moveq #6,d4
 
  
loc_71EA0:
+
; BGMFM4PSG3RAM:
btst #7,(a5)
+
;SpecSFX_BGMChannelRAM:
beq.s loc_71EB8
+
dc.l (v_snddriver_ram+v_music_fm4_track)&$FFFFFF
btst #2,(a5)
+
dc.l (v_snddriver_ram+v_music_psg3_track)&$FFFFFF
bne.s loc_71EB8
+
; SFXFM4PSG3RAM:
move.b #-$4C,d0
+
;SpecSFX_SFXChannelRAM:
move.b $A(a5),d1
+
dc.l (v_snddriver_ram+v_sfx_fm4_track)&$FFFFFF
jsr sub_72722(pc)
+
dc.l (v_snddriver_ram+v_sfx_psg3_track)&$FFFFFF
 +
; SpecialSFXFM4PSG3RAM:
 +
;SpecSFX_SpecSFXChannelRAM:
 +
dc.l (v_snddriver_ram+v_spcsfx_fm4_track)&$FFFFFF
 +
dc.l (v_snddriver_ram+v_spcsfx_psg3_track)&$FFFFFF
  
loc_71EB8:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
adda.w d3,a5
 
dbf d4,loc_71EA0
 
  
lea $220(a6),a5
+
; Snd_FadeOut1: Snd_FadeOutSFX: FadeOutSFX:
moveq #2,d4
+
StopSFX:
 
+
_clr.b v_sndprio(a6) ; Clear priority
loc_71EC4:
+
lea v_sfx_track_ram(a6),a5
btst #7,(a5)
+
moveq #((v_sfx_track_ram_end-v_sfx_track_ram)/zTrackSz)-1,d7 ; 3 FM + 3 PSG tracks (SFX)
beq.s loc_71EDC
+
; loc_723EA:
btst #2,(a5)
+
.trackloop:
bne.s loc_71EDC
+
tst.b zTrackPlaybackControl(a5) ; Is track playing?
move.b #-$4C,d0
+
bpl.w .nexttrack ; Branch if not
move.b $A(a5),d1
+
bclr #7,zTrackPlaybackControl(a5) ; Stop track
jsr sub_72722(pc)
+
moveq #0,d3
 
+
move.b zTrackVoiceControl(a5),d3 ; Get voice control bits
loc_71EDC:
+
bmi.s .trackpsg ; Branch if PSG
adda.w d3,a5
+
jsr FMNoteOff(pc)
dbf d4,loc_71EC4
+
cmpi.b #4,d3 ; Is this FM4?
 +
bne.s .getfmpointer ; Branch if not
 +
tst.b v_spcsfx_fm4_track+zTrackPlaybackControl(a6) ; Is special SFX playing?
 +
bpl.s .getfmpointer ; Branch if not
 +
; DANGER! there is a missing 'movea.l a5,a3' here, without which the
 +
; code is broken. It is dangerous to do a fade out when a GHZ waterfall
 +
; is playing its sound!
 +
lea v_spcsfx_fm4_track(a6),a5
 +
movea.l v_special_voice_ptr(a6),a1 ; Get special voice pointer
 +
bra.s .gotfmpointer
 +
; ===========================================================================
 +
; loc_72416:
 +
.getfmpointer:
 +
subq.b #2,d3 ; SFX only has FM3 and up
 +
lsl.b #2,d3
 +
lea SFX_BGMChannelRAM(pc),a0
 +
movea.l a5,a3
 +
movea.l (a0,d3.w),a5
 +
movea.l v_voice_ptr(a6),a1 ; Get music voice pointer
 +
; loc_72428:
 +
.gotfmpointer:
 +
bclr #2,zTrackPlaybackControl(a5) ; Clear 'SFX is overriding' bit
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
move.b zTrackVoiceIndex(a5),d0 ; Current voice
 +
jsr SetVoice(pc)
 +
movea.l a3,a5
 +
bra.s .nexttrack
 +
; ===========================================================================
 +
; loc_7243C:
 +
.trackpsg:
 +
jsr PSGNoteOff(pc)
 +
lea v_spcsfx_psg3_track(a6),a0
 +
cmpi.b #$E0,d3 ; Is this a noise channel:
 +
beq.s .gotpsgpointer ; Branch if yes
 +
cmpi.b #$C0,d3 ; Is this PSG 3?
 +
beq.s .gotpsgpointer ; Branch if yes
 +
lsr.b #3,d3
 +
lea SFX_BGMChannelRAM(pc),a0
 +
movea.l (a0,d3.w),a0
 +
; loc_7245A:
 +
.gotpsgpointer:
 +
bclr #2,zTrackPlaybackControl(a0) ; Clear 'SFX is overriding' bit
 +
bset #1,zTrackPlaybackControl(a0) ; Set 'track at rest' bit
 +
cmpi.b #$E0,zTrackVoiceControl(a0) ; Is this a noise channel?
 +
bne.s .nexttrack ; Branch if not
 +
move.b zTrackPSGNoise(a0),(psg_input).l ; Set noise type
 +
; loc_72472:
 +
.nexttrack:
 +
adda.w #zTrackSz,a5
 +
dbf d7,.trackloop
  
lea $340(a6),a5
+
rts
btst #7,(a5)
+
; End of function StopSFX
beq.s loc_71EFE
 
btst #2,(a5)
 
bne.s loc_71EFE
 
move.b #-$4C,d0
 
move.b $A(a5),d1
 
jsr sub_72722(pc)
 
  
loc_71EFE:
 
bra.w loc_71C44
 
  
 +
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 +
 +
; Snd_FadeOut2: FadeOutSFX2: FadeOutSpecialSFX:
 +
StopSpecialSFX:
 +
lea v_spcsfx_fm4_track(a6),a5
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .fadedfm ; Branch if not
 +
bclr #7,zTrackPlaybackControl(a5) ; Stop track
 +
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding?
 +
bne.s .fadedfm ; Branch if not
 +
jsr SendFMNoteOff(pc)
 +
lea v_music_fm4_track(a6),a5
 +
bclr #2,zTrackPlaybackControl(a5) ; Clear 'SFX is overriding' bit
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .fadedfm ; Branch if not
 +
movea.l v_voice_ptr(a6),a1 ; Voice pointer
 +
move.b zTrackVoiceIndex(a5),d0 ; Current voice
 +
jsr SetVoice(pc)
 +
; loc_724AE:
 +
.fadedfm:
 +
lea v_spcsfx_psg3_track(a6),a5
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .fadedpsg ; Branch if not
 +
bclr #7,zTrackPlaybackControl(a5) ; Stop track
 +
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding?
 +
bne.s .fadedpsg ; Return if not
 +
jsr SendPSGNoteOff(pc)
 +
lea v_music_psg3_track(a6),a5
 +
bclr #2,zTrackPlaybackControl(a5) ; Clear 'SFX is overriding' bit
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .fadedpsg ; Return if not
 +
cmpi.b #$E0,zTrackVoiceControl(a5) ; Is this a noise channel?
 +
bne.s .fadedpsg ; Return if not
 +
move.b zTrackPSGNoise(a5),(psg_input).l ; Set noise type
 +
; locret_724E4:
 +
.fadedpsg:
 +
rts
 +
; End of function StopSpecialSFX
 +
 +
; ===========================================================================
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
; Subroutine to play a sound or music track
+
; Fade out music
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 +
; Sound_E0:
 +
FadeOutMusic:
 +
jsr StopSFX(pc)
 +
jsr StopSpecialSFX(pc)
 +
move.b #3,v_fadeout_delay(a6) ; Set fadeout delay to 3
 +
move.b #$28,v_fadeout_counter(a6) ; Set fadeout counter
 +
clr.b v_music_dac_track+zTrackPlaybackControl(a6) ; Stop DAC track
 +
clr.b f_speedup(a6) ; Disable speed shoes tempo
 +
rts
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 +
; sub_72504:
 +
DoFadeOut:
 +
move.b v_fadeout_delay(a6),d0 ; Has fadeout delay expired?
 +
beq.s .continuefade ; Branch if yes
 +
subq.b #1,v_fadeout_delay(a6)
 +
rts
 +
; ===========================================================================
 +
; loc_72510:
 +
.continuefade:
 +
subq.b #1,v_fadeout_counter(a6) ; Update fade counter
 +
beq.w StopSoundAndMusic ; Branch if fade is done
 +
move.b #3,v_fadeout_delay(a6) ; Reset fade delay
 +
lea v_music_fm_tracks(a6),a5
 +
moveq #((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7 ; 6 FM tracks
 +
; loc_72524:
 +
.fmloop:
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .nextfm ; Branch if not
 +
addq.b #1,zTrackVolume(a5) ; Increase volume attenuation
 +
bpl.s .sendfmtl ; Branch if still positive
 +
bclr #7,zTrackPlaybackControl(a5) ; Stop track
 +
bra.s .nextfm
 +
; ===========================================================================
 +
; loc_72534:
 +
.sendfmtl:
 +
jsr SendVoiceTL(pc)
 +
; loc_72538:
 +
.nextfm:
 +
adda.w #zTrackSz,a5
 +
dbf d7,.fmloop
  
Sound_Play: ; XREF: sub_71B4C
+
moveq #((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7 ; 3 PSG tracks
movea.l (Go_SoundTypes).l,a0
+
; loc_72542:
lea $A(a6),a1 ; load music track number
+
.psgloop:
move.b 0(a6),d3
+
tst.b zTrackPlaybackControl(a5) ; Is track playing?
moveq #2,d4
+
bpl.s .nextpsg ; branch if not
 
+
addq.b #1,zTrackVolume(a5) ; Increase volume attenuation
loc_71F12:
+
cmpi.b #$10,zTrackVolume(a5) ; Is it greater than $F?
move.b (a1),d0 ; move track number to d0
+
blo.s .sendpsgvol ; Branch if not
move.b d0,d1
+
bclr #7,zTrackPlaybackControl(a5) ; Stop track
clr.b (a1)+
+
bra.s .nextpsg
subi.b #$81,d0
 
bcs.s loc_71F3E
 
cmpi.b #$80,9(a6)
 
beq.s loc_71F2C
 
move.b d1,$A(a6)
 
bra.s loc_71F3E
 
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_72558:
 +
.sendpsgvol:
 +
move.b zTrackVolume(a5),d6 ; Store new volume attenuation
 +
jsr SetPSGVolume(pc)
 +
; loc_72560:
 +
.nextpsg:
 +
adda.w #zTrackSz,a5
 +
dbf d7,.psgloop
  
loc_71F2C:
 
andi.w #$7F,d0
 
move.b (a0,d0.w),d2
 
cmp.b d3,d2
 
bcs.s loc_71F3E
 
move.b d2,d3
 
move.b d1,9(a6) ; set music flag
 
 
loc_71F3E:
 
dbf d4,loc_71F12
 
 
tst.b d3
 
bmi.s locret_71F4A
 
move.b d3,0(a6)
 
 
locret_71F4A:
 
 
rts
 
rts
; End of function Sound_Play
+
; End of function DoFadeOut
  
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 +
; sub_7256A:
 +
FMSilenceAll:
 +
moveq #2,d3 ; 3 FM channels for each YM2612 parts
 +
moveq #$28,d0 ; FM key on/off register
 +
; loc_7256E:
 +
.noteoffloop:
 +
move.b d3,d1
 +
jsr WriteFMI(pc)
 +
addq.b #4,d1 ; Move to YM2612 part 1
 +
jsr WriteFMI(pc)
 +
dbf d3,.noteoffloop
 +
 +
moveq #$40,d0 ; Set TL on FM channels...
 +
moveq #$7F,d1 ; ... to total attenuation...
 +
moveq #2,d4 ; ... for all 3 channels...
 +
; loc_72584:
 +
.channelloop:
 +
moveq #3,d3 ; ... for all operators on each channel...
 +
; loc_72586:
 +
.channeltlloop:
 +
jsr WriteFMI(pc) ; ... for part 0...
 +
jsr WriteFMII(pc) ; ... and part 1.
 +
addq.w #4,d0 ; Next TL operator
 +
dbf d3,.channeltlloop
  
Sound_ChkValue: ; XREF: sub_71B4C
+
subi.b #$F,d0 ; Move to TL operator 1 of next channel
moveq #0,d7
+
dbf d4,.channelloop
move.b 9(a6),d7
 
beq.w Sound_E4
 
bpl.s locret_71F8C
 
move.b #$80,9(a6) ; reset music flag
 
cmpi.b #$9F,d7
 
bls.w Sound_81to9F ; music $81-$9F
 
cmpi.b #$A0,d7
 
bcs.w locret_71F8C
 
cmpi.b #$CF,d7
 
bls.w Sound_A0toCF ; sound $A0-$CF
 
cmpi.b #$D0,d7
 
bcs.w locret_71F8C
 
cmpi.b #$E0,d7
 
bcs.w Sound_D0toDF ; sound $D0-$DF
 
cmpi.b #$E4,d7
 
bls.s Sound_E0toE4 ; sound $E0-$E4
 
  
locret_71F8C:
 
 
rts
 
rts
; ===========================================================================
+
; End of function FMSilenceAll
  
Sound_E0toE4: ; XREF: Sound_ChkValue
 
subi.b #$E0,d7
 
lsl.w #2,d7
 
jmp Sound_ExIndex(pc,d7.w)
 
; ===========================================================================
 
 
Sound_ExIndex:
 
bra.w Sound_E0
 
; ===========================================================================
 
bra.w Sound_E1
 
; ===========================================================================
 
bra.w Sound_E2
 
; ===========================================================================
 
bra.w Sound_E3
 
; ===========================================================================
 
bra.w Sound_E4
 
 
; ===========================================================================
 
; ===========================================================================
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
; Play "Say-gaa" PCM sound
+
; Stop music
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 +
; Sound_E4:
 +
StopSoundAndMusic:
 +
moveq #$2B,d0 ; Enable/disable DAC
 +
move.b #$80,d1 ; Enable DAC
 +
jsr WriteFMI(pc)
 +
moveq #$27,d0 ; Timers, FM3/FM6 mode
 +
moveq #0,d1 ; FM3/FM6 normal mode, disable timers
 +
jsr WriteFMI(pc)
 +
movea.l a6,a0
 +
; DANGER! This should be clearing all variables and track data, but misses the last $10 bytes of v_spcsfx_psg3_track.
 +
; Remove the '-$10' to fix this.
 +
move.w #((v_spcsfx_track_ram_end-v_startofvariables-$10)/4)-1,d0 ; Clear $390 bytes: all variables and most track data
 +
; loc_725B6:
 +
.clearramloop:
 +
clr.l (a0)+
 +
dbf d0,.clearramloop
  
Sound_E1: ; XREF: Sound_ExIndex
+
move.b #$80,v_playsnd0(a6) ; set music to $80 (silence)
move.b #$88,($A01FFF).l
+
jsr FMSilenceAll(pc)
move.w #0,($A11100).l ; start the Z80
+
bra.w PSGSilenceAll
move.w #$11,d1
 
  
loc_71FC0:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
move.w #-1,d0
 
  
loc_71FC4:
+
; sub_725CA:
nop
+
InitMusicPlayback:
dbf d0,loc_71FC4
+
movea.l a6,a0
 +
; Save several values
 +
_move.b v_sndprio(a6),d1
 +
move.b f_1up_playing(a6),d2
 +
move.b f_speedup(a6),d3
 +
move.b v_fadein_counter(a6),d4
 +
move.w v_playsnd1(a6),d5
 +
move.w #((v_music_track_ram_end-v_startofvariables)/4)-1,d0 ; Clear $220 bytes: all variables and music track data
 +
; loc_725E4:
 +
.clearramloop:
 +
clr.l (a0)+
 +
dbf d0,.clearramloop
  
dbf d1,loc_71FC0
+
; Restore the values saved above
 +
_move.b d1,v_sndprio(a6)
 +
move.b d2,f_1up_playing(a6)
 +
move.b d3,f_speedup(a6)
 +
move.b d4,v_fadein_counter(a6)
 +
move.w d5,v_playsnd1(a6)
 +
move.b #$80,v_playsnd0(a6) ; set music to $80 (silence)
 +
; DANGER! This silences ALL channels, even the ones being used
 +
; by SFX, and not music! @sendfmnoteoff does this already, and
 +
; doesn't affect SFX channels, either.
 +
; This should be replaced with an 'rts'.
 +
jsr FMSilenceAll(pc)
 +
bra.w PSGSilenceAll
 +
; DANGER! InitMusicPlayback, and Sound_PlayBGM for that matter,
 +
; don't do a very good job of setting up the music tracks.
 +
; Tracks that aren't defined in a music file's header don't have
 +
; their channels defined, meaning @sendfmnoteoff won't silence
 +
; hardware properly. In combination with removing the above
 +
; calls to FMSilenceAll/PSGSilenceAll, this will cause hanging
 +
; notes.
 +
; To fix this, I suggest using this code, instead of an 'rts':
 +
;lea v_music_track_ram+zTrackVoiceControl(a6),a1
 +
;lea FMDACInitBytes(pc),a2
 +
;moveq #((v_music_fmdac_tracks_end-v_music_fmdac_tracks)/zTrackSz)-1,d1 ; 7 DAC/FM tracks
 +
;bsr.s @writeloop
 +
;lea PSGInitBytes(pc),a2
 +
;moveq #((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d1 ; 3 PSG tracks
  
addq.w #4,sp
+
;@writeloop:
rts
+
;move.b (a2)+,(a1) ; Write track's channel byte
; ===========================================================================
+
;lea zTrackSz(a1),a1 ; Next track
; ---------------------------------------------------------------------------
+
;dbf d1,@writeloop ; Loop for all DAC/FM/PSG tracks
; Play music track $81-$9F
 
; ---------------------------------------------------------------------------
 
  
Sound_81to9F: ; XREF: Sound_ChkValue
+
;rts
cmpi.b #$88,d7 ; is "extra life" music played?
+
bne.s loc_72024 ; if not, branch
+
; End of function InitMusicPlayback
tst.b $27(a6)
 
bne.w loc_721B6
 
lea $40(a6),a5
 
moveq #9,d0
 
  
loc_71FE6:
 
bclr #2,(a5)
 
adda.w #$30,a5
 
dbf d0,loc_71FE6
 
  
lea $220(a6),a5
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
moveq #5,d0
 
  
loc_71FF8:
+
; sub_7260C:
bclr #7,(a5)
+
TempoWait:
adda.w #$30,a5
+
move.b v_main_tempo(a6),v_main_tempo_timeout(a6) ; Reset main tempo timeout
dbf d0,loc_71FF8
+
lea v_music_track_ram+zTrackDurationTimeout(a6),a0 ; note timeout
clr.b 0(a6)
+
moveq #zTrackSz,d0
movea.l a6,a0
+
moveq #((v_music_track_ram_end-v_music_track_ram)/zTrackSz)-1,d1 ; 1 DAC + 6 FM + 3 PSG tracks
lea $3A0(a6),a1
+
; loc_7261A:
move.w #$87,d0
+
.tempoloop:
 +
addq.b #1,(a0) ; Delay note by 1 frame
 +
adda.w d0,a0 ; Advance to next track
 +
dbf d1,.tempoloop
  
loc_72012:
+
rts
move.l (a0)+,(a1)+
+
; End of function TempoWait
dbf d0,loc_72012
 
  
move.b #$80,$27(a6)
 
clr.b 0(a6)
 
bra.s loc_7202C
 
 
; ===========================================================================
 
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Speed up music
 +
; ---------------------------------------------------------------------------
 +
; Sound_E2:
 +
SpeedUpMusic:
 +
tst.b f_1up_playing(a6)
 +
bne.s .speedup_1up
 +
move.b v_speeduptempo(a6),v_main_tempo(a6)
 +
move.b v_speeduptempo(a6),v_main_tempo_timeout(a6)
 +
move.b #$80,f_speedup(a6)
 +
rts
 +
; ===========================================================================
 +
; loc_7263E:
 +
.speedup_1up:
 +
move.b v_1up_ram_copy+v_speeduptempo(a6),v_1up_ram_copy+v_main_tempo(a6)
 +
move.b v_1up_ram_copy+v_speeduptempo(a6),v_1up_ram_copy+v_main_tempo_timeout(a6)
 +
move.b #$80,v_1up_ram_copy+f_speedup(a6)
 +
rts
 +
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Change music back to normal speed
 +
; ---------------------------------------------------------------------------
 +
; Sound_E3:
 +
SlowDownMusic:
 +
tst.b f_1up_playing(a6)
 +
bne.s .slowdown_1up
 +
move.b v_tempo_mod(a6),v_main_tempo(a6)
 +
move.b v_tempo_mod(a6),v_main_tempo_timeout(a6)
 +
clr.b f_speedup(a6)
 +
rts
 +
; ===========================================================================
 +
; loc_7266A:
 +
.slowdown_1up:
 +
move.b v_1up_ram_copy+v_tempo_mod(a6),v_1up_ram_copy+v_main_tempo(a6)
 +
move.b v_1up_ram_copy+v_tempo_mod(a6),v_1up_ram_copy+v_main_tempo_timeout(a6)
 +
clr.b v_1up_ram_copy+f_speedup(a6)
 +
rts
  
loc_72024:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
clr.b $27(a6)
 
clr.b $26(a6)
 
 
 
loc_7202C:
 
jsr sub_725CA(pc)
 
movea.l (off_719A0).l,a4
 
subi.b #$81,d7
 
move.b (a4,d7.w),$29(a6)
 
movea.l (Go_MusicIndex).l,a4
 
lsl.w #2,d7
 
movea.l (a4,d7.w),a4
 
moveq #0,d0
 
move.w (a4),d0
 
add.l a4,d0
 
move.l d0,$18(a6)
 
move.b 5(a4),d0
 
move.b d0,$28(a6)
 
tst.b $2A(a6)
 
beq.s loc_72068
 
move.b $29(a6),d0
 
 
 
loc_72068:
 
move.b d0,2(a6)
 
move.b d0,1(a6)
 
moveq #0,d1
 
movea.l a4,a3
 
addq.w #6,a4
 
moveq #0,d7
 
move.b 2(a3),d7
 
beq.w loc_72114
 
subq.b #1,d7
 
move.b #-$40,d1
 
move.b 4(a3),d4
 
moveq #$30,d6
 
move.b #1,d5
 
lea $40(a6),a1
 
lea byte_721BA(pc),a2
 
  
loc_72098:
+
; sub_7267C:
bset #7,(a1)
+
DoFadeIn:
move.b (a2)+,1(a1)
+
tst.b v_fadein_delay(a6) ; Has fadein delay expired?
move.b d4,2(a1)
+
beq.s .continuefade ; Branch if yes
move.b d6,$D(a1)
+
subq.b #1,v_fadein_delay(a6)
move.b d1,$A(a1)
+
rts
move.b d5,$E(a1)
+
; ===========================================================================
moveq #0,d0
+
; loc_72688:
move.w (a4)+,d0
+
.continuefade:
add.l a3,d0
+
tst.b v_fadein_counter(a6) ; Is fade done?
move.l d0,4(a1)
+
beq.s .fadedone ; Branch if yes
move.w (a4)+,8(a1)
+
subq.b #1,v_fadein_counter(a6) ; Update fade counter
adda.w d6,a1
+
move.b #2,v_fadein_delay(a6) ; Reset fade delay
dbf d7,loc_72098
+
lea v_music_fm_tracks(a6),a5
cmpi.b #7,2(a3)
+
moveq #((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7 ; 6 FM tracks
bne.s loc_720D8
+
; loc_7269E:
moveq #$2B,d0
+
.fmloop:
moveq #0,d1
+
tst.b zTrackPlaybackControl(a5) ; Is track playing?
jsr sub_7272E(pc)
+
bpl.s .nextfm ; Branch if not
bra.w loc_72114
+
subq.b #1,zTrackVolume(a5) ; Reduce volume attenuation
 +
jsr SendVoiceTL(pc)
 +
; loc_726AA:
 +
.nextfm:
 +
adda.w #zTrackSz,a5
 +
dbf d7,.fmloop
 +
moveq #((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7 ; 3 PSG tracks
 +
; loc_726B4:
 +
.psgloop:
 +
tst.b zTrackPlaybackControl(a5) ; Is track playing?
 +
bpl.s .nextpsg ; Branch if not
 +
subq.b #1,zTrackVolume(a5) ; Reduce volume attenuation
 +
move.b zTrackVolume(a5),d6 ; Get value
 +
cmpi.b #$10,d6 ; Is it is < $10?
 +
blo.s .sendpsgvol ; Branch if yes
 +
moveq #$F,d6 ; Limit to $F (maximum attenuation)
 +
; loc_726C8:
 +
.sendpsgvol:
 +
jsr SetPSGVolume(pc)
 +
; loc_726CC:
 +
.nextpsg:
 +
adda.w #zTrackSz,a5
 +
dbf d7,.psgloop
 +
rts
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_726D6:
 +
.fadedone:
 +
bclr #2,v_music_dac_track+zTrackPlaybackControl(a6) ; Clear 'SFX overriding' bit
 +
clr.b f_fadein_flag(a6) ; Stop fadein
 +
rts
 +
; End of function DoFadeIn
  
loc_720D8:
+
; ===========================================================================
moveq #$28,d0
+
; loc_726E2:
moveq #6,d1
+
FMNoteOn:
jsr sub_7272E(pc)
+
btst #1,zTrackPlaybackControl(a5) ; Is track resting?
move.b #$42,d0
+
bne.s .locret ; Return if so
moveq #$7F,d1
+
btst #2,zTrackPlaybackControl(a5) ; Is track being overridden?
jsr sub_72764(pc)
+
bne.s .locret ; Return if so
move.b #$4A,d0
+
moveq #$28,d0 ; Note on/off register
moveq #$7F,d1
+
move.b zTrackVoiceControl(a5),d1 ; Get channel bits
jsr sub_72764(pc)
+
ori.b #$F0,d1 ; Note on on all operators
move.b #$46,d0
+
bra.w WriteFMI
moveq #$7F,d1
+
; ===========================================================================
jsr sub_72764(pc)
+
; locret_726FC:
move.b #$4E,d0
+
.locret:
moveq #$7F,d1
+
rts
jsr sub_72764(pc)
 
move.b #-$4A,d0
 
move.b #-$40,d1
 
jsr sub_72764(pc)
 
  
loc_72114:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
moveq #0,d7
 
move.b 3(a3),d7
 
beq.s loc_72154
 
subq.b #1,d7
 
lea $190(a6),a1
 
lea byte_721C2(pc),a2
 
  
loc_72126:
+
; sub_726FE:
bset #7,(a1)
+
FMNoteOff:
move.b (a2)+,1(a1)
+
btst #4,zTrackPlaybackControl(a5) ; Is 'do not attack next note' set?
move.b d4,2(a1)
+
bne.s locret_72714 ; Return if yes
move.b d6,$D(a1)
+
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding?
move.b d5,$E(a1)
+
bne.s locret_72714 ; Return if yes
moveq #0,d0
+
; loc_7270A:
move.w (a4)+,d0
+
SendFMNoteOff:
add.l a3,d0
+
moveq #$28,d0 ; Note on/off register
move.l d0,4(a1)
+
move.b zTrackVoiceControl(a5),d1 ; Note off to this channel
move.w (a4)+,8(a1)
+
bra.w WriteFMI
move.b (a4)+,d0
+
; ===========================================================================
move.b (a4)+,$B(a1)
 
adda.w d6,a1
 
dbf d7,loc_72126
 
  
loc_72154:
+
locret_72714:
lea $220(a6),a1
+
rts
moveq #5,d7
+
; End of function FMNoteOff
  
loc_7215A:
 
tst.b (a1)
 
bpl.w loc_7217C
 
moveq #0,d0
 
move.b 1(a1),d0
 
bmi.s loc_7216E
 
subq.b #2,d0
 
lsl.b #2,d0
 
bra.s loc_72170
 
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_72716:
 +
WriteFMIorIIMain:
 +
btst #2,zTrackPlaybackControl(a5) ; Is track being overriden by sfx?
 +
bne.s .locret ; Return if yes
 +
bra.w WriteFMIorII
 +
; ===========================================================================
 +
; locret_72720:
 +
.locret:
 +
rts
  
loc_7216E:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
lsr.b #3,d0
+
 
 +
; sub_72722:
 +
WriteFMIorII:
 +
btst #2,zTrackVoiceControl(a5) ; Is this bound for part I or II?
 +
bne.s WriteFMIIPart ; Branch if for part II
 +
add.b zTrackVoiceControl(a5),d0 ; Add in voice control bits
 +
; End of function WriteFMIorII
  
loc_72170:
 
lea dword_722CC(pc),a0
 
movea.l (a0,d0.w),a0
 
bset #2,(a0)
 
  
loc_7217C:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
adda.w d6,a1
 
dbf d7,loc_7215A
 
  
tst.w $340(a6)
+
; sub_7272E:
bpl.s loc_7218E
+
WriteFMI:
bset #2,$100(a6)
+
move.b (ym2612_a0).l,d2
 +
btst #7,d2 ; Is FM busy?
 +
bne.s WriteFMI ; Loop if so
 +
move.b d0,(ym2612_a0).l
 +
nop
 +
nop
 +
nop
 +
; loc_72746:
 +
.waitloop:
 +
move.b (ym2612_a0).l,d2
 +
btst #7,d2 ; Is FM busy?
 +
bne.s .waitloop ; Loop if so
  
loc_7218E:
+
move.b d1,(ym2612_d0).l
tst.w $370(a6)
+
rts
bpl.s loc_7219A
+
; End of function WriteFMI
bset #2,$1F0(a6)
 
  
loc_7219A:
+
; ===========================================================================
lea $70(a6),a5
+
; loc_7275A:
moveq #5,d4
+
WriteFMIIPart:
 +
move.b zTrackVoiceControl(a5),d2 ; Get voice control bits
 +
bclr #2,d2 ; Clear chip toggle
 +
add.b d2,d0 ; Add in to destination register
  
loc_721A0:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
jsr sub_726FE(pc)
 
adda.w d6,a5
 
dbf d4,loc_721A0
 
moveq #2,d4
 
  
loc_721AC:
+
; sub_72764:
jsr sub_729A0(pc)
+
WriteFMII:
adda.w d6,a5
+
move.b (ym2612_a0).l,d2
dbf d4,loc_721AC
+
btst #7,d2 ; Is FM busy?
 +
bne.s WriteFMII ; Loop if so
 +
move.b d0,(ym2612_a1).l
 +
nop
 +
nop
 +
nop
 +
; loc_7277C:
 +
.waitloop:
 +
move.b (ym2612_a0).l,d2
 +
btst #7,d2 ; Is FM busy?
 +
bne.s .waitloop ; Loop if so
  
loc_721B6:
+
move.b d1,(ym2612_d1).l
addq.w #4,sp
 
 
rts
 
rts
; ===========================================================================
+
; End of function WriteFMII
byte_721BA: dc.b 6, 0, 1, 2, 4, 5, 6, 0
+
 
align 2
 
byte_721C2: dc.b $80, $A0, $C0, 0
 
align 2
 
 
; ===========================================================================
 
; ===========================================================================
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
; Play normal sound effect
+
; FM Note Values: b-0 to a#8
 
; ---------------------------------------------------------------------------
 
; ---------------------------------------------------------------------------
 +
; word_72790:
 +
FM_Notes:
 +
dc.w $025E,$0284,$02AB,$02D3,$02FE,$032D,$035C,$038F,$03C5,$03FF,$043C,$047C
 +
dc.w $0A5E,$0A84,$0AAB,$0AD3,$0AFE,$0B2D,$0B5C,$0B8F,$0BC5,$0BFF,$0C3C,$0C7C
 +
dc.w $125E,$1284,$12AB,$12D3,$12FE,$132D,$135C,$138F,$13C5,$13FF,$143C,$147C
 +
dc.w $1A5E,$1A84,$1AAB,$1AD3,$1AFE,$1B2D,$1B5C,$1B8F,$1BC5,$1BFF,$1C3C,$1C7C
 +
dc.w $225E,$2284,$22AB,$22D3,$22FE,$232D,$235C,$238F,$23C5,$23FF,$243C,$247C
 +
dc.w $2A5E,$2A84,$2AAB,$2AD3,$2AFE,$2B2D,$2B5C,$2B8F,$2BC5,$2BFF,$2C3C,$2C7C
 +
dc.w $325E,$3284,$32AB,$32D3,$32FE,$332D,$335C,$338F,$33C5,$33FF,$343C,$347C
 +
dc.w $3A5E,$3A84,$3AAB,$3AD3,$3AFE,$3B2D,$3B5C,$3B8F,$3BC5,$3BFF,$3C3C,$3C7C
  
Sound_A0toCF: ; XREF: Sound_ChkValue
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
tst.b $27(a6)
 
bne.w loc_722C6
 
tst.b 4(a6)
 
bne.w loc_722C6
 
tst.b $24(a6)
 
bne.w loc_722C6
 
cmpi.b #$B5,d7 ; is ring sound effect played?
 
bne.s Sound_notB5 ; if not, branch
 
tst.b $2B(a6)
 
bne.s loc_721EE
 
move.b #$CE,d7 ; play ring sound in left speaker
 
  
loc_721EE:
+
; sub_72850:
bchg #0,$2B(a6) ; change speaker
+
PSGUpdateTrack:
 +
subq.b #1,zTrackDurationTimeout(a5) ; Update note timeout
 +
bne.s .notegoing
 +
bclr #4,zTrackPlaybackControl(a5) ; Clear 'do not attack note' bit
 +
jsr PSGDoNext(pc)
 +
jsr PSGDoNoteOn(pc)
 +
bra.w PSGDoVolFX
 +
; ===========================================================================
 +
; loc_72866:
 +
.notegoing:
 +
jsr NoteFillUpdate(pc)
 +
jsr PSGUpdateVolFX(pc)
 +
jsr DoModulation(pc)
 +
jsr PSGUpdateFreq(pc) ; It would be better if this were a jmp and the rts was removed
 +
rts
 +
; End of function PSGUpdateTrack
  
Sound_notB5:
 
cmpi.b #$A7,d7 ; is "pushing" sound played?
 
bne.s Sound_notA7 ; if not, branch
 
tst.b $2C(a6)
 
bne.w locret_722C4
 
move.b #$80,$2C(a6)
 
  
Sound_notA7:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
movea.l (Go_SoundIndex).l,a0
 
subi.b #$A0,d7
 
lsl.w #2,d7
 
movea.l (a0,d7.w),a3
 
movea.l a3,a1
 
moveq #0,d1
 
move.w (a1)+,d1
 
add.l a3,d1
 
move.b (a1)+,d5
 
move.b (a1)+,d7
 
subq.b #1,d7
 
moveq #$30,d6
 
  
loc_72228:
+
; sub_72878:
moveq #0,d3
+
PSGDoNext:
move.b 1(a1),d3
+
bclr #1,zTrackPlaybackControl(a5) ; Clear 'track at rest' bit
move.b d3,d4
+
movea.l zTrackDataPointer(a5),a4 ; Get track data pointer
bmi.s loc_72244
+
; loc_72880:
subq.w #2,d3
+
.noteloop:
lsl.w #2,d3
+
moveq #0,d5
lea dword_722CC(pc),a5
+
move.b (a4)+,d5 ; Get byte from track
movea.l (a5,d3.w),a5
+
cmpi.b #$E0,d5 ; Is it a coord. flag?
bset #2,(a5)
+
blo.s .gotnote ; Branch if not
bra.s loc_7226E
+
jsr CoordFlag(pc)
 +
bra.s .noteloop
 +
; ===========================================================================
 +
; loc_72890:
 +
.gotnote:
 +
tst.b d5 ; Is it a note?
 +
bpl.s .gotduration ; Branch if not
 +
jsr PSGSetFreq(pc)
 +
move.b (a4)+,d5 ; Get another byte
 +
tst.b d5 ; Is it a duration?
 +
bpl.s .gotduration ; Branch if yes
 +
subq.w #1,a4 ; Put byte back
 +
bra.w FinishTrackUpdate
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_728A4:
 +
.gotduration:
 +
jsr SetDuration(pc)
 +
bra.w FinishTrackUpdate
 +
; End of function PSGDoNext
  
loc_72244:
 
lsr.w #3,d3
 
lea dword_722CC(pc),a5
 
movea.l (a5,d3.w),a5
 
bset #2,(a5)
 
cmpi.b #$C0,d4
 
bne.s loc_7226E
 
move.b d4,d0
 
ori.b #$1F,d0
 
move.b d0,($C00011).l
 
bchg #5,d0
 
move.b d0,($C00011).l
 
  
loc_7226E:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
movea.l dword_722EC(pc,d3.w),a5
 
movea.l a5,a2
 
moveq #$B,d0
 
  
loc_72276:
+
; sub_728AC:
clr.l (a2)+
+
PSGSetFreq:
dbf d0,loc_72276
+
subi.b #$81,d5 ; Convert to 0-based index
 +
blo.s .restpsg ; If $80, put track at rest
 +
add.b zTrackTranspose(a5),d5 ; Add in channel transposition
 +
andi.w #$7F,d5 ; Clear high byte and sign bit
 +
lsl.w #1,d5
 +
lea PSGFrequencies(pc),a0
 +
move.w (a0,d5.w),zTrackFreq(a5) ; Set new frequency
 +
bra.w FinishTrackUpdate
 +
; ===========================================================================
 +
; loc_728CA:
 +
.restpsg:
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
move.w #-1,zTrackFreq(a5) ; Invalidate note frequency
 +
jsr FinishTrackUpdate(pc)
 +
bra.w PSGNoteOff
 +
; End of function PSGSetFreq
  
move.w (a1)+,(a5)
 
move.b d5,2(a5)
 
moveq #0,d0
 
move.w (a1)+,d0
 
add.l a3,d0
 
move.l d0,4(a5)
 
move.w (a1)+,8(a5)
 
move.b #1,$E(a5)
 
move.b d6,$D(a5)
 
tst.b d4
 
bmi.s loc_722A8
 
move.b #$C0,$A(a5)
 
move.l d1,$20(a5)
 
  
loc_722A8:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
dbf d7,loc_72228
 
  
tst.b $250(a6)
+
; sub_728DC:
bpl.s loc_722B8
+
PSGDoNoteOn:
bset #2,$340(a6)
+
move.w zTrackFreq(a5),d6 ; Get note frequency
 +
bmi.s PSGSetRest ; If invalid, branch
 +
; End of function PSGDoNoteOn
  
loc_722B8:
 
tst.b $310(a6)
 
bpl.s locret_722C4
 
bset #2,$370(a6)
 
  
locret_722C4:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
rts
 
; ===========================================================================
 
  
loc_722C6:
+
; sub_728E2:
clr.b 0(a6)
+
PSGUpdateFreq:
 +
move.b zTrackDetune(a5),d0 ; Get detune value
 +
ext.w d0
 +
add.w d0,d6 ; Add to frequency
 +
btst #2,zTrackPlaybackControl(a5) ; Is track being overridden?
 +
bne.s .locret ; Return if yes
 +
btst #1,zTrackPlaybackControl(a5) ; Is track at rest?
 +
bne.s .locret ; Return if yes
 +
move.b zTrackVoiceControl(a5),d0 ; Get channel bits
 +
cmpi.b #$E0,d0 ; Is it a noise channel?
 +
bne.s .notnoise ; Branch if not
 +
move.b #$C0,d0 ; Use PSG 3 channel bits
 +
; loc_72904:
 +
.notnoise:
 +
move.w d6,d1
 +
andi.b #$F,d1 ; Low nibble of frequency
 +
or.b d1,d0 ; Latch tone data to channel
 +
lsr.w #4,d6 ; Get upper 6 bits of frequency
 +
andi.b #$3F,d6 ; Send to latched channel
 +
move.b d0,(psg_input).l
 +
move.b d6,(psg_input).l
 +
; locret_7291E:
 +
.locret:
 
rts
 
rts
; ===========================================================================
+
; End of function PSGUpdateFreq
dword_722CC: dc.l $FFF0D0
 
dc.l 0
 
dc.l $FFF100
 
dc.l $FFF130
 
dc.l $FFF190
 
dc.l $FFF1C0
 
dc.l $FFF1F0
 
dc.l $FFF1F0
 
dword_722EC: dc.l $FFF220
 
dc.l 0
 
dc.l $FFF250
 
dc.l $FFF280
 
dc.l $FFF2B0
 
dc.l $FFF2E0
 
dc.l $FFF310
 
dc.l $FFF310
 
; ===========================================================================
 
; ---------------------------------------------------------------------------
 
; Play GHZ waterfall sound
 
; ---------------------------------------------------------------------------
 
  
Sound_D0toDF: ; XREF: Sound_ChkValue
 
tst.b $27(a6)
 
bne.w locret_723C6
 
tst.b 4(a6)
 
bne.w locret_723C6
 
tst.b $24(a6)
 
bne.w locret_723C6
 
movea.l (Go_SoundD0).l,a0
 
subi.b #$D0,d7
 
lsl.w #2,d7
 
movea.l (a0,d7.w),a3
 
movea.l a3,a1
 
moveq #0,d0
 
move.w (a1)+,d0
 
add.l a3,d0
 
move.l d0,$20(a6)
 
move.b (a1)+,d5
 
move.b (a1)+,d7
 
subq.b #1,d7
 
moveq #$30,d6
 
 
loc_72348:
 
move.b 1(a1),d4
 
bmi.s loc_7235A
 
bset #2,$100(a6)
 
lea $340(a6),a5
 
bra.s loc_72364
 
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_72920:
 +
PSGSetRest:
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
rts
  
loc_7235A:
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
bset #2,$1F0(a6)
 
lea $370(a6),a5
 
 
 
loc_72364:
 
movea.l a5,a2
 
moveq #$B,d0
 
 
 
loc_72368:
 
clr.l (a2)+
 
dbf d0,loc_72368
 
  
move.w (a1)+,(a5)
+
; sub_72926:
move.b d5,2(a5)
+
PSGUpdateVolFX:
 +
tst.b zTrackVoiceIndex(a5) ; Test PSG tone
 +
beq.w locret_7298A ; Return if it is zero
 +
; loc_7292E:
 +
PSGDoVolFX: ; This can actually be made a bit more efficient, see the comments for more
 +
move.b zTrackVolume(a5),d6 ; Get volume
 
moveq #0,d0
 
moveq #0,d0
move.w (a1)+,d0
+
move.b zTrackVoiceIndex(a5),d0 ; Get PSG tone
add.l a3,d0
+
beq.s SetPSGVolume
move.l d0,4(a5)
+
movea.l (Go_PSGIndex).l,a0
move.w (a1)+,8(a5)
+
subq.w #1,d0
move.b #1,$E(a5)
+
lsl.w #2,d0
move.b d6,$D(a5)
+
movea.l (a0,d0.w),a0
tst.b d4
+
move.b zTrackVolFlutter(a5),d0 ; Get flutter index ; move.b zTrackVolFlutter(a5),d0
bmi.s loc_72396
+
move.b (a0,d0.w),d0 ; Flutter value ; addq.b #1,zTrackVolFlutter(a5)
move.b #$C0,$A(a5)
+
addq.b #1,zTrackVolFlutter(a5) ; Increment flutter index ; move.b (a0,d0.w),d0
 +
btst #7,d0 ; Is flutter value negative? ; <-- makes this line redundant
 +
beq.s .gotflutter ; Branch if not ; but you gotta make this one a bpl
 +
cmpi.b #$80,d0 ; Is it the terminator? ; Since this is the only check, you can take the optimisation a step further:
 +
beq.s FlutterDone ; If so, branch ; Change the previous beq (bpl) to a bmi and make it branch to FlutterDone to make these last two lines redundant
 +
; loc_72960:
 +
.gotflutter:
 +
add.w d0,d6 ; Add flutter to volume
 +
cmpi.b #$10,d6 ; Is volume $10 or higher?
 +
blo.s SetPSGVolume ; Branch if not
 +
moveq #$F,d6 ; Limit to silence and fall through
 +
; End of function PSGUpdateVolFX
  
loc_72396:
 
dbf d7,loc_72348
 
  
tst.b $250(a6)
+
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
bpl.s loc_723A6
 
bset #2,$340(a6)
 
  
loc_723A6:
+
; sub_7296A:
tst.b $310(a6)
+
SetPSGVolume:
bpl.s locret_723C6
+
btst #1,zTrackPlaybackControl(a5) ; Is track at rest?
bset #2,$370(a6)
+
bne.s locret_7298A ; Return if so
ori.b #$1F,d4
+
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding?
move.b d4,($C00011).l
+
bne.s locret_7298A ; Return if so
bchg #5,d4
+
btst #4,zTrackPlaybackControl(a5) ; Is track set to not attack next note?
move.b d4,($C00011).l
+
bne.s PSGCheckNoteFill ; Branch if yes
 +
; loc_7297C:
 +
PSGSendVolume:
 +
or.b zTrackVoiceControl(a5),d6 ; Add in track selector bits
 +
addi.b #$10,d6 ; Mark it as a volume command
 +
move.b d6,(psg_input).l
  
locret_723C6:
+
locret_7298A:
 
rts
 
rts
; End of function Sound_ChkValue
+
; ===========================================================================
 +
; loc_7298C:
 +
PSGCheckNoteFill:
 +
tst.b zTrackNoteFillMaster(a5) ; Is note fill on?
 +
beq.s PSGSendVolume ; Branch if not
 +
tst.b zTrackNoteFillTimeout(a5) ; Has note fill timeout expired?
 +
bne.s PSGSendVolume ; Branch if not
 +
rts
 +
; End of function SetPSGVolume
  
 
; ===========================================================================
 
; ===========================================================================
dc.l $FFF100
+
; loc_7299A:
dc.l $FFF1F0
+
FlutterDone:
dc.l $FFF250
+
subq.b #1,zTrackVolFlutter(a5) ; Decrement flutter index
dc.l $FFF310
+
rts
dc.l $FFF340
 
dc.l $FFF370
 
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 +
; sub_729A0:
 +
PSGNoteOff:
 +
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding?
 +
bne.s locret_729B4 ; Return if so
 +
; loc_729A6:
 +
SendPSGNoteOff:
 +
move.b zTrackVoiceControl(a5),d0 ; PSG channel to change
 +
ori.b #$1F,d0 ; Maximum volume attenuation
 +
move.b d0,(psg_input).l
 +
; DANGER! If InitMusicPlayback doesn't silence all channels, there's the
 +
; risk of music accidentally playing noise because it can't detect if
 +
; the PSG4/noise channel needs muting on track initialisation.
 +
; S&K's driver fixes it by doing this:
 +
;cmpi.b #$DF,d0 ; Are stopping PSG3?
 +
;bne.s locret_729B4
 +
;move.b #$FF,(psg_input).l ; If so, stop noise channel while we're at it
  
Snd_FadeOut1: ; XREF: Sound_E0
+
locret_729B4:
clr.b 0(a6)
 
lea $220(a6),a5
 
moveq #5,d7
 
 
 
loc_723EA:
 
tst.b (a5)
 
bpl.w loc_72472
 
bclr #7,(a5)
 
moveq #0,d3
 
move.b 1(a5),d3
 
bmi.s loc_7243C
 
jsr sub_726FE(pc)
 
cmpi.b #4,d3
 
bne.s loc_72416
 
tst.b $340(a6)
 
bpl.s loc_72416
 
lea $340(a6),a5
 
movea.l $20(a6),a1
 
bra.s loc_72428
 
; ===========================================================================
 
 
 
loc_72416:
 
subq.b #2,d3
 
lsl.b #2,d3
 
lea dword_722CC(pc),a0
 
movea.l a5,a3
 
movea.l (a0,d3.w),a5
 
movea.l $18(a6),a1
 
 
 
loc_72428:
 
bclr #2,(a5)
 
bset #1,(a5)
 
move.b $B(a5),d0
 
jsr sub_72C4E(pc)
 
movea.l a3,a5
 
bra.s loc_72472
 
; ===========================================================================
 
 
 
loc_7243C:
 
jsr sub_729A0(pc)
 
lea $370(a6),a0
 
cmpi.b #$E0,d3
 
beq.s loc_7245A
 
cmpi.b #$C0,d3
 
beq.s loc_7245A
 
lsr.b #3,d3
 
lea dword_722CC(pc),a0
 
movea.l (a0,d3.w),a0
 
 
 
loc_7245A:
 
bclr #2,(a0)
 
bset #1,(a0)
 
cmpi.b #$E0,1(a0)
 
bne.s loc_72472
 
move.b $1F(a0),($C00011).l
 
 
 
loc_72472:
 
adda.w #$30,a5
 
dbf d7,loc_723EA
 
 
 
 
rts
 
rts
; End of function Snd_FadeOut1
+
; End of function PSGNoteOff
  
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 
+
; sub_729B6:
Snd_FadeOut2: ; XREF: Sound_E0
+
PSGSilenceAll:
lea $340(a6),a5
+
lea (psg_input).l,a0
tst.b (a5)
+
move.b #$9F,(a0) ; Silence PSG 1
bpl.s loc_724AE
+
move.b #$BF,(a0) ; Silence PSG 2
bclr #7,(a5)
+
move.b #$DF,(a0) ; Silence PSG 3
btst #2,(a5)
+
move.b #$FF,(a0) ; Silence noise channel
bne.s loc_724AE
 
jsr loc_7270A(pc)
 
lea $100(a6),a5
 
bclr #2,(a5)
 
bset #1,(a5)
 
tst.b (a5)
 
bpl.s loc_724AE
 
movea.l $18(a6),a1
 
move.b $B(a5),d0
 
jsr sub_72C4E(pc)
 
 
 
loc_724AE:
 
lea $370(a6),a5
 
tst.b (a5)
 
bpl.s locret_724E4
 
bclr #7,(a5)
 
btst #2,(a5)
 
bne.s locret_724E4
 
jsr loc_729A6(pc)
 
lea $1F0(a6),a5
 
bclr #2,(a5)
 
bset #1,(a5)
 
tst.b (a5)
 
bpl.s locret_724E4
 
cmpi.b #-$20,1(a5)
 
bne.s locret_724E4
 
move.b $1F(a5),($C00011).l
 
 
 
locret_724E4:
 
 
rts
 
rts
; End of function Snd_FadeOut2
+
; End of function PSGSilenceAll
  
 
; ===========================================================================
 
; ===========================================================================
; ---------------------------------------------------------------------------
+
; word_729CE:
; Fade out music
+
PSGFrequencies:
; ---------------------------------------------------------------------------
+
dc.w $356, $326, $2F9, $2CE, $2A5, $280, $25C, $23A
 
+
dc.w $21A, $1FB, $1DF, $1C4, $1AB, $193, $17D, $167
Sound_E0: ; XREF: Sound_ExIndex
+
dc.w $153, $140, $12E, $11D, $10D,  $FE,  $EF,  $E2
jsr Snd_FadeOut1(pc)
+
dc.w  $D6,  $C9,  $BE,  $B4,  $A9,  $A0,  $97,  $8F
jsr Snd_FadeOut2(pc)
+
dc.w  $87,  $7F,  $78,  $71,  $6B,  $65,  $5F,  $5A
move.b #3,6(a6)
+
dc.w  $55, $50,  $4B,  $47,  $43,  $40,  $3C,  $39
move.b #$28,4(a6)
+
dc.w  $36,  $33,  $30,  $2D,  $2B,  $28, $26,  $24
clr.b $40(a6)
+
dc.w  $22,  $20,  $1F,  $1D,  $1B,  $1A,  $18,  $17
clr.b $2A(a6)
+
dc.w  $16,  $15,  $13,  $12,  $11,    0
rts
 
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 +
; sub_72A5A:
 +
CoordFlag:
 +
subi.w #$E0,d5
 +
lsl.w #2,d5
 +
jmp coordflagLookup(pc,d5.w)
 +
; End of function CoordFlag
  
sub_72504: ; XREF: sub_71B4C
 
move.b 6(a6),d0
 
beq.s loc_72510
 
subq.b #1,6(a6)
 
rts
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72A64:
loc_72510:
+
coordflagLookup:
subq.b #1,4(a6)
+
bra.w cfPanningAMSFMS ; $E0
beq.w Sound_E4
 
move.b #3,6(a6)
 
lea $70(a6),a5
 
moveq #5,d7
 
 
 
loc_72524:
 
tst.b (a5)
 
bpl.s loc_72538
 
addq.b #1,9(a5)
 
bpl.s loc_72534
 
bclr #7,(a5)
 
bra.s loc_72538
 
 
; ===========================================================================
 
; ===========================================================================
 
+
bra.w cfDetune ; $E1
loc_72534:
+
; ===========================================================================
jsr sub_72CB4(pc)
+
bra.w cfSetCommunication ; $E2
 
+
; ===========================================================================
loc_72538:
+
bra.w cfJumpReturn ; $E3
adda.w #$30,a5
+
; ===========================================================================
dbf d7,loc_72524
+
bra.w cfFadeInToPrevious ; $E4
 
+
; ===========================================================================
moveq #2,d7
+
bra.w cfSetTempoDivider ; $E5
 
+
; ===========================================================================
loc_72542:
+
bra.w cfChangeFMVolume ; $E6
tst.b (a5)
 
bpl.s loc_72560
 
addq.b #1,9(a5)
 
cmpi.b #$10,9(a5)
 
bcs.s loc_72558
 
bclr #7,(a5)
 
bra.s loc_72560
 
 
; ===========================================================================
 
; ===========================================================================
 
+
bra.w cfPreventAttack ; $E7
loc_72558:
 
move.b 9(a5),d6
 
jsr sub_7296A(pc)
 
 
 
loc_72560:
 
adda.w #$30,a5
 
dbf d7,loc_72542
 
 
 
rts
 
; End of function sub_72504
 
 
 
 
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
 
 
 
 
sub_7256A: ; XREF: Sound_E4; sub_725CA
 
moveq #2,d3
 
moveq #$28,d0
 
 
 
loc_7256E:
 
move.b d3,d1
 
jsr sub_7272E(pc)
 
addq.b #4,d1
 
jsr sub_7272E(pc)
 
dbf d3,loc_7256E
 
 
 
moveq #$40,d0
 
moveq #$7F,d1
 
moveq #2,d4
 
 
 
loc_72584:
 
moveq #3,d3
 
 
 
loc_72586:
 
jsr sub_7272E(pc)
 
jsr sub_72764(pc)
 
addq.w #4,d0
 
dbf d3,loc_72586
 
 
 
subi.b #$F,d0
 
dbf d4,loc_72584
 
 
 
rts
 
; End of function sub_7256A
 
 
 
 
; ===========================================================================
 
; ===========================================================================
; ---------------------------------------------------------------------------
+
bra.w cfNoteFill ; $E8
; Stop music
+
; ===========================================================================
; ---------------------------------------------------------------------------
+
bra.w cfChangeTransposition ; $E9
 
 
Sound_E4: ; XREF: Sound_ChkValue; Sound_ExIndex; sub_72504
 
moveq #$2B,d0
 
move.b #$80,d1
 
jsr sub_7272E(pc)
 
moveq #$27,d0
 
moveq #0,d1
 
jsr sub_7272E(pc)
 
movea.l a6,a0
 
move.w #$E3,d0
 
 
 
loc_725B6:
 
clr.l (a0)+
 
dbf d0,loc_725B6
 
 
 
move.b #$80,9(a6) ; set music to $80 (silence)
 
jsr sub_7256A(pc)
 
bra.w sub_729B6
 
 
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
 
 
 
 
sub_725CA: ; XREF: Sound_ChkValue
 
movea.l a6,a0
 
move.b 0(a6),d1
 
move.b $27(a6),d2
 
move.b $2A(a6),d3
 
move.b $26(a6),d4
 
move.w $A(a6),d5
 
move.w #$87,d0
 
 
 
loc_725E4:
 
clr.l (a0)+
 
dbf d0,loc_725E4
 
 
 
move.b d1,0(a6)
 
move.b d2,$27(a6)
 
move.b d3,$2A(a6)
 
move.b d4,$26(a6)
 
move.w d5,$A(a6)
 
move.b #$80,9(a6)
 
jsr sub_7256A(pc)
 
bra.w sub_729B6
 
; End of function sub_725CA
 
 
 
 
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
 
 
 
 
sub_7260C: ; XREF: sub_71B4C
 
move.b 2(a6),1(a6)
 
lea $4E(a6),a0
 
moveq #$30,d0
 
moveq #9,d1
 
 
 
loc_7261A:
 
addq.b #1,(a0)
 
adda.w d0,a0
 
dbf d1,loc_7261A
 
 
 
rts
 
; End of function sub_7260C
 
 
 
 
; ===========================================================================
 
; ===========================================================================
; ---------------------------------------------------------------------------
+
bra.w cfSetTempo ; $EA
; Speed up music
+
; ===========================================================================
; ---------------------------------------------------------------------------
+
bra.w cfSetTempoMod ; $EB
 
+
; ===========================================================================
Sound_E2: ; XREF: Sound_ExIndex
+
bra.w cfChangePSGVolume ; $EC
tst.b $27(a6)
+
; ===========================================================================
bne.s loc_7263E
+
bra.w cfClearPush ; $ED
move.b $29(a6),2(a6)
+
; ===========================================================================
move.b $29(a6),1(a6)
+
bra.w cfStopSpecialFM4 ; $EE
move.b #$80,$2A(a6)
+
; ===========================================================================
rts
+
bra.w cfSetVoice ; $EF
 +
; ===========================================================================
 +
bra.w cfModulation ; $F0
 +
; ===========================================================================
 +
bra.w cfEnableModulation ; $F1
 +
; ===========================================================================
 +
bra.w cfStopTrack ; $F2
 +
; ===========================================================================
 +
bra.w cfSetPSGNoise ; $F3
 +
; ===========================================================================
 +
bra.w cfDisableModulation ; $F4
 +
; ===========================================================================
 +
bra.w cfSetPSGTone ; $F5
 +
; ===========================================================================
 +
bra.w cfJumpTo ; $F6
 +
; ===========================================================================
 +
bra.w cfRepeatAtPos ; $F7
 +
; ===========================================================================
 +
bra.w cfJumpToGosub ; $F8
 +
; ===========================================================================
 +
bra.w cfOpF9 ; $F9
 +
; ===========================================================================
 +
; loc_72ACC:
 +
cfPanningAMSFMS:
 +
move.b (a4)+,d1 ; New AMS/FMS/panning value
 +
tst.b zTrackVoiceControl(a5) ; Is this a PSG track?
 +
bmi.s locret_72AEA ; Return if yes
 +
move.b zTrackAMSFMSPan(a5),d0 ; Get current AMS/FMS/panning
 +
andi.b #$37,d0 ; Retain bits 0-2, 3-4 if set
 +
or.b d0,d1 ; Mask in new value
 +
move.b d1,zTrackAMSFMSPan(a5) ; Store value
 +
move.b #$B4,d0 ; Command to set AMS/FMS/panning
 +
bra.w WriteFMIorIIMain
 
; ===========================================================================
 
; ===========================================================================
  
loc_7263E:
+
locret_72AEA:
move.b $3C9(a6),$3A2(a6)
 
move.b $3C9(a6),$3A1(a6)
 
move.b #$80,$3CA(a6)
 
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
; ---------------------------------------------------------------------------
+
; loc_72AEC: cfAlterNotes:
; Change music back to normal speed
+
cfDetune:
; ---------------------------------------------------------------------------
+
move.b (a4)+,zTrackDetune(a5) ; Set detune value
 
 
Sound_E3: ; XREF: Sound_ExIndex
 
tst.b $27(a6)
 
bne.s loc_7266A
 
move.b $28(a6),2(a6)
 
move.b $28(a6),1(a6)
 
clr.b $2A(a6)
 
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72AF2: cfUnknown1:
loc_7266A:
+
cfSetCommunication:
move.b $3C8(a6),$3A2(a6)
+
move.b (a4)+,v_communication_byte(a6) ; Set otherwise unused communication byte to parameter
move.b $3C8(a6),$3A1(a6)
 
clr.b $3CA(a6)
 
 
rts
 
rts
 
+
; ===========================================================================
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
; loc_72AF8:
 
+
cfJumpReturn:
 
+
moveq #0,d0
sub_7267C: ; XREF: sub_71B4C
+
move.b zTrackStackPointer(a5),d0 ; Track stack pointer
tst.b $25(a6)
+
movea.l (a5,d0.w),a4 ; Set track return address
beq.s loc_72688
+
move.l #0,(a5,d0.w) ; Set 'popped' value to zero
subq.b #1,$25(a6)
+
addq.w #2,a4 ; Skip jump target address from gosub flag
 +
addq.b #4,d0 ; Actually 'pop' value
 +
move.b d0,zTrackStackPointer(a5) ; Set new stack pointer
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_72B14:
 +
cfFadeInToPrevious:
 +
movea.l a6,a0
 +
lea v_1up_ram_copy(a6),a1
 +
move.w #((v_music_track_ram_end-v_startofvariables)/4)-1,d0 ; $220 bytes to restore: all variables and music track data
 +
; loc_72B1E:
 +
.restoreramloop:
 +
move.l (a1)+,(a0)+
 +
dbf d0,.restoreramloop
  
loc_72688:
+
bset #2,v_music_dac_track+zTrackPlaybackControl(a6) ; Set 'SFX overriding' bit
tst.b $26(a6)
+
movea.l a5,a3
beq.s loc_726D6
+
move.b #$28,d6
subq.b #1,$26(a6)
+
sub.b v_fadein_counter(a6),d6 ; If fade already in progress, this adjusts track volume accordingly
move.b #2,$25(a6)
+
moveq #((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7 ; 6 FM tracks
lea $70(a6),a5
+
lea v_music_fm_tracks(a6),a5
moveq #5,d7
+
; loc_72B3A:
 +
.fmloop:
 +
btst #7,zTrackPlaybackControl(a5) ; Is track playing?
 +
beq.s .nextfm ; Branch if not
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
add.b d6,zTrackVolume(a5) ; Apply current volume fade-in
 +
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding?
 +
bne.s .nextfm ; Branch if yes
 +
moveq #0,d0
 +
move.b zTrackVoiceIndex(a5),d0 ; Get voice
 +
movea.l v_voice_ptr(a6),a1 ; Voice pointer
 +
jsr SetVoice(pc)
 +
; loc_72B5C:
 +
.nextfm:
 +
adda.w #zTrackSz,a5
 +
dbf d7,.fmloop
  
loc_7269E:
+
moveq #((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7 ; 3 PSG tracks
tst.b (a5)
+
; loc_72B66:
bpl.s loc_726AA
+
.psgloop:
subq.b #1,9(a5)
+
btst #7,zTrackPlaybackControl(a5) ; Is track playing?
jsr sub_72CB4(pc)
+
beq.s .nextpsg ; Branch if not
 
+
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
loc_726AA:
+
jsr PSGNoteOff(pc)
adda.w #$30,a5
+
add.b d6,zTrackVolume(a5) ; Apply current volume fade-in
dbf d7,loc_7269E
+
; loc_72B78:
moveq #2,d7
+
.nextpsg:
 
+
adda.w #zTrackSz,a5
loc_726B4:
+
dbf d7,.psgloop
tst.b (a5)
+
bpl.s loc_726CC
+
movea.l a3,a5
subq.b #1,9(a5)
+
move.b #$80,f_fadein_flag(a6) ; Trigger fade-in
move.b 9(a5),d6
+
move.b #$28,v_fadein_counter(a6) ; Fade-in delay
cmpi.b #$10,d6
+
clr.b f_1up_playing(a6)
bcs.s loc_726C8
+
startZ80
moveq #$F,d6
+
addq.w #8,sp ; Tamper return value so we don't return to caller
 
+
rts
loc_726C8:
+
; ===========================================================================
jsr sub_7296A(pc)
+
; loc_72B9E:
 
+
cfSetTempoDivider:
loc_726CC:
+
move.b (a4)+,zTrackTempoDivider(a5) ; Set tempo divider on current track
adda.w #$30,a5
 
dbf d7,loc_726B4
 
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72BA4: cfSetVolume:
loc_726D6:
+
cfChangeFMVolume:
bclr #2,$40(a6)
+
move.b (a4)+,d0 ; Get parameter
clr.b $24(a6)
+
add.b d0,zTrackVolume(a5) ; Add to current volume
 +
bra.w SendVoiceTL
 +
; ===========================================================================
 +
; loc_72BAE:
 +
cfPreventAttack:
 +
bset #4,zTrackPlaybackControl(a5) ; Set 'do not attack next note' bit
 
rts
 
rts
; End of function sub_7267C
 
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72BB4:
loc_726E2: ; XREF: sub_71CCA
+
cfNoteFill:
btst #1,(a5)
+
move.b (a4),zTrackNoteFillTimeout(a5) ; Note fill timeout
bne.s locret_726FC
+
move.b (a4)+,zTrackNoteFillMaster(a5) ; Note fill master
btst #2,(a5)
+
rts
bne.s locret_726FC
 
moveq #$28,d0
 
move.b 1(a5),d1
 
ori.b #-$10,d1
 
bra.w sub_7272E
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72BBE: cfAddKey:
locret_726FC:
+
cfChangeTransposition:
 +
move.b (a4)+,d0 ; Get parameter
 +
add.b d0,zTrackTranspose(a5) ; Add to transpose value
 
rts
 
rts
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
 
 
sub_726FE: ; XREF: sub_71CEC; sub_71D9E; Sound_ChkValue; Snd_FadeOut1
 
btst #4,(a5)
 
bne.s locret_72714
 
btst #2,(a5)
 
bne.s locret_72714
 
 
loc_7270A: ; XREF: Snd_FadeOut2
 
moveq #$28,d0
 
move.b 1(a5),d1
 
bra.w sub_7272E
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72BC6:
locret_72714:
+
cfSetTempo:
 +
move.b (a4),v_main_tempo(a6) ; Set main tempo
 +
move.b (a4)+,v_main_tempo_timeout(a6) ; And reset timeout (!)
 
rts
 
rts
; End of function sub_726FE
 
 
 
; ===========================================================================
 
; ===========================================================================
 +
; loc_72BD0:
 +
cfSetTempoMod:
 +
lea v_music_track_ram(a6),a0
 +
move.b (a4)+,d0 ; Get new tempo divider
 +
moveq #zTrackSz,d1
 +
moveq #((v_music_track_ram_end-v_music_track_ram)/zTrackSz)-1,d2 ; 1 DAC + 6 FM + 3 PSG tracks
 +
; loc_72BDA:
 +
.trackloop:
 +
move.b d0,zTrackTempoDivider(a0) ; Set track's tempo divider
 +
adda.w d1,a0
 +
dbf d2,.trackloop
  
loc_72716: ; XREF: sub_72A5A
+
rts
btst #2,(a5)
 
bne.s locret_72720
 
bra.w sub_72722
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72BE6: cfChangeVolume:
locret_72720:
+
cfChangePSGVolume:
 +
move.b (a4)+,d0 ; Get volume change
 +
add.b d0,zTrackVolume(a5) ; Apply it
 
rts
 
rts
 +
; ===========================================================================
 +
; loc_72BEE:
 +
cfClearPush:
 +
clr.b f_push_playing(a6) ; Allow push sound to be played once more
 +
rts
 +
; ===========================================================================
 +
; loc_72BF4:
 +
cfStopSpecialFM4:
 +
bclr #7,zTrackPlaybackControl(a5) ; Stop track
 +
bclr #4,zTrackPlaybackControl(a5) ; Clear 'do not attack next note' bit
 +
jsr FMNoteOff(pc)
 +
tst.b v_sfx_fm4_track(a6) ; Is SFX using FM4?
 +
bmi.s .locexit ; Branch if yes
 +
movea.l a5,a3
 +
lea v_music_fm4_track(a6),a5
 +
movea.l v_voice_ptr(a6),a1 ; Voice pointer
 +
bclr #2,zTrackPlaybackControl(a5) ; Clear 'SFX is overriding' bit
 +
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 +
move.b zTrackVoiceIndex(a5),d0 ; Current voice
 +
jsr SetVoice(pc)
 +
movea.l a3,a5
 +
; loc_72C22:
 +
.locexit:
 +
addq.w #8,sp ; Tamper with return value so we don't return to caller
 +
rts
 +
; ===========================================================================
 +
; loc_72C26:
 +
cfSetVoice:
 +
moveq #0,d0
 +
move.b (a4)+,d0 ; Get new voice
 +
move.b d0,zTrackVoiceIndex(a5) ; Store it
 +
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding this track?
 +
bne.w locret_72CAA ; Return if yes
 +
movea.l v_voice_ptr(a6),a1 ; Music voice pointer
 +
tst.b f_voice_selector(a6) ; Are we updating a music track?
 +
beq.s SetVoice ; If yes, branch
 +
movea.l zTrackVoicePtr(a5),a1 ; SFX track voice pointer
 +
tst.b f_voice_selector(a6) ; Are we updating a SFX track?
 +
bmi.s SetVoice ; If yes, branch
 +
movea.l v_special_voice_ptr(a6),a1 ; Special SFX voice pointer
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 +
; sub_72C4E:
 +
SetVoice:
 +
subq.w #1,d0
 +
bmi.s .havevoiceptr
 +
move.w #25,d1
 +
; loc_72C56:
 +
.voicemultiply:
 +
adda.w d1,a1
 +
dbf d0,.voicemultiply
 +
; loc_72C5C:
 +
.havevoiceptr:
 +
move.b (a1)+,d1 ; feedback/algorithm
 +
move.b d1,zTrackFeedbackAlgo(a5) ; Save it to track RAM
 +
move.b d1,d4
 +
move.b #$B0,d0 ; Command to write feedback/algorithm
 +
jsr WriteFMIorII(pc)
 +
lea FMInstrumentOperatorTable(pc),a2
 +
moveq #(FMInstrumentOperatorTable_End-FMInstrumentOperatorTable)-1,d3 ; Don't want to send TL yet
 +
; loc_72C72:
 +
.sendvoiceloop:
 +
move.b (a2)+,d0
 +
move.b (a1)+,d1
 +
jsr WriteFMIorII(pc)
 +
dbf d3,.sendvoiceloop
  
sub_72722: ; XREF: sub_71E18; sub_72C4E; sub_72CB4
+
moveq #3,d5
btst #2,1(a5)
+
andi.w #7,d4 ; Get algorithm
bne.s loc_7275A
+
move.b FMSlotMask(pc,d4.w),d4 ; Get slot mask for algorithm
add.b 1(a5),d0
+
move.b zTrackVolume(a5),d3 ; Track volume attenuation
; End of function sub_72722
+
; loc_72C8C:
 
+
.sendtlloop:
 
+
move.b (a2)+,d0
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
move.b (a1)+,d1
 
+
lsr.b #1,d4 ; Is bit set for this operator in the mask?
 
+
bcc.s .sendtl ; Branch if not
sub_7272E: ; XREF: loc_71E6A
+
add.b d3,d1 ; Include additional attenuation
move.b ($A04000).l,d2
+
; loc_72C96:
btst #7,d2
+
.sendtl:
bne.s sub_7272E
+
jsr WriteFMIorII(pc)
move.b d0,($A04000).l
+
dbf d5,.sendtlloop
nop
+
nop
+
move.b #$B4,d0 ; Register for AMS/FMS/Panning
nop
+
move.b zTrackAMSFMSPan(a5),d1 ; Value to send
 +
jsr WriteFMIorII(pc) ; (It would be better if this were a jmp)
  
loc_72746:
+
locret_72CAA:
move.b ($A04000).l,d2
 
btst #7,d2
 
bne.s loc_72746
 
 
 
move.b d1,($A04001).l
 
 
rts
 
rts
; End of function sub_7272E
+
; End of function SetVoice
  
 
; ===========================================================================
 
; ===========================================================================
 
+
; byte_72CAC:
loc_7275A: ; XREF: sub_72722
+
FMSlotMask: dc.b 8, 8, 8, 8, $A, $E, $E, $F
move.b 1(a5),d2
 
bclr #2,d2
 
add.b d2,d0
 
  
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  
 
+
; sub_72CB4:
sub_72764: ; XREF: loc_71E6A; Sound_ChkValue; sub_7256A; sub_72764
+
SendVoiceTL:
move.b ($A04000).l,d2
+
btst #2,zTrackPlaybackControl(a5) ; Is SFX overriding?
btst #7,d2
+
bne.s .locret ; Return if so
bne.s sub_72764
+
moveq #0,d0
move.b d0,($A04002).l
+
move.b zTrackVoiceIndex(a5),d0 ; Current voice
nop
+
movea.l v_voice_ptr(a6),a1 ; Voice pointer
nop
+
tst.b f_voice_selector(a6)
nop
+
beq.s .gotvoiceptr
 
+
; DANGER! This uploads the wrong voice! It should have been a5 instead
loc_7277C:
+
; of a6!
move.b ($A04000).l,d2
+
movea.l zTrackVoicePtr(a6),a1
btst #7,d2
+
tst.b f_voice_selector(a6)
bne.s loc_7277C
+
bmi.s .gotvoiceptr
 
+
movea.l v_special_voice_ptr(a6),a1
move.b d1,($A04003).l
+
; loc_72CD8:
rts
+
.gotvoiceptr:
; End of function sub_72764
+
subq.w #1,d0
 +
bmi.s .gotvoice
 +
move.w #25,d1
 +
; loc_72CE0:
 +
.voicemultiply:
 +
adda.w d1,a1
 +
dbf d0,.voicemultiply
 +
; loc_72CE6:
 +
.gotvoice:
 +
adda.w #21,a1 ; Want TL
 +
lea FMInstrumentTLTable(pc),a2
 +
move.b zTrackFeedbackAlgo(a5),d0 ; Get feedback/algorithm
 +
andi.w #7,d0 ; Want only algorithm
 +
move.b FMSlotMask(pc,d0.w),d4 ; Get slot mask
 +
move.b zTrackVolume(a5),d3 ; Get track volume attenuation
 +
bmi.s .locret ; If negative, stop
 +
moveq #(FMInstrumentTLTable_End-FMInstrumentTLTable)-1,d5
 +
; loc_72D02:
 +
.sendtlloop:
 +
move.b (a2)+,d0
 +
move.b (a1)+,d1
 +
lsr.b #1,d4 ; Is bit set for this operator in the mask?
 +
bcc.s .senttl ; Branch if not
 +
add.b d3,d1 ; Include additional attenuation
 +
blo.s .senttl ; Branch on overflow
 +
jsr WriteFMIorII(pc)
 +
; loc_72D12:
 +
.senttl:
 +
dbf d5,.sendtlloop
 +
; locret_72D16:
 +
.locret:
 +
rts
 +
; End of function SendVoiceTL
  
 
; ===========================================================================
 
; ===========================================================================
word_72790: dc.w $25E, $284, $2AB, $2D3, $2FE, $32D, $35C, $38F, $3C5
+
; byte_72D18:
dc.w $3FF, $43C, $47C, $A5E, $A84, $AAB, $AD3, $AFE, $B2D
+
FMInstrumentOperatorTable:
dc.w $B5C, $B8F, $BC5, $BFF, $C3C, $C7C, $125E, $1284
+
dc.$30 ; Detune/multiple operator 1
dc.w $12AB, $12D3, $12FE, $132D, $135C, $138F, $13C5, $13FF
+
dc.b  $38 ; Detune/multiple operator 3
dc.w $143C, $147C, $1A5E, $1A84, $1AAB, $1AD3, $1AFE, $1B2D
+
dc.b  $34 ; Detune/multiple operator 2
dc.w $1B5C, $1B8F, $1BC5, $1BFF, $1C3C, $1C7C, $225E, $2284
+
dc.b  $3C ; Detune/multiple operator 4
dc.w $22AB, $22D3, $22FE, $232D, $235C, $238F, $23C5, $23FF
+
dc.b  $50 ; Rate scalling/attack rate operator 1
dc.w $243C, $247C, $2A5E, $2A84, $2AAB, $2AD3, $2AFE, $2B2D
+
dc.b  $58 ; Rate scalling/attack rate operator 3
dc.w $2B5C, $2B8F, $2BC5, $2BFF, $2C3C, $2C7C, $325E, $3284
+
dc.b  $54 ; Rate scalling/attack rate operator 2
dc.w $32AB, $32D3, $32FE, $332D, $335C, $338F, $33C5, $33FF
+
dc.b  $5C ; Rate scalling/attack rate operator 4
dc.w $343C, $347C, $3A5E, $3A84, $3AAB, $3AD3, $3AFE, $3B2D
+
dc.b  $60 ; Amplitude modulation/first decay rate operator 1
dc.w $3B5C, $3B8F, $3BC5, $3BFF, $3C3C, $3C7C
+
dc.$68 ; Amplitude modulation/first decay rate operator 3
 
+
dc.$64 ; Amplitude modulation/first decay rate operator 2
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
dc.$6C ; Amplitude modulation/first decay rate operator 4
 
+
dc.$70 ; Secondary decay rate operator 1
 
+
dc.$78 ; Secondary decay rate operator 3
sub_72850: ; XREF: sub_71B4C
+
dc.$74 ; Secondary decay rate operator 2
subq.b #1,$E(a5)
+
dc.$7C ; Secondary decay rate operator 4
bne.s loc_72866
+
dc.$80 ; Secondary amplitude/release rate operator 1
bclr #4,(a5)
+
dc.$88 ; Secondary amplitude/release rate operator 3
jsr sub_72878(pc)
+
dc.$84 ; Secondary amplitude/release rate operator 2
jsr sub_728DC(pc)
+
dc.$8C ; Secondary amplitude/release rate operator 4
bra.w loc_7292E
+
FMInstrumentOperatorTable_End
 +
; byte_72D2C:
 +
FMInstrumentTLTable:
 +
dc.b  $40 ; Total level operator 1
 +
dc.b $48 ; Total level operator 3
 +
dc.b  $44 ; Total level operator 2
 +
dc.b  $4C ; Total level operator 4
 +
FMInstrumentTLTable_End
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72D30:
loc_72866:
+
cfModulation:
jsr sub_71D9E(pc)
+
bset #3,zTrackPlaybackControl(a5) ; Turn on modulation
jsr sub_72926(pc)
+
move.l a4,zTrackModulationPtr(a5) ; Save pointer to modulation data
jsr sub_71DC6(pc)
+
move.b (a4)+,zTrackModulationWait(a5) ; Modulation delay
jsr sub_728E2(pc)
+
move.b (a4)+,zTrackModulationSpeed(a5) ; Modulation speed
 +
move.b (a4)+,zTrackModulationDelta(a5) ; Modulation delta
 +
move.b (a4)+,d0 ; Modulation steps...
 +
lsr.b #1,d0 ; ... divided by 2...
 +
move.b d0,zTrackModulationSteps(a5) ; ... before being stored
 +
clr.w zTrackModulationVal(a5) ; Total accumulated modulation frequency change
 
rts
 
rts
; End of function sub_72850
 
 
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
 
 
sub_72878: ; XREF: sub_72850
 
bclr #1,(a5)
 
movea.l 4(a5),a4
 
 
loc_72880:
 
moveq #0,d5
 
move.b (a4)+,d5
 
cmpi.b #$E0,d5
 
bcs.s loc_72890
 
jsr sub_72A5A(pc)
 
bra.s loc_72880
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72D52:
loc_72890:
+
cfEnableModulation:
tst.b d5
+
bset #3,zTrackPlaybackControl(a5) ; Turn on modulation
bpl.s loc_728A4
+
rts
jsr sub_728AC(pc)
 
move.b (a4)+,d5
 
tst.b d5
 
bpl.s loc_728A4
 
subq.w #1,a4
 
bra.w sub_71D60
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72D58:
loc_728A4:
+
cfStopTrack:
jsr sub_71D40(pc)
+
bclr #7,zTrackPlaybackControl(a5) ; Stop track
bra.w sub_71D60
+
bclr #4,zTrackPlaybackControl(a5) ; Clear 'do not attack next note' bit
; End of function sub_72878
+
tst.b zTrackVoiceControl(a5) ; Is this a PSG track?
 
+
bmi.s .stoppsg ; Branch if yes
 
+
tst.b f_updating_dac(a6) ; Is this the DAC we are updating?
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
bmi.w .locexit ; Exit if yes
 
+
jsr FMNoteOff(pc)
 
+
bra.s .stoppedchannel
sub_728AC: ; XREF: sub_72878
 
subi.b #$81,d5
 
bcs.s loc_728CA
 
add.b 8(a5),d5
 
andi.w #$7F,d5
 
lsl.w #1,d5
 
lea word_729CE(pc),a0
 
move.w (a0,d5.w),$10(a5)
 
bra.w sub_71D60
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72D74:
loc_728CA:
+
.stoppsg:
bset #1,(a5)
+
jsr PSGNoteOff(pc)
move.w #-1,$10(a5)
+
; loc_72D78:
jsr sub_71D60(pc)
+
.stoppedchannel:
bra.w sub_729A0
+
tst.b f_voice_selector(a6) ; Are we updating SFX?
; End of function sub_728AC
+
bpl.w .locexit ; Exit if not
 
+
_clr.b v_sndprio(a6) ; Clear priority
 
+
moveq #0,d0
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
move.b zTrackVoiceControl(a5),d0 ; Get voice control bits
 
+
bmi.s .getpsgptr ; Branch if PSG
 
+
lea SFX_BGMChannelRAM(pc),a0
sub_728DC: ; XREF: sub_72850
+
movea.l a5,a3
move.w $10(a5),d6
+
cmpi.b #4,d0 ; Is this FM4?
bmi.s loc_72920
+
bne.s .getpointer ; Branch if not
; End of function sub_728DC
+
tst.b v_spcsfx_fm4_track+zTrackPlaybackControl(a6) ; Is special SFX playing?
 
+
bpl.s .getpointer ; Branch if not
 
+
lea v_spcsfx_fm4_track(a6),a5
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
movea.l v_special_voice_ptr(a6),a1 ; Get voice pointer
 
+
bra.s .gotpointer
 
+
; ===========================================================================
sub_728E2: ; XREF: sub_72850
+
; loc_72DA8:
move.b $1E(a5),d0
+
.getpointer:
ext.w d0
+
subq.b #2,d0 ; SFX can only use FM3 and up
add.w d0,d6
+
lsl.b #2,d0
btst #2,(a5)
+
movea.l (a0,d0.w),a5
bne.s locret_7291E
+
tst.b zTrackPlaybackControl(a5) ; Is track playing?
btst #1,(a5)
+
bpl.s .novoiceupd ; Branch if not
bne.s locret_7291E
+
movea.l v_voice_ptr(a6),a1 ; Get voice pointer
move.b 1(a5),d0
+
; loc_72DB8:
cmpi.b #$E0,d0
+
.gotpointer:
bne.s loc_72904
+
bclr #2,zTrackPlaybackControl(a5) ; Clear 'SFX overriding' bit
move.b #$C0,d0
+
bset #1,zTrackPlaybackControl(a5) ; Set 'track at rest' bit
 
+
move.b zTrackVoiceIndex(a5),d0 ; Current voice
loc_72904:
+
jsr SetVoice(pc)
move.w d6,d1
+
; loc_72DC8:
andi.b #$F,d1
+
.novoiceupd:
or.b d1,d0
+
movea.l a3,a5
lsr.w #4,d6
+
bra.s .locexit
andi.b #$3F,d6
+
; ===========================================================================
move.b d0,($C00011).l
+
; loc_72DCC:
move.b d6,($C00011).l
+
.getpsgptr:
 
+
lea v_spcsfx_psg3_track(a6),a0
locret_7291E:
+
tst.b (a0) ; Is track playing?
 +
bpl.s .getchannelptr ; Branch if not
 +
cmpi.b #$E0,d0 ; Is it the noise channel?
 +
beq.s .gotchannelptr ; Branch if yes
 +
cmpi.b #$C0,d0 ; Is it PSG 3?
 +
beq.s .gotchannelptr ; Branch if yes
 +
; loc_72DE0:
 +
.getchannelptr:
 +
lea SFX_BGMChannelRAM(pc),a0
 +
lsr.b #3,d0
 +
movea.l (a0,d0.w),a0
 +
; loc_72DEA:
 +
.gotchannelptr:
 +
bclr #2,zTrackPlaybackControl(a0) ; Clear 'SFX overriding' bit
 +
bset #1,zTrackPlaybackControl(a0) ; Set 'track at rest' bit
 +
cmpi.b #$E0,zTrackVoiceControl(a0) ; Is this a noise pointer?
 +
bne.s .locexit ; Branch if not
 +
move.b zTrackPSGNoise(a0),(psg_input).l ; Set noise tone
 +
; loc_72E02:
 +
.locexit:
 +
addq.w #8,sp ; Tamper with return value so we don't go back to caller
 +
rts
 +
; ===========================================================================
 +
; loc_72E06:
 +
cfSetPSGNoise:
 +
move.b #$E0,zTrackVoiceControl(a5) ; Turn channel into noise channel
 +
move.b (a4)+,zTrackPSGNoise(a5) ; Save noise tone
 +
btst #2,zTrackPlaybackControl(a5) ; Is track being overridden?
 +
bne.s .locret ; Return if yes
 +
move.b -1(a4),(psg_input).l ; Set tone
 +
; locret_72E1E:
 +
.locret:
 
rts
 
rts
; End of function sub_728E2
 
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72E20:
loc_72920: ; XREF: sub_728DC
+
cfDisableModulation:
bset #1,(a5)
+
bclr #3,zTrackPlaybackControl(a5) ; Disable modulation
 
rts
 
rts
 
+
; ===========================================================================
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
; loc_72E26:
 
+
cfSetPSGTone:
 
+
move.b (a4)+,zTrackVoiceIndex(a5) ; Set current PSG tone
sub_72926: ; XREF: sub_72850
 
tst.b $B(a5)
 
beq.w locret_7298A
 
 
 
loc_7292E: ; XREF: sub_72850
 
move.b 9(a5),d6
 
moveq #0,d0
 
move.b $B(a5),d0
 
beq.s sub_7296A
 
movea.l (Go_PSGIndex).l,a0
 
subq.w #1,d0
 
lsl.w #2,d0
 
movea.l (a0,d0.w),a0
 
move.b $C(a5),d0
 
move.b (a0,d0.w),d0
 
addq.b #1,$C(a5)
 
btst #7,d0
 
beq.s loc_72960
 
cmpi.b #$80,d0
 
beq.s loc_7299A
 
 
 
loc_72960:
 
add.w d0,d6
 
cmpi.b #$10,d6
 
bcs.s sub_7296A
 
moveq #$F,d6
 
; End of function sub_72926
 
 
 
 
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
 
 
 
 
sub_7296A: ; XREF: sub_72504; sub_7267C; sub_72926
 
btst #1,(a5)
 
bne.s locret_7298A
 
btst #2,(a5)
 
bne.s locret_7298A
 
btst #4,(a5)
 
bne.s loc_7298C
 
 
 
loc_7297C:
 
or.b 1(a5),d6
 
addi.b #$10,d6
 
move.b d6,($C00011).l
 
 
 
locret_7298A:
 
 
rts
 
rts
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72E2C:
loc_7298C:
+
cfJumpTo:
tst.b $13(a5)
+
move.b (a4)+,d0 ; High byte of offset
beq.s loc_7297C
+
lsl.w #8,d0 ; Shift it into place
tst.b $12(a5)
+
move.b (a4)+,d0 ; Low byte of offset
bne.s loc_7297C
+
adda.w d0,a4 ; Add to current position
 +
subq.w #1,a4 ; Put back one byte
 
rts
 
rts
; End of function sub_7296A
 
 
 
; ===========================================================================
 
; ===========================================================================
 
+
; loc_72E38:
loc_7299A: ; XREF: sub_72926
+
cfRepeatAtPos:
subq.b #1,$C(a5)
+
moveq #0,d0
 +
move.b (a4)+,d0 ; Loop index
 +
move.b (a4)+,d1 ; Repeat count
 +
tst.b zTrackLoopCounters(a5,d0.w) ; Has this loop already started?
 +
bne.s .loopexists ; Branch if yes
 +
move.b d1,zTrackLoopCounters(a5,d0.w) ; Initialize repeat count
 +
; loc_72E48:
 +
.loopexists:
 +
subq.b #1,zTrackLoopCounters(a5,d0.w) ; Decrease loop's repeat count
 +
bne.s cfJumpTo ; If nonzero, branch to target
 +
addq.w #2,a4 ; Skip target address
 
rts
 
rts
 
+
; ===========================================================================
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
; loc_72E52:
 
+
cfJumpToGosub:
 
+
moveq #0,d0
sub_729A0: ; XREF: sub_71D9E; Sound_ChkValue; Snd_FadeOut1; sub_728AC
+
move.b zTrackStackPointer(a5),d0 ; Current stack pointer
btst #2,(a5)
+
subq.b #4,d0 ; Add space for another target
bne.s locret_729B4
+
move.l a4,(a5,d0.w) ; Put in current address (*before* target for jump!)
 
+
move.b d0,zTrackStackPointer(a5) ; Store new stack pointer
loc_729A6: ; XREF: Snd_FadeOut2
+
bra.s cfJumpTo
move.b 1(a5),d0
+
; ===========================================================================
ori.b #$1F,d0
+
; loc_72E64:
move.b d0,($C00011).l
+
cfOpF9:
 
+
move.b #$88,d0 ; D1L/RR of Operator 3
locret_729B4:
+
move.b #$F,d1 ; Loaded with fixed value (max RR, 1TL)
rts
+
jsr WriteFMI(pc)
; End of function sub_729A0
+
move.b #$8C,d0 ; D1L/RR of Operator 4
 
+
move.b #$F,d1 ; Loaded with fixed value (max RR, 1TL)
 
+
bra.w WriteFMI
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
+
; =====================================
 
 
 
 
sub_729B6: ; XREF: loc_71E7C
 
lea ($C00011).l,a0
 
move.b #$9F,(a0)
 
move.b #$BF,(a0)
 
move.b #$DF,(a0)
 
move.b #$FF,(a0)
 
rts
 
; End of function sub_729B6
 
 
 
; ===========================================================================
 
word_729CE: dc.w $356, $326, $2F9, $2CE, $2A5, $280, $25C, $23A, $21A
 
dc.w $1FB, $1DF, $1C4, $1AB, $193, $17D, $167, $153, $140
 
dc.w $12E, $11D, $10D, $FE, $EF, $E2, $D6, $C9, $BE, $B4
 
dc.w $A9, $A0, $97, $8F, $87, $7F, $78, $71, $6B, $65
 
dc.w $5F, $5A, $55, $50, $4B, $47, $43, $40, $3C, $39
 
dc.w $36, $33, $30, $2D, $2B, $28, $26, $24, $22, $20
 
dc.w $1F, $1D, $1B, $1A, $18, $17, $16, $15, $13, $12
 
dc.w $11, 0
 
 
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
 
 
 
 
sub_72A5A: ; XREF: sub_71C4E; sub_71CEC; sub_72878
 
subi.w #$E0,d5
 
lsl.w #2,d5
 
jmp loc_72A64(pc,d5.w)
 
; End of function sub_72A5A
 
 
 
; ===========================================================================
 
 
 
loc_72A64:
 
bra.w loc_72ACC
 
; ======================================================
 
 
dc.b $CD
 
dc.b $CD
zPtrSpec  Z80BankSwitch
+
zPtrSpec  Z80BankSwitch
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00
Z80_0x06B7:
+
dc.b $21
dc.b $AF,$0E,$06,$32,$19,$1C,$08,$FE,$78
+
z68kPtr  SegaSnd
dc.b $CA,$F5,$06,$FE,$89,$DA,$EF,$06,$F5,$47,$3A,$25,$1C,$90,$C2,$E4
+
dc.b $11,$2F,$5E
dc.b $06,$3E,$80,$32,$26,$1C,$CF,$F1,$4F,$DF,$23,$23,$23,$7E,$32,$31
+
dc.b $3E,$2A,$32,$00,$40,$00,$7E,$32,$01,$40,$3A,$0A,$1C,$FE,$FE
dc.b $1C,$C3,$80,$06,$AF,$32,$26,$1C,$F1,$32,$25,$1C,$C3,$F5,$06,$F5
+
dc.b $28,$0C,$00,$00,$06,$0C,$10,$FE,$23,$1B,$7A,$B3,$20,$E9,$AF,$32
dc.b $AF,$32,$27,$1C,$F1,$CF,$DF,$E5,$E7,$22,$39,$1C,$AF,$32,$15,$1C
+
dc.b $3F,$1C,$21,$0D,$1C,$CD,$D3,$09,$C3,$62,$10,$FF
dc.b $E1,$E5,$FD,$E1,$FD,$7E,$02,$32,$3B,$1C,$11,$04,$00,$19,$FD,$46
+
Z80_0x114C:
dc.b $03,$78,$32,$31,$1C,$C5,$E5,$23,$4E,$CD,$78,$07,$CB,$D6,$DD,$E5
+
dc.b $21,$00,$60
dc.b $3A,$19,$1C,$B7,$28,$03,$E1,$FD,$E5,$D1,$E1,$ED,$A0,$1A,$FE,$02
+
dc.b $77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77
dc.b $CC,$5E,$09,$ED,$A0,$3A,$3B,$1C,$12,$13,$ED,$A0,$ED,$A0,$ED,$A0
+
dc.b $AF,$77
dc.b $ED,$A0,$CD,$AE,$07,$DD,$CB,$00,$7E,$28,$0C,$DD,$7E,$01,$FD,$BE
+
dc.b $C3,$82,$00
dc.b $01,$20,$04,$FD,$CB,$00,$D6,$E5,$2A,$39,$1C,$3A,$19,$1C,$B7,$28
+
Z80BankSwitch0:
dc.b $04,$FD,$E5,$DD,$E1,$DD,$75,$2A,$DD,$74,$2B,$CD,$58,$03,$CD,$6B
+
Z80_0x1170:
dc.b $09,$E1,$C1,$10,$A0,$C3,$80,$06,$CB,$79,$20,$08,$79,$CB,$57,$28
+
dc.b $21,$00,$60
dc.b $1A,$3D,$18,$17,$3E,$1F,$CD,$4D,$10,$3E,$FF,$32,$11,$7F,$79,$CB
+
dc.b $77
dc.b $3F,$CB,$3F,$CB,$3F,$CB,$3F,$CB,$3F,$C6,$02,$D6,$02,$32,$32,$1C
+
dc.b $1F
dc.b $F5,$21,$C8,$07,$DF,$E5,$DD,$E1,$F1,$21,$D8,$07,$DF,$C9,$08,$AF
+
dc.b $77
dc.b $12,$13,$12,$13,$08,$EB,$36,$30,$23,$36,$C0,$23,$36,$01,$06,$24
+
dc.b $1F
dc.b $23,$36,$00,$10,$FB,$23,$EB,$C9,$F0,$1D,$20,$1E,$50,$1E,$80,$1E
+
dc.b $77
dc.b $B0,$1E,$E0,$1E,$10,$1F,$10,$1F,$D0,$1C,$00,$1D,$30,$1D,$40,$1C
+
dc.b $1F
dc.b $60,$1D,$90,$1D,$C0,$1D,$C0,$1D,$21,$10,$1C,$7E,$B7,$C8,$FA,$F9
+
dc.b $77
dc.b $07,$D1,$3D,$C0,$36,$02,$C3,$72,$09,$AF,$77,$3A,$0D,$1C,$B7,$C2
+
dc.b $AF
dc.b $29,$09,$DD,$21,$70,$1C,$06,$06,$3A,$11,$1C,$B7,$20,$06,$DD,$CB
+
dc.b $16,$01
dc.b $00,$7E,$28,$08,$DD,$4E,$0A,$3E,$B4,$CD,$B5,$00,$11,$30,$00,$DD
+
dc.b $72
dc.b $19,$10,$E5,$DD,$21,$40,$1F,$06,$07,$DD,$CB,$00,$7E,$28,$0E,$DD
+
dc.b $77
dc.b $CB,$01,$7E,$20,$08,$DD,$4E,$0A,$3E,$B4,$CD,$B5,$00,$11,$30,$00
+
dc.b $77
dc.b $DD,$19,$10,$E5,$C9,$3E,$28,$32,$0D,$1C,$3E,$06,$32,$0F,$1C,$32
+
dc.b $77
dc.b $0E,$1C,$AF,$32,$40,$1C,$32,$C0,$1D,$32,$60,$1D,$32,$90,$1D,$C3
+
dc.b $77
dc.b $A1,$09,$21,$0D,$1C,$7E,$B7,$C8,$FC,$52,$08,$CB,$BE,$3A,$0F,$1C
+
dc.b $C9
dc.b $3D,$28,$04,$32,$0F,$1C,$C9,$3A,$0E,$1C,$32,$0F,$1C,$3A,$0D,$1C
+
Z80BankSwitch:
dc.b $3D,$32,$0D,$1C,$CA,$29,$09,$3A,$3E,$1C
+
dc.b $21, $00, $60
Z80_0x088A:
+
dc.b $77
dc.b $21,$00,$60
+
dc.b $1F
dc.b $77,$1F,$77,$1F,$77,$1F,$77,$AF,$16,$01,$72,$77,$77,$77,$77
+
dc.b $77
Z80_0x089C:
+
dc.b $1F
dc.b $DD,$21,$40,$1C
+
dc.b $77
dc.b $06,$06,$DD,$34,$06,$F2,$AD,$08,$DD,$35,$06,$18,$11,$DD,$CB,$00
+
dc.b $1F
dc.b $7E,$28,$0B,$DD,$CB,$00,$56,$20,$05,$C5,$CD,$9C,$0C,$C1,$11,$30
+
dc.b $77
dc.b $00,$DD,$19,$10,$DD,$C9,$3A,$29,$1C,$B7,$C8,$3A,$3E,$1C
+
dc.b $1F
Z80_0x08CE:
+
dc.b $77
dc.b $CD
+
dc.b $1F
zPtrSpec  Z80BankSwitch
+
dc.b $77
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+
dc.b $1F
Z80_0x08E0:
+
dc.b $77
dc.b $3A,$0E,$1C,$3D,$32,$0E,$1C,$C0,$3A,$0F,$1C,$32,$0E,$1C,$06,$05
+
dc.b $1F
dc.b $DD,$21,$70,$1C,$11,$30,$00,$DD,$7E,$06,$3D,$DD,$77,$06,$C5,$CD
+
dc.b $77
dc.b $9C,$0C,$C1,$DD,$19,$10,$F0,$3A,$29,$1C,$3D,$32,$29,$1C,$C0,$06
+
dc.b $1F
dc.b $03,$DD,$21,$60,$1D,$11,$30,$00,$DD,$CB,$00,$96,$DD,$19,$10,$F8
+
dc.b $77
dc.b $DD,$21,$40,$1C,$DD,$CB,$00,$96,$C9,$21,$0D,$1C,$11,$0E,$1C,$01
+
dc.b $C9
dc.b $C6,$03,$36,$00,$ED,$B0,$AF,$32,$08,$1C,$DD,$21,$85,$06,$06,$06
+
DriverDataEnd:
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
+
; Filler to align pointers at 1300h in Z80 Ram
dc.b $12,$1C,$4F,$3E,$27,$CD,$C8,$00,$C3,$80,$06,$3E,$90,$0E,$00,$C3
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $EF,$09,$CD,$A1,$09,$C5,$F5,$06,$03,$3E,$B4,$0E,$00,$F5,$CD,$C8
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $00,$F1,$3C,$10,$F8,$06,$02,$3E,$B4,$F5,$CD,$D3,$00,$F1,$3C,$10
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $F8,$0E,$00,$06,$06,$3E,$28,$F5,$CD,$C8,$00,$0C,$F1,$10,$F8,$F1
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $C1,$C5,$06,$04,$3E,$9F,$32,$11,$7F,$C6,$20,$10,$F9,$C1,$C3,$80
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $06,$3A,$24,$1C,$21,$13,$1C,$86,$77,$D0,$21,$4B,$1C,$11,$30,$00
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $06,$09,$34,$19,$10,$FC,$C9,$21,$0A,$1C,$11,$05,$1C,$ED,$A0,$ED
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $A0,$ED,$A0,$AF,$2B,$77,$2B,$77,$2B,$77,$C9,$CD,$EB,$09,$3E,$40
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $0E,$7F,$CD,$EF,$09,$DD,$4E,$01,$C3,$64,$03,$3E,$80,$0E,$FF,$06
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $04,$F5,$CD,$B5,$00,$F1,$C6,$04,$10,$F7,$C9,$CD,$29,$09,$3E,$01
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $32,$3F,$1C,$E1,$C9,$AF,$32,$16,$1C,$3A,$2C,$1C,$32,$24,$1C,$3A
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $2E,$1C,$32,$08,$1C,$2A,$2A,$1C,$22,$37,$1C
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Z80_0x0A1B:
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $3A,$2D,$1C,$32,$3E,$1C
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $CD
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
zPtrSpec   Z80BankSwitch
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Z80_0x0A33:
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $21,$F0,$1D,$11,$40,$1C,$01,$B0,$01,$ED,$B0,$3A,$40
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $1C,$F6,$84,$32,$40,$1C,$DD,$21,$70,$1C,$06,$08,$DD,$7E,$00,$F6
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $84,$DD,$77,$00,$DD,$CB,$01,$7E,$C2,$73,$0A,$DD,$CB,$00,$96,$DD
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $7E,$06,$C6,$40,$DD,$77,$06,$DD,$7E,$08,$C5,$47,$CD,$80,$04,$CD
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $B6,$04,$C1,$11,$30,$00,$DD,$19,$10,$D2,$3E,$40,$32,$29,$1C,$3E
+
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.b $02,$32,$0F,$1C,$32,$0E,$1C,$C9,$FF,$03,$FF,$03,$FF,$03,$FF,$03
+
dc.b 0,0,0,0,0
dc.b $FF,$03,$FF,$03,$FF,$03,$FF,$03,$FF,$03,$F7,$03,$BE,$03,$88,$03
+
DriverPointers:
dc.b $56,$03,$26,$03,$F9,$02,$CE,$02,$A5,$02,$80,$02,$5C,$02,$3A,$02
+
zPtrSpec MusicPointers
dc.b $1A,$02,$FB,$01,$DF,$01,$C4,$01,$AB,$01,$93,$01,$7D,$01,$67,$01
+
zPtrSpec UniversalVoiceBank
dc.b $53,$01,$40,$01,$2E,$01,$1D,$01,$0D,$01,$FE,$00,$EF,$00,$E2,$00
+
zPtrSpec MusicPointers
dc.b $D6,$00,$C9,$00,$BE,$00,$B4,$00,$A9,$00,$A0,$00,$97,$00,$8F,$00
+
zPtrSpec SndPointers
dc.b $87,$00,$7F,$00,$78,$00,$71,$00,$6B,$00,$65,$00,$5F,$00,$5A,$00
+
zPtrSpec PSGNoisePointers
dc.b $55,$00,$50,$00,$4B,$00,$47,$00,$43,$00,$40,$00,$3C,$00,$39,$00
+
zPtrSpec PSGTonePointers
dc.b $36,$00,$33,$00,$30,$00,$2D,$00,$2B,$00,$28,$00,$26,$00,$24,$00
+
dc.w $3300
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
+
;credit goes to Varion Icaria for finding this index
dc.b $84,$02,$AB,$02,$D3,$02,$FE,$02,$2D,$03,$5C,$03,$8F,$03,$C5,$03
+
PSGNoisePointers:
dc.b $FF,$03,$3C,$04,$7C,$04,$C0,$04
+
zPtrSpec PSGN_0
BankSelector:
+
zPtrSpec PSGN_1
dc.b ((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F))
+
zPtrSpec PSGN_2
dc.b ((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F)),((Bank1>>$0F))
+
zPtrSpec PSGN_3
dc.b ((Bank1>>$0F)),((Bank1>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
+
zPtrSpec PSGN_4
dc.b ((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
+
zPtrSpec PSGN_5
dc.b ((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
+
zPtrSpec PSGN_6
dc.b ((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
+
zPtrSpec PSGN_7
dc.b ((Bank2>>$0F)),((Bank1>>$0F)),((Bank2>>$0F)),((Bank2>>$0F))
+
 
dc.b ((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
+
PSGN_1: incbin sound/PSGN1.bin
dc.b ((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
+
PSGN_0: incbin sound/PSGN0.bin
dc.b ((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
+
PSGN_2: incbin sound/PSGN2.bin
dc.b ((Bank2>>$0F)),((Bank3>>$0F)),((Bank3>>$0F)),((Bank3>>$0F))
+
PSGN_3: incbin sound/PSGN3.bin
dc.b ((Bank3>>$0F)),((Bank0>>$0F)),((Bank2>>$0F)),((Bank0>>$0F))
+
PSGN_4: incbin sound/PSGN4.bin
dc.b ((Bank3>>$0F)),((Bank3>>$0F))
+
PSGN_5: incbin sound/PSGN5.bin
dc.b $CD,$37,$03,$C0,$DD,$5E
+
PSGN_6: incbin sound/PSGN6.bin
dc.b $03,$DD,$56,$04,$1A,$13,$FE,$E0,$D2,$C5,$0B,$B7,$FA,$93,$0B,$1B
+
PSGN_7: incbin sound/PSGN7.bin
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
+
;credit goes to Varion Icaria for finding this index
dc.b $0B,$32,$30,$1C,$D1,$1A,$13,$B7,$F2,$05,$03,$1B,$DD,$7E,$0C,$DD
+
PSGTonePointers:
dc.b $77,$0B,$C3,$0B,$03,$21,$CB,$0B,$C3,$D2,$0B,$13,$C3,$84,$0B,$21
+
zPtrSpec PSGT_00
dc.b $DB,$0B,$E5,$D6,$E0,$21,$DF,$0B,$DF,$1A,$E9,$13,$C3,$82,$02,$33
+
zPtrSpec PSGT_01
dc.b $0C,$59,$0C,$5D,$0C,$61,$0C,$67,$0C,$83,$0C,$85,$0C,$BD,$0C,$C3
+
zPtrSpec PSGT_02
dc.b $0C,$47,$0C,$2F,$0C,$CD,$0C,$E3,$0C,$FD,$0C,$03,$0D,$10,$0D,$4F
+
zPtrSpec PSGT_03
dc.b $0D,$5D,$0D,$69,$0D,$11,$0E,$65,$0D,$30,$0E,$39,$0E,$3F,$0E,$56
+
zPtrSpec PSGT_04
dc.b $0E,$70,$0E,$83,$0E,$89,$0E,$90,$0E,$B2,$0E,$C0,$0E,$07,$0F,$0E
+
zPtrSpec PSGT_05
dc.b $0F,$12,$0F,$1A,$0F,$55,$0F,$63,$0F,$72,$0F,$8D,$0F,$96,$0F,$32
+
zPtrSpec PSGT_06
dc.b $30,$1C,$C9,$0E,$3F,$DD,$7E,$0A,$A1,$D5,$EB,$B6,$DD,$77,$0A,$4F
+
zPtrSpec PSGT_07
dc.b $3E,$B4,$CD,$B5,$00,$D1,$C9,$21,$27,$1C,$7E,$DD,$86,$05,$DD,$77
+
zPtrSpec PSGT_08
dc.b $05,$FE,$10,$CA,$57,$0C,$34,$1B,$C9,$DD,$77,$10,$C9,$32,$16,$1C
+
zPtrSpec PSGT_09
dc.b $C9,$CD,$DB,$09,$C3,$69,$0D,$DD,$CB,$01,$7E,$28,$0D,$CB,$3F,$CB
+
zPtrSpec PSGT_0A
dc.b $3F,$CB,$3F,$EE,$0F,$E6,$0F,$C3,$F9,$0C,$EE,$7F,$E6,$7F,$DD,$77
+
zPtrSpec PSGT_0B
dc.b $06,$18,$19,$13,$1A,$DD,$CB,$01,$7E,$C0,$DD,$86,$06,$F2,$99,$0C
+
zPtrSpec PSGT_0C
dc.b $EA,$97,$0C,$AF,$C3,$99,$0C,$3E,$7F,$DD,$77,$06,$D5,$11,$AE,$04
+
zPtrSpec PSGT_0D
dc.b $DD,$6E,$1C,$DD,$66,$1D,$06,$04,$7E,$B7,$F2,$B0,$0C,$DD,$86,$06
+
zPtrSpec PSGT_0E
dc.b $E6,$7F,$4F,$1A,$CD,$B5,$00,$13,$23,$10,$ED,$D1,$C9,$DD,$CB,$00
+
zPtrSpec PSGT_0F
dc.b $CE,$1B,$C9,$CD,$2D,$03,$DD,$77,$1E,$DD,$77,$1F,$C9,$13,$C6,$28
+
zPtrSpec PSGT_10
dc.b $4F,$06,$00,$DD,$E5,$E1,$09,$7E,$3D,$CA,$DE,$0C,$13,$C9,$AF,$77
+
zPtrSpec PSGT_11
dc.b $C3,$39,$0E,$DD,$CB,$01,$7E,$C8,$DD,$CB,$00,$A6,$DD,$35,$17,$DD
+
zPtrSpec PSGT_12
dc.b $86,$06,$FE,$0F,$DA,$F9,$0C,$3E,$0F,$DD,$77,$06,$C9,$D6,$40,$DD
+
zPtrSpec PSGT_13
dc.b $77,$05,$C9,$CD,$0A,$0D,$CD,$C8,$00,$C9,$EB,$7E,$23,$4E,$EB,$C9
+
zPtrSpec PSGT_14
dc.b $DD,$CB,$01,$7E,$20,$30,$CD,$EB,$09,$1A,$DD,$77,$08,$B7,$F2,$3C
+
zPtrSpec PSGT_15
dc.b $0D,$13,$1A,$DD,$77,$0F,$D5,$DD,$7E,$0F,$D6,$81,$0E,$04,$CF,$DF
+
zPtrSpec PSGT_16
dc.b $E7,$DD,$7E,$08,$E6,$7F,$47,$CD,$8F,$04,$18,$05,$D5,$47,$CD,$80
+
zPtrSpec PSGT_17
dc.b $04,$CD,$B6,$04,$D1,$C9,$B7,$F2,$35,$0E,$13,$C3,$35,$0E,$C9,$DD
+
zPtrSpec PSGT_18
dc.b $73,$20,$DD,$72,$21,$DD,$36,$07,$80,$13,$13,$13,$C9,$13,$DD,$CB
+
zPtrSpec PSGT_19
dc.b $01,$7E,$20,$01,$1A,$DD,$77,$07,$C9,$DD,$CB,$00,$BE,$3E,$1F,$32
+
zPtrSpec PSGT_1A
dc.b $15,$1C,$CD,$58,$03,$DD,$4E,$01,$DD,$E5,$CD,$78,$07,$3A,$19,$1C
+
zPtrSpec PSGT_1B
dc.b $B7,$28,$77,$AF,$32,$18,$1C,$E5,$2A,$37,$1C,$DD,$E1,$DD,$CB,$00
+
zPtrSpec PSGT_1C
dc.b $96,$DD,$CB,$01,$7E,$20,$68,$DD,$CB,$00,$7E,$28,$5D,$3E,$02,$DD
+
zPtrSpec PSGT_1D
dc.b $BE,$01,$20,$0D,$3E,$4F,$DD,$CB,$00,$46,$20,$02,$E6,$0F,$CD,$E9
+
zPtrSpec PSGT_1E
dc.b $0E,$DD,$7E,$08,$B7,$F2,$BD,$0D,$CD,$26,$0D,$18,$3A,$47,$E5
+
zPtrSpec PSGT_1F
Z80_0x0DBF:
+
zPtrSpec PSGT_20
dc.b $3A,$3E,$1C
+
zPtrSpec PSGT_21
dc.b $CD
+
zPtrSpec PSGT_22
zPtrSpec  Z80BankSwitch
+
zPtrSpec PSGT_23
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+
zPtrSpec PSGT_24
Z80_0x0DD4:
+
zPtrSpec PSGT_25
dc.b $E1,$CD,$8F,$04,$CD,$B6,$04
+
zPtrSpec PSGT_26
Z80_0x0DDB:
+
 
dc.b $3E,((SndBank>>$0F))
+
PSGT_00: incbin sound/PSGT00.bin
dc.b $CD
+
PSGT_01: incbin sound/PSGT01.bin
zPtrSpec  Z80BankSwitch
+
PSGT_02: incbin sound/PSGT02.bin
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+
PSGT_03: incbin sound/PSGT03.bin
dc.b $DD,$7E,$18,$B7,$F2,$FA
+
PSGT_04: incbin sound/PSGT04.bin
dc.b $0D,$DD,$5E,$19,$DD,$56,$1A,$CD,$7C,$0F,$DD,$E1,$E1,$E1,$C9,$DD
+
PSGT_05: incbin sound/PSGT05.bin
dc.b $CB,$00,$46,$28,$F5,$DD,$7E,$1A,$B7,$F2,$0F,$0E,$32,$11,$7F,$18
+
PSGT_06: incbin sound/PSGT06.bin
dc.b $E9,$DD,$CB,$01,$56,$C0,$3E,$DF,$32,$11,$7F,$1A,$DD,$77,$1A,$DD
+
PSGT_07: incbin sound/PSGT07.bin
dc.b $CB,$00,$C6,$B7,$20,$06,$DD,$CB,$00,$86,$3E,$FF,$32,$11,$7F,$C9
+
PSGT_08: incbin sound/PSGT08.bin
dc.b $DD,$CB,$01,$7E,$C8,$DD,$77,$08,$C9,$EB,$5E,$23,$56,$1B,$C9,$13
+
PSGT_09: incbin sound/PSGT09.bin
dc.b $C6,$28,$4F,$06,$00,$DD,$E5,$E1,$09,$7E,$B7,$20,$02,$1A,$77,$13
+
PSGT_0A: incbin sound/PSGT0A.bin
dc.b $35,$C2,$39,$0E,$13,$C9,$4F,$13,$1A,$47,$C5,$DD,$E5,$E1,$DD,$35
+
PSGT_0B: incbin sound/PSGT0B.bin
dc.b $09,$DD,$4E,$09,$DD,$35,$09,$06,$00,$09,$72,$2B,$73,$D1,$1B,$C9
+
PSGT_0C: incbin sound/PSGT0C.bin
dc.b $DD,$E5,$E1,$DD,$4E,$09,$06,$00,$09,$5E,$23,$56,$DD,$34,$09,$DD
+
PSGT_0D: incbin sound/PSGT0D.bin
dc.b $34,$09,$C9,$DD,$CB,$07,$BE,$1B,$C9,$DD,$86,$05,$DD,$77,$05,$C9
+
PSGT_0E: incbin sound/PSGT0E.bin
dc.b $3A,$26,$1C,$FE,$80,$CA,$A1,$0E,$AF,$32,$25,$1C,$32,$26,$1C,$13
+
PSGT_0F: incbin sound/PSGT0F.bin
dc.b $C9,$3A,$31,$1C,$3D,$32,$31,$1C,$C2,$39,$0E,$AF,$32,$26,$1C,$C3
+
PSGT_10: incbin sound/PSGT10.bin
dc.b $39,$0E,$FE,$01,$20,$05,$DD,$CB,$00,$DE,$C9,$DD,$CB,$00,$9E,$C9
+
PSGT_11: incbin sound/PSGT11.bin
dc.b $DD,$7E,$01,$FE,$02,$20,$2C,$DD,$CB,$00,$C6,$EB,$CD,$73,$02,$06
+
PSGT_12: incbin sound/PSGT12.bin
dc.b $04,$C5,$7E,$23,$E5,$21,$F7,$0E,$87,$4F,$06,$00,$09,$ED,$A0,$ED
+
PSGT_13: incbin sound/PSGT13.bin
dc.b $A0,$E1,$C1,$10,$EC,$EB,$1B,$3E,$4F,$32,$12,$1C,$4F,$3E,$27,$CD
+
PSGT_14: incbin sound/PSGT14.bin
dc.b $C8,$00,$C9,$13,$13,$13,$C9,$00,$00,$32,$01,$8E,$01,$E4,$01,$34
+
PSGT_15: incbin sound/PSGT15.bin
dc.b $02,$7E,$02,$C2,$02,$F0,$02,$21,$1F,$0C,$DF,$13,$1A,$E9,$32,$24
+
PSGT_16: incbin sound/PSGT16.bin
dc.b $1C,$C9,$DD,$E5,$CD,$F8,$04,$DD,$E1,$C9,$32,$11,$1C,$B7,$28,$1D
+
PSGT_17: incbin sound/PSGT17.bin
dc.b $DD,$E5,$D5,$DD,$21,$40,$1C,$06,$09,$11,$30,$00,$DD,$CB,$00,$BE
+
PSGT_18: incbin sound/PSGT18.bin
dc.b $CD,$5E,$03,$DD,$19,$10,$F5,$D1,$DD,$E1,$C3,$A1,$09,$DD,$E5,$D5
+
PSGT_19: incbin sound/PSGT19.bin
dc.b $DD,$21,$40,$1C,$06,$09,$11,$30,$00,$DD,$CB,$00,$FE,$DD,$19,$10
+
PSGT_1A: incbin sound/PSGT1A.bin
dc.b $F8,$D1,$DD,$E1,$C9,$EB,$5E,$23,$56,$23,$4E,$06,$00,$23,$EB,$ED
+
PSGT_1B: incbin sound/PSGT1B.bin
dc.b $B0,$1B,$C9,$06,$09,$21,$42,$1C,$C5,$01,$30,$00,$77,$09,$C1,$10
+
PSGT_1C: incbin sound/PSGT1C.bin
dc.b $F7,$C9,$DD,$36,$18,$80,$DD,$73,$19,$DD,$72,$1A,$21,$B2,$04,$06
+
PSGT_1D: incbin sound/PSGT1D.bin
dc.b $04,$1A,$13,$4F,$7E,$23,$CD,$B5,$00,$10,$F6,$1B,$C9,$DD,$77,$18
+
PSGT_1E: incbin sound/PSGT1E.bin
dc.b $13,$1A,$DD,$77,$19,$C9,$AF,$32,$27,$1C,$1B,$C9,$CD,$37,$03,$20
+
PSGT_1F: incbin sound/PSGT1F.bin
dc.b $0D,$CD,$74,$02,$DD,$CB,$00,$66,$C0,$CD,$9B,$03,$18,$0C,$DD,$7E
+
PSGT_20: incbin sound/PSGT20.bin
dc.b $1E,$B7,$28,$06,$DD,$35,$1E,$CA,$44,$10,$CD,$6C,$04,$CD,$C6,$03
+
PSGT_21: incbin sound/PSGT21.bin
dc.b $DD,$CB,$00,$56,$C0,$DD,$4E,$01,$7D,$E6,$0F,$B1,$32,$11,$7F,$7D
+
PSGT_22: incbin sound/PSGT22.bin
dc.b $E6,$F0,$B4,$0F,$0F,$0F,$0F,$32,$11,$7F,$DD,$7E,$08,$B7,$0E,$00
+
PSGT_23: incbin sound/PSGT23.bin
dc.b $28,$09,$3D,$0E,$0A,$CF,$DF,$CD,$12,$10,$4F,$DD,$CB,$00,$66,$C0
+
PSGT_24: incbin sound/PSGT24.bin
dc.b $DD,$7E,$06,$81,$CB,$67,$28,$02,$3E,$0F,$DD,$B6,$01,$C6,$10,$DD
+
PSGT_25: incbin sound/PSGT25.bin
dc.b $CB,$00,$46,$20,$04,$32,$11,$7F,$C9,$C6,$20,$32,$11,$7F,$C9,$DD
+
PSGT_26: incbin sound/PSGT26.bin
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
+
MusicPointers:
dc.b $CB,$00,$E6,$E1,$C3,$44,$10,$AF,$18,$D5,$E1,$DD,$CB,$00,$E6,$C9
+
z68kPtr Angel_Island_1_Snd
dc.b $DD,$34,$17,$C9,$DD,$CB,$00,$E6,$DD,$CB,$00,$56,$C0,$3E,$1F,$DD
+
z68kPtr Angel_Island_2_Snd
dc.b $86,$01,$B7,$F0,$32,$11,$7F,$DD,$CB,$00,$46,$C8,$3E,$FF,$32,$11
+
z68kPtr Hydrocity_1_Snd
dc.b $7F,$C9,$F3,$3E,$2B,$0E,$00,$CD,$C8,$00,$FB,$3A,$3F,$1C,$B7,$C2
+
z68kPtr Hydrocity_2_Snd
dc.b $FE,$10,$3A,$30,$1C,$B7,$28,$F2,$3E,$2B,$0E,$80,$F3,$CD,$C8,$00
+
z68kPtr Marble_Garden_1_Snd
dc.b $FB,$FD,$21,$EE,$10,$21,$30,$1C,$7E,$3D,$CB,$FE,$21,$00,$80,$DF
+
z68kPtr Marble_Garden_2_Snd
dc.b $0E,$80,$7E,$32,$A3,$10,$32,$C0,$10,$23,$5E,$23,$56,$23,$7E,$23
+
z68kPtr Carnival_Night_1_Snd
dc.b $66,$6F,$06,$0A,$FB,$10,$FE,$F3,$3E,$2A,$32,$00,$40,$7E,$07,$07
+
z68kPtr Carnival_Night_2_Snd
dc.b $07,$07,$E6,$0F,$32,$BA,$10,$79,$FD,$86,$00,$32,$01,$40,$4F,$06
+
z68kPtr Flying_Battery_1_Snd
dc.b $0A,$FB,$10,$FE,$F3,$3E,$2A,$32,$00,$40,$7E,$E6,$0F,$32,$D3,$10
+
z68kPtr Flying_Battery_2_Snd
dc.b $79,$FD,$86,$00,$32,$01,$40,$FB,$4F,$3A,$30,$1C,$B7,$F2,$6A,$10
+
z68kPtr Icecap_1_Snd
dc.b $23,$1B,$7A,$B3,$C2,$A2,$10,$AF,$32,$30,$1C,$C3,$62,$10,$00,$01
+
z68kPtr Icecap_2_Snd
dc.b $02,$04,$08,$10,$20,$40,$80,$FF,$FE,$FC,$F8,$F0,$E0,$C0,$F3,$CD
+
z68kPtr Launch_Base_1_Snd
dc.b $C7,$09,$3E,$2B,$32,$00,$40,$00,$3E,$80,$32,$01,$40
+
z68kPtr Launch_Base_2_Snd
Z80_0x110D:
+
z68kPtr Mushroom_Hill_1_Snd
dc.b $3E,((SegaPCMBank>>$0F))
+
z68kPtr Mushroom_Hill_2_Snd
dc.b $CD
+
z68kPtr Sandopolis_1_Snd
zPtrSpec  Z80BankSwitch
+
z68kPtr Sandopolis_2_Snd
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00
+
z68kPtr Lava_Reef_1_Snd
dc.b $21
+
z68kPtr Lava_Reef_2_Snd
z68kPtr  SegaSnd
+
z68kPtr Sky_Sanctuary_Snd
dc.b $11,$2F,$5E
+
z68kPtr Death_Egg_1_Snd
dc.b $3E,$2A,$32,$00,$40,$00,$7E,$32,$01,$40,$3A,$0A,$1C,$FE,$FE
+
z68kPtr Death_Egg_2_Snd
dc.b $28,$0C,$00,$00,$06,$0C,$10,$FE,$23,$1B,$7A,$B3,$20,$E9,$AF,$32
+
z68kPtr Mini_Boss_SK_Snd
dc.b $3F,$1C,$21,$0D,$1C,$CD,$D3,$09,$C3,$62,$10,$FF
+
z68kPtr Boss_Snd
Z80_0x114C:
+
z68kPtr The_Doomsday_Snd
dc.b $21,$00,$60
+
z68kPtr Glowing_Spheres_Bonus_Stage_snd
dc.b $77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77,$0F,$77
+
z68kPtr Special_Stage_Snd
dc.b $AF,$77
+
z68kPtr Slot_Machine_Bonus_Stage_snd
dc.b $C3,$82,$00
+
z68kPtr Gum_Ball_Machine_Bonus_Stage_snd
Z80BankSwitch0:
+
z68kPtr Knuckles_Theme_Snd
Z80_0x1170:
+
z68kPtr Azure_Lake_Snd
dc.b $21,$00,$60
+
z68kPtr Balloon_Park_Snd
dc.b $77
+
z68kPtr Desert_Palace_Snd
dc.b $1F
+
z68kPtr Chrome_Gadget_Snd
dc.b $77
+
z68kPtr Endless_Mine_Snd
dc.b $1F
+
z68kPtr Title_Screen_Snd
dc.b $77
+
z68kPtr Credits_Snd
dc.b $1F
+
z68kPtr Time_Game_Over_Snd
dc.b $77
+
z68kPtr Continue_Sound
dc.b $AF
+
z68kPtr Level_Results_Snd
dc.b $16,$01
+
z68kPtr Extra_Life_Snd
dc.b $72
+
z68kPtr Emerald_Snd
dc.b $77
+
z68kPtr Invincibility_Snd
dc.b $77
+
z68kPtr Competition_Menu_Snd
dc.b $77
+
z68kPtr Mini_Boss_Snd
dc.b $77
+
z68kPtr Menu_Snd
dc.b $C9
+
z68kPtr Final_Boss_Snd
Z80BankSwitch:
+
z68kPtr Underwater_Timming_Snd
dc.b $21, $00, $60
+
z68kPtr Presented_by_SEGA_Snd
dc.b $77
+
 
dc.b $1F
+
SndPointers:
dc.b $77
+
z68kPtr Sfx_34_Snd
dc.b $1F
+
z68kPtr Sfx_35_Snd
dc.b $77
+
z68kPtr Sfx_36_Snd
dc.b $1F
+
z68kPtr Sfx_37_Snd
dc.b $77
+
z68kPtr Sfx_38_Snd
dc.b $1F
+
z68kPtr Sfx_39_Snd
dc.b $77
+
z68kPtr Sfx_3A_Snd
dc.b $1F
+
z68kPtr Sfx_3B_Snd
dc.b $77
+
z68kPtr Sfx_3C_Snd
dc.b $1F
+
z68kPtr Sfx_3D_Snd
dc.b $77
+
z68kPtr Sfx_3E_Snd
dc.b $1F
+
z68kPtr Sfx_3F_Snd
dc.b $77
+
z68kPtr Sfx_40_Snd
dc.b $1F
+
z68kPtr Sfx_41_Snd
dc.b $77
+
z68kPtr Sfx_42_Snd
dc.b $C9
+
z68kPtr Sfx_43_Snd
DriverDataEnd:
+
z68kPtr Sfx_44_Snd
;-------------------------------------------------------------------------------
+
z68kPtr Sfx_45_Snd
; Filler to align pointers at 1300h in Z80 Ram
+
z68kPtr Sfx_46_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_47_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_48_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_49_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_4A_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_4B_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_4C_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_4D_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_4E_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_4F_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_50_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_51_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_52_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_53_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_54_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_55_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_56_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_57_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_58_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_59_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_5A_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_5B_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_5C_Snd
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
z68kPtr Sfx_5D_Snd
dc.b 0,0,0,0,0
+
z68kPtr Sfx_5E_Snd
DriverPointers:
+
z68kPtr Sfx_5F_Snd
zPtrSpec MusicPointers
+
z68kPtr Sfx_60_Snd
zPtrSpec UniversalVoiceBank
+
z68kPtr Sfx_61_Snd
zPtrSpec MusicPointers
+
z68kPtr Sfx_62_Snd
zPtrSpec SndPointers
+
z68kPtr Sfx_63_Snd
zPtrSpec PSGNoisePointers
+
z68kPtr Sfx_64_Snd
zPtrSpec PSGTonePointers
+
z68kPtr Sfx_65_Snd
dc.w $3300
+
z68kPtr Sfx_66_Snd
 
+
z68kPtr Sfx_67_Snd
;credit goes to Varion Icaria for finding this index
+
z68kPtr Sfx_68_Snd
PSGNoisePointers:
+
z68kPtr Sfx_69_Snd
zPtrSpec PSGN_0
+
z68kPtr Sfx_6A_Snd
zPtrSpec PSGN_1
+
z68kPtr Sfx_6B_Snd
zPtrSpec PSGN_2
+
z68kPtr Sfx_6C_Snd
zPtrSpec PSGN_3
+
z68kPtr Sfx_6D_Snd
zPtrSpec PSGN_4
+
z68kPtr Sfx_6E_Snd
zPtrSpec PSGN_5
+
z68kPtr Sfx_6F_Snd
zPtrSpec PSGN_6
+
z68kPtr Sfx_70_Snd
zPtrSpec PSGN_7
+
z68kPtr Sfx_71_Snd
 
+
z68kPtr Sfx_72_Snd
PSGN_1: incbin sound/PSGN1.bin
+
z68kPtr Sfx_73_Snd
PSGN_0: incbin sound/PSGN0.bin
+
z68kPtr Sfx_74_Snd
PSGN_2: incbin sound/PSGN2.bin
+
z68kPtr Sfx_75_Snd
PSGN_3: incbin sound/PSGN3.bin
+
z68kPtr Sfx_76_Snd
PSGN_4: incbin sound/PSGN4.bin
+
z68kPtr Sfx_77_Snd
PSGN_5: incbin sound/PSGN5.bin
+
z68kPtr Sfx_78_Snd
PSGN_6: incbin sound/PSGN6.bin
+
z68kPtr Sfx_79_Snd
PSGN_7: incbin sound/PSGN7.bin
+
z68kPtr Sfx_7A_Snd
 
+
z68kPtr Sfx_7B_Snd
;credit goes to Varion Icaria for finding this index
+
z68kPtr Sfx_7C_Snd
PSGTonePointers:
+
z68kPtr Sfx_7D_Snd
zPtrSpec PSGT_00
+
z68kPtr Sfx_7E_Snd
zPtrSpec PSGT_01
+
z68kPtr Sfx_7F_Snd
zPtrSpec PSGT_02
+
z68kPtr Sfx_80_Snd
zPtrSpec PSGT_03
+
z68kPtr Sfx_81_Snd
zPtrSpec PSGT_04
+
z68kPtr Sfx_82_Snd
zPtrSpec PSGT_05
+
z68kPtr Sfx_83_Snd
zPtrSpec PSGT_06
+
z68kPtr Sfx_84_Snd
zPtrSpec PSGT_07
+
z68kPtr Sfx_85_Snd
zPtrSpec PSGT_08
+
z68kPtr Sfx_86_Snd
zPtrSpec PSGT_09
+
z68kPtr Sfx_87_Snd
zPtrSpec PSGT_0A
+
z68kPtr Sfx_88_Snd
zPtrSpec PSGT_0B
+
z68kPtr Sfx_89_Snd
zPtrSpec PSGT_0C
+
z68kPtr Sfx_8A_Snd
zPtrSpec PSGT_0D
+
z68kPtr Sfx_8B_Snd
zPtrSpec PSGT_0E
+
z68kPtr Sfx_8C_Snd
zPtrSpec PSGT_0F
+
z68kPtr Sfx_8D_Snd
zPtrSpec PSGT_10
+
z68kPtr Sfx_8E_Snd
zPtrSpec PSGT_11
+
z68kPtr Sfx_8F_Snd
zPtrSpec PSGT_12
+
z68kPtr Sfx_90_Snd
zPtrSpec PSGT_13
+
z68kPtr Sfx_91_Snd
zPtrSpec PSGT_14
+
z68kPtr Sfx_92_Snd
zPtrSpec PSGT_15
+
z68kPtr Sfx_93_Snd
zPtrSpec PSGT_16
+
z68kPtr Sfx_94_Snd
zPtrSpec PSGT_17
+
z68kPtr Sfx_95_Snd
zPtrSpec PSGT_18
+
z68kPtr Sfx_96_Snd
zPtrSpec PSGT_19
+
z68kPtr Sfx_97_Snd
zPtrSpec PSGT_1A
+
z68kPtr Sfx_98_Snd
zPtrSpec PSGT_1B
+
z68kPtr Sfx_99_Snd
zPtrSpec PSGT_1C
+
z68kPtr Sfx_9A_Snd
zPtrSpec PSGT_1D
+
z68kPtr Sfx_9B_Snd
zPtrSpec PSGT_1E
+
z68kPtr Sfx_9C_Snd
zPtrSpec PSGT_1F
+
z68kPtr Sfx_9D_Snd
zPtrSpec PSGT_20
+
z68kPtr Sfx_9E_Snd
zPtrSpec PSGT_21
+
z68kPtr Sfx_9F_Snd
zPtrSpec PSGT_22
+
z68kPtr Sfx_A0_Snd
zPtrSpec PSGT_23
+
z68kPtr Sfx_A1_Snd
zPtrSpec PSGT_24
+
z68kPtr Sfx_A2_Snd
zPtrSpec PSGT_25
+
z68kPtr Sfx_A3_Snd
zPtrSpec PSGT_26
+
z68kPtr Sfx_A4_Snd
 
+
z68kPtr Sfx_A5_Snd
PSGT_00: incbin sound/PSGT00.bin
+
z68kPtr Sfx_A6_Snd
PSGT_01: incbin sound/PSGT01.bin
+
z68kPtr Sfx_A7_Snd
PSGT_02: incbin sound/PSGT02.bin
+
z68kPtr Sfx_A8_Snd
PSGT_03: incbin sound/PSGT03.bin
+
z68kPtr Sfx_A9_Snd
PSGT_04: incbin sound/PSGT04.bin
+
z68kPtr Sfx_AA_Snd
PSGT_05: incbin sound/PSGT05.bin
+
z68kPtr Sfx_AB_Snd
PSGT_06: incbin sound/PSGT06.bin
+
z68kPtr Sfx_AC_Snd
PSGT_07: incbin sound/PSGT07.bin
+
z68kPtr Sfx_AD_Snd
PSGT_08: incbin sound/PSGT08.bin
+
z68kPtr Sfx_AE_Snd
PSGT_09: incbin sound/PSGT09.bin
+
z68kPtr Sfx_AF_Snd
PSGT_0A: incbin sound/PSGT0A.bin
+
z68kPtr Sfx_B0_Snd
PSGT_0B: incbin sound/PSGT0B.bin
+
z68kPtr Sfx_B1_Snd
PSGT_0C: incbin sound/PSGT0C.bin
+
z68kPtr Sfx_B2_Snd
PSGT_0D: incbin sound/PSGT0D.bin
+
z68kPtr Sfx_B3_Snd
PSGT_0E: incbin sound/PSGT0E.bin
+
z68kPtr Sfx_B4_Snd
PSGT_0F: incbin sound/PSGT0F.bin
+
z68kPtr Sfx_B5_Snd
PSGT_10: incbin sound/PSGT10.bin
+
z68kPtr Sfx_B6_Snd
PSGT_11: incbin sound/PSGT11.bin
+
z68kPtr Sfx_B7_Snd
PSGT_12: incbin sound/PSGT12.bin
+
z68kPtr Sfx_B8_Snd
PSGT_13: incbin sound/PSGT13.bin
+
z68kPtr Sfx_B9_Snd
PSGT_14: incbin sound/PSGT14.bin
+
z68kPtr Sfx_BA_Snd
PSGT_15: incbin sound/PSGT15.bin
+
z68kPtr Sfx_BB_Snd
PSGT_16: incbin sound/PSGT16.bin
+
z68kPtr Sfx_BC_Snd
PSGT_17: incbin sound/PSGT17.bin
+
z68kPtr Sfx_BD_Snd
PSGT_18: incbin sound/PSGT18.bin
+
z68kPtr Sfx_BE_Snd
PSGT_19: incbin sound/PSGT19.bin
+
z68kPtr Sfx_BF_Snd
PSGT_1A: incbin sound/PSGT1A.bin
+
z68kPtr Sfx_C0_Snd
PSGT_1B: incbin sound/PSGT1B.bin
+
z68kPtr Sfx_C1_Snd
PSGT_1C: incbin sound/PSGT1C.bin
+
z68kPtr Sfx_C2_Snd
PSGT_1D: incbin sound/PSGT1D.bin
+
z68kPtr Sfx_C3_Snd
PSGT_1E: incbin sound/PSGT1E.bin
+
z68kPtr Sfx_C4_Snd
PSGT_1F: incbin sound/PSGT1F.bin
+
z68kPtr Sfx_C5_Snd
PSGT_20: incbin sound/PSGT20.bin
+
z68kPtr Sfx_C6_Snd
PSGT_21: incbin sound/PSGT21.bin
+
z68kPtr Sfx_C7_Snd
PSGT_22: incbin sound/PSGT22.bin
+
z68kPtr Sfx_C8_Snd
PSGT_23: incbin sound/PSGT23.bin
+
z68kPtr Sfx_C9_Snd
PSGT_24: incbin sound/PSGT24.bin
+
z68kPtr Sfx_CA_Snd
PSGT_25: incbin sound/PSGT25.bin
+
z68kPtr Sfx_CB_Snd
PSGT_26: incbin sound/PSGT26.bin
+
z68kPtr Sfx_CC_Snd
 +
z68kPtr Sfx_CD_Snd
 +
z68kPtr Sfx_CE_Snd
 +
z68kPtr Sfx_CF_Snd
 +
z68kPtr Sfx_D0_Snd
 +
z68kPtr Sfx_D1_Snd
 +
z68kPtr Sfx_D2_Snd
 +
z68kPtr Sfx_D3_Snd
 +
z68kPtr Sfx_D4_Snd
 +
z68kPtr Sfx_D5_Snd
 +
z68kPtr Sfx_D6_Snd
 +
z68kPtr Sfx_D7_Snd
 +
z68kPtr Sfx_D8_Snd
 +
z68kPtr Sfx_D9_Snd
 +
z68kPtr Sfx_DA_Snd
 +
z68kPtr Sfx_DB_Snd
 +
z68kPtr Sfx_DC_Snd
 +
z68kPtr Sfx_DC_Snd
 +
z68kPtr Sfx_DC_Snd
 +
z68kPtr Sfx_DC_Snd
 +
z68kPtr Sfx_DC_Snd
 +
DriverPointersEnd:
  
MusicPointers:
+
UniversalVoiceBank:
z68kPtr Angel_Island_1_Snd
+
incbin "sound/uvb.bin"
z68kPtr Angel_Island_2_Snd
+
UniversalVoiceBankEnd:
z68kPtr Hydrocity_1_Snd
+
align $8000
z68kPtr Hydrocity_2_Snd
+
 
z68kPtr Marble_Garden_1_Snd
+
DacBank0:
z68kPtr Marble_Garden_2_Snd
+
incbin "sound/dac_0.bin"
z68kPtr Carnival_Night_1_Snd
+
 
z68kPtr Carnival_Night_2_Snd
+
align $8000
z68kPtr Flying_Battery_1_Snd
+
DacBank1:
z68kPtr Flying_Battery_2_Snd
+
incbin "sound/dac_1.bin"
z68kPtr Icecap_1_Snd
+
align $8000
z68kPtr Icecap_2_Snd
+
 
z68kPtr Launch_Base_1_Snd
+
DacBank2:
z68kPtr Launch_Base_2_Snd
+
incbin "sound/dac_2.bin"
z68kPtr Mushroom_Hill_1_Snd
+
align $8000
z68kPtr Mushroom_Hill_2_Snd
+
 
z68kPtr Sandopolis_1_Snd
+
Bank0:
z68kPtr Sandopolis_2_Snd
+
incbin "sound/filler.bin"
z68kPtr Lava_Reef_1_Snd
+
Mini_Boss_Snd:
z68kPtr Lava_Reef_2_Snd
+
incbin "sound/miniboss.snd"
z68kPtr Sky_Sanctuary_Snd
+
Final_Boss_Snd:
z68kPtr Death_Egg_1_Snd
+
incbin "sound/f_boss.snd"
z68kPtr Death_Egg_2_Snd
+
align $8000
z68kPtr Mini_Boss_SK_Snd
+
 
z68kPtr Boss_Snd
+
Bank1:
z68kPtr The_Doomsday_Snd
+
Angel_Island_1_Snd:
z68kPtr Glowing_Spheres_Bonus_Stage_snd
+
incbin "sound/aiz1.snd"
z68kPtr Special_Stage_Snd
+
Angel_Island_2_Snd:
z68kPtr Slot_Machine_Bonus_Stage_snd
+
incbin "sound/aiz2.snd"
z68kPtr Gum_Ball_Machine_Bonus_Stage_snd
+
Hydrocity_1_Snd:
z68kPtr Knuckles_Theme_Snd
+
incbin "sound/hcz1.snd"
z68kPtr Azure_Lake_Snd
+
Hydrocity_2_Snd:
z68kPtr Balloon_Park_Snd
+
incbin "sound/hcz2.snd"
z68kPtr Desert_Palace_Snd
+
Marble_Garden_1_Snd:
z68kPtr Chrome_Gadget_Snd
+
incbin "sound/mgz1.snd"
z68kPtr Endless_Mine_Snd
+
Marble_Garden_2_Snd:
z68kPtr Title_Screen_Snd
+
incbin "sound/mgz2.snd"
z68kPtr Credits_Snd
+
Carnival_Night_2_Snd:
z68kPtr Time_Game_Over_Snd
+
incbin "sound/cnz2.snd"
z68kPtr Continue_Sound
+
Carnival_Night_1_Snd:
z68kPtr Level_Results_Snd
+
incbin "sound/cnz1.snd"
z68kPtr Extra_Life_Snd
+
Flying_Battery_1_Snd:
z68kPtr Emerald_Snd
+
incbin "sound/fbz1.snd"
z68kPtr Invincibility_Snd
+
Flying_Battery_2_Snd:
z68kPtr Competition_Menu_Snd
+
incbin "sound/fbz2.snd"
z68kPtr Mini_Boss_Snd
+
The_Doomsday_Snd:
z68kPtr Menu_Snd
+
incbin "sound/tdz.snd"
z68kPtr Final_Boss_Snd
+
align $8000
z68kPtr Underwater_Timming_Snd
 
z68kPtr Presented_by_SEGA_Snd
 
  
SndPointers:
+
Bank2:
z68kPtr Sfx_34_Snd
+
Icecap_2_Snd:
z68kPtr Sfx_35_Snd
+
incbin "sound/iz2.snd"
z68kPtr Sfx_36_Snd
+
Icecap_1_Snd:
z68kPtr Sfx_37_Snd
+
incbin "sound/iz1.snd"
z68kPtr Sfx_38_Snd
+
Launch_Base_2_Snd:
z68kPtr Sfx_39_Snd
+
incbin "sound/lbz2.snd"
z68kPtr Sfx_3A_Snd
+
Launch_Base_1_Snd:
z68kPtr Sfx_3B_Snd
+
incbin "sound/lbz1.snd"
z68kPtr Sfx_3C_Snd
+
Mushroom_Hill_1_Snd:
z68kPtr Sfx_3D_Snd
+
incbin "sound/mhz1.snd"
z68kPtr Sfx_3E_Snd
+
Mushroom_Hill_2_Snd:
z68kPtr Sfx_3F_Snd
+
incbin "sound/mhz2.snd"
z68kPtr Sfx_40_Snd
+
Sandopolis_1_Snd:
z68kPtr Sfx_41_Snd
+
incbin "sound/sz1.snd"
z68kPtr Sfx_42_Snd
+
Sandopolis_2_Snd:
z68kPtr Sfx_43_Snd
+
incbin "sound/sz2.snd"
z68kPtr Sfx_44_Snd
+
Lava_Reef_1_Snd:
z68kPtr Sfx_45_Snd
+
incbin "sound/lrz1.snd"
z68kPtr Sfx_46_Snd
+
Lava_Reef_2_Snd:
z68kPtr Sfx_47_Snd
+
incbin "sound/lrz2.snd"
z68kPtr Sfx_48_Snd
+
Sky_Sanctuary_Snd:
z68kPtr Sfx_49_Snd
+
incbin "sound/scz.snd"
z68kPtr Sfx_4A_Snd
+
Death_Egg_1_Snd:
z68kPtr Sfx_4B_Snd
+
incbin "sound/dez1.snd"
z68kPtr Sfx_4C_Snd
+
Death_Egg_2_Snd:
z68kPtr Sfx_4D_Snd
+
incbin "sound/dez2.snd"
z68kPtr Sfx_4E_Snd
+
Mini_Boss_SK_Snd:
z68kPtr Sfx_4F_Snd
+
incbin "sound/mb_sk.snd"
z68kPtr Sfx_50_Snd
+
Boss_Snd:
z68kPtr Sfx_51_Snd
+
incbin "sound/boss.snd"
z68kPtr Sfx_52_Snd
+
Glowing_Spheres_Bonus_Stage_snd:
z68kPtr Sfx_53_Snd
+
incbin "sound/gs_bs.snd"
z68kPtr Sfx_54_Snd
+
Special_Stage_Snd:
z68kPtr Sfx_55_Snd
+
incbin "sound/ss.snd"
z68kPtr Sfx_56_Snd
+
Level_Results_Snd:
z68kPtr Sfx_57_Snd
+
incbin "sound/lr.snd"
z68kPtr Sfx_58_Snd
+
Menu_Snd:
z68kPtr Sfx_59_Snd
+
incbin "sound/menu.snd"
z68kPtr Sfx_5A_Snd
+
align $8000
z68kPtr Sfx_5B_Snd
+
 
z68kPtr Sfx_5C_Snd
+
Bank3:
z68kPtr Sfx_5D_Snd
+
Slot_Machine_Bonus_Stage_snd:
z68kPtr Sfx_5E_Snd
+
incbin "sound/sm_bs.snd"
z68kPtr Sfx_5F_Snd
+
Gum_Ball_Machine_Bonus_Stage_snd:
z68kPtr Sfx_60_Snd
+
incbin "sound/gbm_bs.snd"
z68kPtr Sfx_61_Snd
+
Knuckles_Theme_Snd:
z68kPtr Sfx_62_Snd
+
incbin "sound/kte.snd"
z68kPtr Sfx_63_Snd
+
Azure_Lake_Snd:
z68kPtr Sfx_64_Snd
+
incbin "sound/alz.snd"
z68kPtr Sfx_65_Snd
+
Balloon_Park_Snd:
z68kPtr Sfx_66_Snd
+
incbin "sound/bpz.snd"
z68kPtr Sfx_67_Snd
+
Desert_Palace_Snd:
z68kPtr Sfx_68_Snd
+
incbin "sound/dpz.snd"
z68kPtr Sfx_69_Snd
+
Chrome_Gadget_Snd:
z68kPtr Sfx_6A_Snd
+
incbin "sound/cgz.snd"
z68kPtr Sfx_6B_Snd
+
Endless_Mine_Snd:
z68kPtr Sfx_6C_Snd
+
incbin "sound/emz.snd"
z68kPtr Sfx_6D_Snd
+
Title_Screen_Snd:
z68kPtr Sfx_6E_Snd
+
incbin "sound/ts.snd"
z68kPtr Sfx_6F_Snd
+
Credits_Snd:
z68kPtr Sfx_70_Snd
+
incbin "sound/credits.snd"
z68kPtr Sfx_71_Snd
+
Time_Game_Over_Snd:
z68kPtr Sfx_72_Snd
+
incbin "sound/tgovr.snd"
z68kPtr Sfx_73_Snd
+
Continue_Snd:
z68kPtr Sfx_74_Snd
+
incbin "sound/continue.snd"
z68kPtr Sfx_75_Snd
+
Extra_Life_Snd:
z68kPtr Sfx_76_Snd
+
incbin "sound/1up.snd"
z68kPtr Sfx_77_Snd
+
Emerald_Snd:
z68kPtr Sfx_78_Snd
+
incbin "sound/emerald.snd"
z68kPtr Sfx_79_Snd
+
Invincibility_Snd:
z68kPtr Sfx_7A_Snd
+
incbin "sound/invcblty.snd"
z68kPtr Sfx_7B_Snd
+
Competition_Menu_Snd:
z68kPtr Sfx_7C_Snd
+
incbin "sound/2p_menu.snd"
z68kPtr Sfx_7D_Snd
+
Underwater_Timming_Snd:
z68kPtr Sfx_7E_Snd
+
incbin "sound/panic.snd"
z68kPtr Sfx_7F_Snd
+
Presented_by_SEGA_Snd:
z68kPtr Sfx_80_Snd
+
incbin "sound/p_sega.snd"
z68kPtr Sfx_81_Snd
+
align $8000
z68kPtr Sfx_82_Snd
+
 
z68kPtr Sfx_83_Snd
+
SndBank:
z68kPtr Sfx_84_Snd
+
SegaPCMBank:
z68kPtr Sfx_85_Snd
+
SegaSnd:
z68kPtr Sfx_86_Snd
+
incbin "sound/sega.snd"
z68kPtr Sfx_87_Snd
+
Sfx_34_Snd:
z68kPtr Sfx_88_Snd
+
incbin "sound/sfx_34.snd"
z68kPtr Sfx_89_Snd
+
Sfx_35_Snd:
z68kPtr Sfx_8A_Snd
+
incbin "sound/sfx_35.snd"
z68kPtr Sfx_8B_Snd
+
Sfx_36_Snd:
z68kPtr Sfx_8C_Snd
+
incbin "sound/sfx_36.snd"
z68kPtr Sfx_8D_Snd
+
Sfx_37_Snd:
z68kPtr Sfx_8E_Snd
+
incbin "sound/sfx_37.snd"
z68kPtr Sfx_8F_Snd
+
Sfx_38_Snd:
z68kPtr Sfx_90_Snd
+
incbin "sound/sfx_38.snd"
z68kPtr Sfx_91_Snd
+
Sfx_39_Snd:
z68kPtr Sfx_92_Snd
+
incbin "sound/sfx_39.snd"
z68kPtr Sfx_93_Snd
+
Sfx_3A_Snd:
z68kPtr Sfx_94_Snd
+
incbin "sound/sfx_3A.snd"
z68kPtr Sfx_95_Snd
+
Sfx_3B_Snd:
z68kPtr Sfx_96_Snd
+
incbin "sound/sfx_3B.snd"
z68kPtr Sfx_97_Snd
+
Sfx_3C_Snd:
z68kPtr Sfx_98_Snd
+
incbin "sound/sfx_3C.snd"
z68kPtr Sfx_99_Snd
+
Sfx_3D_Snd:
z68kPtr Sfx_9A_Snd
+
incbin "sound/sfx_3D.snd"
z68kPtr Sfx_9B_Snd
+
Sfx_3E_Snd:
z68kPtr Sfx_9C_Snd
+
incbin "sound/sfx_3E.snd"
z68kPtr Sfx_9D_Snd
+
Sfx_3F_Snd:
z68kPtr Sfx_9E_Snd
+
incbin "sound/sfx_3F.snd"
z68kPtr Sfx_9F_Snd
+
Sfx_40_Snd:
z68kPtr Sfx_A0_Snd
+
incbin "sound/sfx_40.snd"
z68kPtr Sfx_A1_Snd
+
Sfx_41_Snd:
z68kPtr Sfx_A2_Snd
+
incbin "sound/sfx_41.snd"
z68kPtr Sfx_A3_Snd
+
Sfx_42_Snd:
z68kPtr Sfx_A4_Snd
+
incbin "sound/sfx_42.snd"
z68kPtr Sfx_A5_Snd
+
Sfx_43_Snd:
z68kPtr Sfx_A6_Snd
+
incbin "sound/sfx_43.snd"
z68kPtr Sfx_A7_Snd
+
Sfx_44_Snd:
z68kPtr Sfx_A8_Snd
+
incbin "sound/sfx_44.snd"
z68kPtr Sfx_A9_Snd
+
Sfx_45_Snd:
z68kPtr Sfx_AA_Snd
+
incbin "sound/sfx_45.snd"
z68kPtr Sfx_AB_Snd
+
Sfx_46_Snd:
z68kPtr Sfx_AC_Snd
+
incbin "sound/sfx_46.snd"
z68kPtr Sfx_AD_Snd
+
Sfx_47_Snd:
z68kPtr Sfx_AE_Snd
+
incbin "sound/sfx_47.snd"
z68kPtr Sfx_AF_Snd
+
Sfx_48_Snd:
z68kPtr Sfx_B0_Snd
+
incbin "sound/sfx_48.snd"
z68kPtr Sfx_B1_Snd
+
Sfx_49_Snd:
z68kPtr Sfx_B2_Snd
+
incbin "sound/sfx_49.snd"
z68kPtr Sfx_B3_Snd
+
Sfx_4A_Snd:
z68kPtr Sfx_B4_Snd
+
incbin "sound/sfx_4A.snd"
z68kPtr Sfx_B5_Snd
+
Sfx_4B_Snd:
z68kPtr Sfx_B6_Snd
+
incbin "sound/sfx_4B.snd"
z68kPtr Sfx_B7_Snd
+
Sfx_4C_Snd:
z68kPtr Sfx_B8_Snd
+
incbin "sound/sfx_4C.snd"
z68kPtr Sfx_B9_Snd
+
Sfx_4D_Snd:
z68kPtr Sfx_BA_Snd
+
incbin "sound/sfx_4D.snd"
z68kPtr Sfx_BB_Snd
+
Sfx_4E_Snd:
z68kPtr Sfx_BC_Snd
+
incbin "sound/sfx_4E.snd"
z68kPtr Sfx_BD_Snd
+
Sfx_4F_Snd:
z68kPtr Sfx_BE_Snd
+
incbin "sound/sfx_4F.snd"
z68kPtr Sfx_BF_Snd
+
Sfx_50_Snd:
z68kPtr Sfx_C0_Snd
+
incbin "sound/sfx_50.snd"
z68kPtr Sfx_C1_Snd
+
Sfx_51_Snd:
z68kPtr Sfx_C2_Snd
+
incbin "sound/sfx_51.snd"
z68kPtr Sfx_C3_Snd
+
Sfx_52_Snd:
z68kPtr Sfx_C4_Snd
+
incbin "sound/sfx_52.snd"
z68kPtr Sfx_C5_Snd
+
Sfx_53_Snd:
z68kPtr Sfx_C6_Snd
+
incbin "sound/sfx_53.snd"
z68kPtr Sfx_C7_Snd
+
Sfx_54_Snd:
z68kPtr Sfx_C8_Snd
+
incbin "sound/sfx_54.snd"
z68kPtr Sfx_C9_Snd
+
Sfx_55_Snd:
z68kPtr Sfx_CA_Snd
+
incbin "sound/sfx_55.snd"
z68kPtr Sfx_CB_Snd
+
Sfx_56_Snd:
z68kPtr Sfx_CC_Snd
+
incbin "sound/sfx_56.snd"
z68kPtr Sfx_CD_Snd
+
Sfx_57_Snd:
z68kPtr Sfx_CE_Snd
+
incbin "sound/sfx_57.snd"
z68kPtr Sfx_CF_Snd
+
Sfx_58_Snd:
z68kPtr Sfx_D0_Snd
+
incbin "sound/sfx_58.snd"
z68kPtr Sfx_D1_Snd
+
Sfx_59_Snd:
z68kPtr Sfx_D2_Snd
+
incbin "sound/sfx_59.snd"
z68kPtr Sfx_D3_Snd
+
Sfx_5A_Snd:
z68kPtr Sfx_D4_Snd
+
incbin "sound/sfx_5A.snd"
z68kPtr Sfx_D5_Snd
+
Sfx_5B_Snd:
z68kPtr Sfx_D6_Snd
+
incbin "sound/sfx_5B.snd"
z68kPtr Sfx_D7_Snd
+
Sfx_5C_Snd:
z68kPtr Sfx_D8_Snd
+
incbin "sound/sfx_5C.snd"
z68kPtr Sfx_D9_Snd
+
Sfx_5D_Snd:
z68kPtr Sfx_DA_Snd
+
incbin "sound/sfx_5D.snd"
z68kPtr Sfx_DB_Snd
+
Sfx_5E_Snd:
z68kPtr Sfx_DC_Snd
+
incbin "sound/sfx_5E.snd"
z68kPtr Sfx_DC_Snd
+
Sfx_5F_Snd:
z68kPtr Sfx_DC_Snd
+
incbin "sound/sfx_5F.snd"
z68kPtr Sfx_DC_Snd
+
Sfx_60_Snd:
z68kPtr Sfx_DC_Snd
+
incbin "sound/sfx_60.snd"
DriverPointersEnd:
+
Sfx_61_Snd:
 
+
incbin "sound/sfx_61.snd"
UniversalVoiceBank:
+
Sfx_62_Snd:
incbin "sound/uvb.bin"
+
incbin "sound/sfx_62.snd"
UniversalVoiceBankEnd:
+
Sfx_63_Snd:
align $8000
+
incbin "sound/sfx_63.snd"
 
+
Sfx_64_Snd:
DacBank0:
+
incbin "sound/sfx_64.snd"
incbin "sound/dac_0.bin"
+
Sfx_65_Snd:
 
+
incbin "sound/sfx_65.snd"
align $8000
+
Sfx_66_Snd:
DacBank1:
+
incbin "sound/sfx_66.snd"
incbin "sound/dac_1.bin"
+
Sfx_67_Snd:
align $8000
+
incbin "sound/sfx_67.snd"
 
+
Sfx_68_Snd:
DacBank2:
+
incbin "sound/sfx_68.snd"
incbin "sound/dac_2.bin"
+
Sfx_69_Snd:
align $8000
+
incbin "sound/sfx_69.snd"
 
+
Sfx_6A_Snd:
Bank0:
+
incbin "sound/sfx_6A.snd"
incbin "sound/filler.bin"
+
Sfx_6B_Snd:
Mini_Boss_Snd:
+
incbin "sound/sfx_6B.snd"
incbin "sound/miniboss.snd"
+
Sfx_6C_Snd:
Final_Boss_Snd:
+
incbin "sound/sfx_6C.snd"
incbin "sound/f_boss.snd"
+
Sfx_6D_Snd:
align $8000
+
incbin "sound/sfx_6D.snd"
 
+
Sfx_6E_Snd:
Bank1:
+
incbin "sound/sfx_6E.snd"
Angel_Island_1_Snd:
+
Sfx_6F_Snd:
incbin "sound/aiz1.snd"
+
incbin "sound/sfx_6F.snd"
Angel_Island_2_Snd:
+
Sfx_70_Snd:
incbin "sound/aiz2.snd"
+
incbin "sound/sfx_70.snd"
Hydrocity_1_Snd:
+
Sfx_71_Snd:
incbin "sound/hcz1.snd"
+
incbin "sound/sfx_71.snd"
Hydrocity_2_Snd:
+
Sfx_72_Snd:
incbin "sound/hcz2.snd"
+
incbin "sound/sfx_72.snd"
Marble_Garden_1_Snd:
+
Sfx_73_Snd:
incbin "sound/mgz1.snd"
+
incbin "sound/sfx_73.snd"
Marble_Garden_2_Snd:
+
Sfx_74_Snd:
incbin "sound/mgz2.snd"
+
incbin "sound/sfx_74.snd"
Carnival_Night_2_Snd:
+
Sfx_75_Snd:
incbin "sound/cnz2.snd"
+
incbin "sound/sfx_75.snd"
Carnival_Night_1_Snd:
+
Sfx_76_Snd:
incbin "sound/cnz1.snd"
+
incbin "sound/sfx_76.snd"
Flying_Battery_1_Snd:
+
Sfx_77_Snd:
incbin "sound/fbz1.snd"
+
incbin "sound/sfx_77.snd"
Flying_Battery_2_Snd:
+
Sfx_78_Snd:
incbin "sound/fbz2.snd"
+
incbin "sound/sfx_78.snd"
The_Doomsday_Snd:
+
Sfx_79_Snd:
incbin "sound/tdz.snd"
+
incbin "sound/sfx_79.snd"
align $8000
+
Sfx_7A_Snd:
 
+
incbin "sound/sfx_7A.snd"
Bank2:
+
Sfx_7B_Snd:
Icecap_2_Snd:
+
incbin "sound/sfx_7B.snd"
incbin "sound/iz2.snd"
+
Sfx_7C_Snd:
Icecap_1_Snd:
+
incbin "sound/sfx_7C.snd"
incbin "sound/iz1.snd"
+
Sfx_7D_Snd:
Launch_Base_2_Snd:
+
incbin "sound/sfx_7D.snd"
incbin "sound/lbz2.snd"
+
Sfx_7E_Snd:
Launch_Base_1_Snd:
+
incbin "sound/sfx_7E.snd"
incbin "sound/lbz1.snd"
+
Sfx_7F_Snd:
Mushroom_Hill_1_Snd:
+
incbin "sound/sfx_7F.snd"
incbin "sound/mhz1.snd"
+
Sfx_80_Snd:
Mushroom_Hill_2_Snd:
+
incbin "sound/sfx_80.snd"
incbin "sound/mhz2.snd"
+
Sfx_81_Snd:
Sandopolis_1_Snd:
+
incbin "sound/sfx_81.snd"
incbin "sound/sz1.snd"
+
Sfx_82_Snd:
Sandopolis_2_Snd:
+
incbin "sound/sfx_82.snd"
incbin "sound/sz2.snd"
+
Sfx_83_Snd:
Lava_Reef_1_Snd:
+
incbin "sound/sfx_83.snd"
incbin "sound/lrz1.snd"
+
Sfx_84_Snd:
Lava_Reef_2_Snd:
+
incbin "sound/sfx_84.snd"
incbin "sound/lrz2.snd"
+
Sfx_85_Snd:
Sky_Sanctuary_Snd:
+
incbin "sound/sfx_85.snd"
incbin "sound/scz.snd"
+
Sfx_86_Snd:
Death_Egg_1_Snd:
+
incbin "sound/sfx_86.snd"
incbin "sound/dez1.snd"
+
Sfx_87_Snd:
Death_Egg_2_Snd:
+
incbin "sound/sfx_87.snd"
incbin "sound/dez2.snd"
+
Sfx_88_Snd:
Mini_Boss_SK_Snd:
+
incbin "sound/sfx_88.snd"
incbin "sound/mb_sk.snd"
+
Sfx_89_Snd:
Boss_Snd:
+
incbin "sound/sfx_89.snd"
incbin "sound/boss.snd"
+
Sfx_8A_Snd:
Glowing_Spheres_Bonus_Stage_snd:
+
incbin "sound/sfx_8A.snd"
incbin "sound/gs_bs.snd"
+
Sfx_8B_Snd:
Special_Stage_Snd:
+
incbin "sound/sfx_8B.snd"
incbin "sound/ss.snd"
+
Sfx_8C_Snd:
Level_Results_Snd:
+
incbin "sound/sfx_8C.snd"
incbin "sound/lr.snd"
+
Sfx_8D_Snd:
Menu_Snd:
+
incbin "sound/sfx_8D.snd"
incbin "sound/menu.snd"
+
Sfx_8E_Snd:
align $8000
+
incbin "sound/sfx_8E.snd"
 
+
Sfx_8F_Snd:
Bank3:
+
incbin "sound/sfx_8F.snd"
Slot_Machine_Bonus_Stage_snd:
+
Sfx_90_Snd:
incbin "sound/sm_bs.snd"
+
incbin "sound/sfx_90.snd"
Gum_Ball_Machine_Bonus_Stage_snd:
+
Sfx_91_Snd:
incbin "sound/gbm_bs.snd"
+
incbin "sound/sfx_91.snd"
Knuckles_Theme_Snd:
+
Sfx_92_Snd:
incbin "sound/kte.snd"
+
incbin "sound/sfx_92.snd"
Azure_Lake_Snd:
+
Sfx_93_Snd:
incbin "sound/alz.snd"
+
incbin "sound/sfx_93.snd"
Balloon_Park_Snd:
+
Sfx_94_Snd:
incbin "sound/bpz.snd"
+
incbin "sound/sfx_94.snd"
Desert_Palace_Snd:
+
Sfx_95_Snd:
incbin "sound/dpz.snd"
+
incbin "sound/sfx_95.snd"
Chrome_Gadget_Snd:
+
Sfx_96_Snd:
incbin "sound/cgz.snd"
+
incbin "sound/sfx_96.snd"
Endless_Mine_Snd:
+
Sfx_97_Snd:
incbin "sound/emz.snd"
+
incbin "sound/sfx_97.snd"
Title_Screen_Snd:
+
Sfx_98_Snd:
incbin "sound/ts.snd"
+
incbin "sound/sfx_98.snd"
Credits_Snd:
+
Sfx_99_Snd:
incbin "sound/credits.snd"
+
incbin "sound/sfx_99.snd"
Time_Game_Over_Snd:
+
Sfx_9A_Snd:
incbin "sound/tgovr.snd"
+
incbin "sound/sfx_9A.snd"
Continue_Snd:
+
Sfx_9B_Snd:
incbin "sound/continue.snd"
+
incbin "sound/sfx_9B.snd"
Extra_Life_Snd:
+
Sfx_9C_Snd:
incbin "sound/1up.snd"
+
incbin "sound/sfx_9C.snd"
Emerald_Snd:
+
Sfx_9D_Snd:
incbin "sound/emerald.snd"
+
incbin "sound/sfx_9D.snd"
Invincibility_Snd:
+
Sfx_9E_Snd:
incbin "sound/invcblty.snd"
+
incbin "sound/sfx_9E.snd"
Competition_Menu_Snd:
+
Sfx_9F_Snd:
incbin "sound/2p_menu.snd"
+
incbin "sound/sfx_9F.snd"
Underwater_Timming_Snd:
+
Sfx_A0_Snd:
incbin "sound/panic.snd"
+
incbin "sound/sfx_A0.snd"
Presented_by_SEGA_Snd:
+
Sfx_A1_Snd:
incbin "sound/p_sega.snd"
+
incbin "sound/sfx_A1.snd"
align $8000
+
Sfx_A2_Snd:
 
+
incbin "sound/sfx_A2.snd"
SndBank:
+
Sfx_A3_Snd:
SegaPCMBank:
+
incbin "sound/sfx_A3.snd"
SegaSnd:
+
Sfx_A4_Snd:
incbin "sound/sega.snd"
+
incbin "sound/sfx_A4.snd"
Sfx_34_Snd:
+
Sfx_A5_Snd:
incbin "sound/sfx_34.snd"
+
incbin "sound/sfx_A5.snd"
Sfx_35_Snd:
+
Sfx_A6_Snd:
incbin "sound/sfx_35.snd"
+
incbin "sound/sfx_A6.snd"
Sfx_36_Snd:
+
Sfx_A7_Snd:
incbin "sound/sfx_36.snd"
+
incbin "sound/sfx_A7.snd"
Sfx_37_Snd:
+
Sfx_A8_Snd:
incbin "sound/sfx_37.snd"
+
incbin "sound/sfx_A8.snd"
Sfx_38_Snd:
+
Sfx_A9_Snd:
incbin "sound/sfx_38.snd"
+
incbin "sound/sfx_A9.snd"
Sfx_39_Snd:
+
Sfx_AA_Snd:
incbin "sound/sfx_39.snd"
+
incbin "sound/sfx_AA.snd"
Sfx_3A_Snd:
+
Sfx_AB_Snd:
incbin "sound/sfx_3A.snd"
+
incbin "sound/sfx_AB.snd"
Sfx_3B_Snd:
+
Sfx_AC_Snd:
incbin "sound/sfx_3B.snd"
+
incbin "sound/sfx_AC.snd"
Sfx_3C_Snd:
+
Sfx_AD_Snd:
incbin "sound/sfx_3C.snd"
+
incbin "sound/sfx_AD.snd"
Sfx_3D_Snd:
+
Sfx_AE_Snd:
incbin "sound/sfx_3D.snd"
+
incbin "sound/sfx_AE.snd"
Sfx_3E_Snd:
+
Sfx_AF_Snd:
incbin "sound/sfx_3E.snd"
+
incbin "sound/sfx_AF.snd"
Sfx_3F_Snd:
+
Sfx_B0_Snd:
incbin "sound/sfx_3F.snd"
+
incbin "sound/sfx_B0.snd"
Sfx_40_Snd:
+
Sfx_B1_Snd:
incbin "sound/sfx_40.snd"
+
incbin "sound/sfx_B1.snd"
Sfx_41_Snd:
+
Sfx_B2_Snd:
incbin "sound/sfx_41.snd"
+
incbin "sound/sfx_B2.snd"
Sfx_42_Snd:
+
Sfx_B3_Snd:
incbin "sound/sfx_42.snd"
+
incbin "sound/sfx_B3.snd"
Sfx_43_Snd:
+
Sfx_B4_Snd:
incbin "sound/sfx_43.snd"
+
incbin "sound/sfx_B4.snd"
Sfx_44_Snd:
+
Sfx_B5_Snd:
incbin "sound/sfx_44.snd"
+
incbin "sound/sfx_B5.snd"
Sfx_45_Snd:
+
Sfx_B6_Snd:
incbin "sound/sfx_45.snd"
+
incbin "sound/sfx_B6.snd"
Sfx_46_Snd:
+
Sfx_B7_Snd:
incbin "sound/sfx_46.snd"
+
incbin "sound/sfx_B7.snd"
Sfx_47_Snd:
+
Sfx_B8_Snd:
incbin "sound/sfx_47.snd"
+
incbin "sound/sfx_B8.snd"
Sfx_48_Snd:
+
Sfx_B9_Snd:
incbin "sound/sfx_48.snd"
+
incbin "sound/sfx_B9.snd"
Sfx_49_Snd:
+
Sfx_BA_Snd:
incbin "sound/sfx_49.snd"
+
incbin "sound/sfx_BA.snd"
Sfx_4A_Snd:
+
Sfx_BB_Snd:
incbin "sound/sfx_4A.snd"
+
incbin "sound/sfx_BB.snd"
Sfx_4B_Snd:
+
Sfx_BC_Snd:
incbin "sound/sfx_4B.snd"
+
incbin "sound/sfx_BC.snd"
Sfx_4C_Snd:
+
Sfx_BD_Snd:
incbin "sound/sfx_4C.snd"
+
incbin "sound/sfx_BD.snd"
Sfx_4D_Snd:
+
Sfx_BE_Snd:
incbin "sound/sfx_4D.snd"
+
incbin "sound/sfx_BE.snd"
Sfx_4E_Snd:
+
Sfx_BF_Snd:
incbin "sound/sfx_4E.snd"
+
incbin "sound/sfx_BF.snd"
Sfx_4F_Snd:
+
Sfx_C0_Snd:
incbin "sound/sfx_4F.snd"
+
incbin "sound/sfx_C0.snd"
Sfx_50_Snd:
+
Sfx_C1_Snd:
incbin "sound/sfx_50.snd"
+
incbin "sound/sfx_C1.snd"
Sfx_51_Snd:
+
Sfx_C2_Snd:
incbin "sound/sfx_51.snd"
+
incbin "sound/sfx_C2.snd"
Sfx_52_Snd:
+
Sfx_C3_Snd:
incbin "sound/sfx_52.snd"
+
incbin "sound/sfx_C3.snd"
Sfx_53_Snd:
+
Sfx_C4_Snd:
incbin "sound/sfx_53.snd"
+
incbin "sound/sfx_C4.snd"
Sfx_54_Snd:
+
Sfx_C5_Snd:
incbin "sound/sfx_54.snd"
+
incbin "sound/sfx_C5.snd"
Sfx_55_Snd:
+
Sfx_C6_Snd:
incbin "sound/sfx_55.snd"
+
incbin "sound/sfx_C6.snd"
Sfx_56_Snd:
+
Sfx_C7_Snd:
incbin "sound/sfx_56.snd"
+
incbin "sound/sfx_C7.snd"
Sfx_57_Snd:
+
Sfx_C8_Snd:
incbin "sound/sfx_57.snd"
+
incbin "sound/sfx_C8.snd"
Sfx_58_Snd:
+
Sfx_C9_Snd:
incbin "sound/sfx_58.snd"
+
incbin "sound/sfx_C9.snd"
Sfx_59_Snd:
+
Sfx_CA_Snd:
incbin "sound/sfx_59.snd"
+
incbin "sound/sfx_CA.snd"
Sfx_5A_Snd:
+
Sfx_CB_Snd:
incbin "sound/sfx_5A.snd"
+
incbin "sound/sfx_CB.snd"
Sfx_5B_Snd:
+
Sfx_CC_Snd:
incbin "sound/sfx_5B.snd"
+
incbin "sound/sfx_CC.snd"
Sfx_5C_Snd:
+
Sfx_CD_Snd:
incbin "sound/sfx_5C.snd"
+
incbin "sound/sfx_CD.snd"
Sfx_5D_Snd:
+
Sfx_CE_Snd:
incbin "sound/sfx_5D.snd"
+
incbin "sound/sfx_CE.snd"
Sfx_5E_Snd:
+
Sfx_CF_Snd:
incbin "sound/sfx_5E.snd"
+
incbin "sound/sfx_CF.snd"
Sfx_5F_Snd:
+
Sfx_D0_Snd:
incbin "sound/sfx_5F.snd"
+
incbin "sound/sfx_D0.snd"
Sfx_60_Snd:
+
Sfx_D1_Snd:
incbin "sound/sfx_60.snd"
+
incbin "sound/sfx_D1.snd"
Sfx_61_Snd:
+
Sfx_D2_Snd:
incbin "sound/sfx_61.snd"
+
incbin "sound/sfx_D2.snd"
Sfx_62_Snd:
+
Sfx_D3_Snd:
incbin "sound/sfx_62.snd"
+
incbin "sound/sfx_D3.snd"
Sfx_63_Snd:
+
Sfx_D4_Snd:
incbin "sound/sfx_63.snd"
+
incbin "sound/sfx_D4.snd"
Sfx_64_Snd:
+
Sfx_D5_Snd:
incbin "sound/sfx_64.snd"
+
incbin "sound/sfx_D5.snd"
Sfx_65_Snd:
+
Sfx_D6_Snd:
incbin "sound/sfx_65.snd"
+
incbin "sound/sfx_D6.snd"
Sfx_66_Snd:
+
Sfx_D7_Snd:
incbin "sound/sfx_66.snd"
+
incbin "sound/sfx_D7.snd"
Sfx_67_Snd:
+
Sfx_D8_Snd:
incbin "sound/sfx_67.snd"
+
incbin "sound/sfx_D8.snd"
Sfx_68_Snd:
+
Sfx_D9_Snd:
incbin "sound/sfx_68.snd"
+
incbin "sound/sfx_D9.snd"
Sfx_69_Snd:
+
Sfx_DA_Snd:
incbin "sound/sfx_69.snd"
+
incbin "sound/sfx_DA.snd"
Sfx_6A_Snd:
+
Sfx_DB_Snd:
incbin "sound/sfx_6A.snd"
+
incbin "sound/sfx_DB.snd"
Sfx_6B_Snd:
+
Sfx_DC_Snd:
incbin "sound/sfx_6B.snd"
+
incbin "sound/sfx_DC.snd"
Sfx_6C_Snd:
+
</syntaxhighlight>
incbin "sound/sfx_6C.snd"
+
 
Sfx_6D_Snd:
+
then delete this:
incbin "sound/sfx_6D.snd"
+
<syntaxhighlight lang="asm">
Sfx_6E_Snd:
+
Music81: binclude "sound/music/Mus81 - GHZ.bin"
incbin "sound/sfx_6E.snd"
+
even
Sfx_6F_Snd:
+
Music82: binclude "sound/music/Mus82 - LZ.bin"
incbin "sound/sfx_6F.snd"
+
even
Sfx_70_Snd:
+
Music83: binclude "sound/music/Mus83 - MZ.bin"
incbin "sound/sfx_70.snd"
+
even
Sfx_71_Snd:
+
Music84: binclude "sound/music/Mus84 - SLZ.bin"
incbin "sound/sfx_71.snd"
+
even
Sfx_72_Snd:
+
Music85: binclude "sound/music/Mus85 - SYZ.bin"
incbin "sound/sfx_72.snd"
+
even
Sfx_73_Snd:
+
Music86: binclude "sound/music/Mus86 - SBZ.bin"
incbin "sound/sfx_73.snd"
+
even
Sfx_74_Snd:
+
Music87: binclude "sound/music/Mus87 - Invincibility.bin"
incbin "sound/sfx_74.snd"
+
even
Sfx_75_Snd:
+
Music88: binclude "sound/music/Mus88 - Extra Life.bin"
incbin "sound/sfx_75.snd"
+
even
Sfx_76_Snd:
+
Music89: binclude "sound/music/Mus89 - Special Stage.bin"
incbin "sound/sfx_76.snd"
+
even
Sfx_77_Snd:
+
Music8A: binclude "sound/music/Mus8A - Title Screen.bin"
incbin "sound/sfx_77.snd"
+
even
Sfx_78_Snd:
+
Music8B: binclude "sound/music/Mus8B - Ending.bin"
incbin "sound/sfx_78.snd"
+
even
Sfx_79_Snd:
+
Music8C: binclude "sound/music/Mus8C - Boss.bin"
incbin "sound/sfx_79.snd"
+
even
Sfx_7A_Snd:
+
Music8D: binclude "sound/music/Mus8D - FZ.bin"
incbin "sound/sfx_7A.snd"
+
even
Sfx_7B_Snd:
+
Music8E: binclude "sound/music/Mus8E - Sonic Got Through.bin"
incbin "sound/sfx_7B.snd"
+
even
Sfx_7C_Snd:
+
Music8F: binclude "sound/music/Mus8F - Game Over.bin"
incbin "sound/sfx_7C.snd"
+
even
Sfx_7D_Snd:
+
Music90: binclude "sound/music/Mus90 - Continue Screen.bin"
incbin "sound/sfx_7D.snd"
+
even
Sfx_7E_Snd:
+
Music91: binclude "sound/music/Mus91 - Credits.bin"
incbin "sound/sfx_7E.snd"
+
even
Sfx_7F_Snd:
+
Music92: binclude "sound/music/Mus92 - Drowning.bin"
incbin "sound/sfx_7F.snd"
+
even
Sfx_80_Snd:
+
Music93: binclude "sound/music/Mus93 - Get Emerald.bin"
incbin "sound/sfx_80.snd"
+
even
Sfx_81_Snd:
+
; ---------------------------------------------------------------------------
incbin "sound/sfx_81.snd"
+
; Sound effect pointers
Sfx_82_Snd:
+
; ---------------------------------------------------------------------------
incbin "sound/sfx_82.snd"
+
SoundIndex:
Sfx_83_Snd:
+
ptr_sndA0: dc.l SoundA0
incbin "sound/sfx_83.snd"
+
ptr_sndA1: dc.l SoundA1
Sfx_84_Snd:
+
ptr_sndA2: dc.l SoundA2
incbin "sound/sfx_84.snd"
+
ptr_sndA3: dc.l SoundA3
Sfx_85_Snd:
+
ptr_sndA4: dc.l SoundA4
incbin "sound/sfx_85.snd"
+
ptr_sndA5: dc.l SoundA5
Sfx_86_Snd:
+
ptr_sndA6: dc.l SoundA6
incbin "sound/sfx_86.snd"
+
ptr_sndA7: dc.l SoundA7
Sfx_87_Snd:
+
ptr_sndA8: dc.l SoundA8
incbin "sound/sfx_87.snd"
+
ptr_sndA9: dc.l SoundA9
Sfx_88_Snd:
+
ptr_sndAA: dc.l SoundAA
incbin "sound/sfx_88.snd"
+
ptr_sndAB: dc.l SoundAB
Sfx_89_Snd:
+
ptr_sndAC: dc.l SoundAC
incbin "sound/sfx_89.snd"
+
ptr_sndAD: dc.l SoundAD
Sfx_8A_Snd:
+
ptr_sndAE: dc.l SoundAE
incbin "sound/sfx_8A.snd"
+
ptr_sndAF: dc.l SoundAF
Sfx_8B_Snd:
+
ptr_sndB0: dc.l SoundB0
incbin "sound/sfx_8B.snd"
+
ptr_sndB1: dc.l SoundB1
Sfx_8C_Snd:
+
ptr_sndB2: dc.l SoundB2
incbin "sound/sfx_8C.snd"
+
ptr_sndB3: dc.l SoundB3
Sfx_8D_Snd:
+
ptr_sndB4: dc.l SoundB4
incbin "sound/sfx_8D.snd"
+
ptr_sndB5: dc.l SoundB5
Sfx_8E_Snd:
+
ptr_sndB6: dc.l SoundB6
incbin "sound/sfx_8E.snd"
+
ptr_sndB7: dc.l SoundB7
Sfx_8F_Snd:
+
ptr_sndB8: dc.l SoundB8
incbin "sound/sfx_8F.snd"
+
ptr_sndB9: dc.l SoundB9
Sfx_90_Snd:
+
ptr_sndBA: dc.l SoundBA
incbin "sound/sfx_90.snd"
+
ptr_sndBB: dc.l SoundBB
Sfx_91_Snd:
+
ptr_sndBC: dc.l SoundBC
incbin "sound/sfx_91.snd"
+
ptr_sndBD: dc.l SoundBD
Sfx_92_Snd:
+
ptr_sndBE: dc.l SoundBE
incbin "sound/sfx_92.snd"
+
ptr_sndBF: dc.l SoundBF
Sfx_93_Snd:
+
ptr_sndC0: dc.l SoundC0
incbin "sound/sfx_93.snd"
+
ptr_sndC1: dc.l SoundC1
Sfx_94_Snd:
+
ptr_sndC2: dc.l SoundC2
incbin "sound/sfx_94.snd"
+
ptr_sndC3: dc.l SoundC3
Sfx_95_Snd:
+
ptr_sndC4: dc.l SoundC4
incbin "sound/sfx_95.snd"
+
ptr_sndC5: dc.l SoundC5
Sfx_96_Snd:
+
ptr_sndC6: dc.l SoundC6
incbin "sound/sfx_96.snd"
+
ptr_sndC7: dc.l SoundC7
Sfx_97_Snd:
+
ptr_sndC8: dc.l SoundC8
incbin "sound/sfx_97.snd"
+
ptr_sndC9: dc.l SoundC9
Sfx_98_Snd:
+
ptr_sndCA: dc.l SoundCA
incbin "sound/sfx_98.snd"
+
ptr_sndCB: dc.l SoundCB
Sfx_99_Snd:
+
ptr_sndCC: dc.l SoundCC
incbin "sound/sfx_99.snd"
+
ptr_sndCD: dc.l SoundCD
Sfx_9A_Snd:
+
ptr_sndCE: dc.l SoundCE
incbin "sound/sfx_9A.snd"
+
ptr_sndCF: dc.l SoundCF
Sfx_9B_Snd:
+
ptr_sndend
incbin "sound/sfx_9B.snd"
+
; ---------------------------------------------------------------------------
Sfx_9C_Snd:
+
; Special sound effect pointers
incbin "sound/sfx_9C.snd"
+
; ---------------------------------------------------------------------------
Sfx_9D_Snd:
+
SpecSoundIndex:
incbin "sound/sfx_9D.snd"
+
ptr_sndD0: dc.l SoundD0
Sfx_9E_Snd:
+
ptr_specend
incbin "sound/sfx_9E.snd"
+
SoundA0: binclude "sound/sfx/SndA0 - Jump.bin"
Sfx_9F_Snd:
+
even
incbin "sound/sfx_9F.snd"
+
SoundA1: binclude "sound/sfx/SndA1 - Lamppost.bin"
Sfx_A0_Snd:
+
even
incbin "sound/sfx_A0.snd"
+
SoundA2: binclude "sound/sfx/SndA2.bin"
Sfx_A1_Snd:
+
even
incbin "sound/sfx_A1.snd"
+
SoundA3: binclude "sound/sfx/SndA3 - Death.bin"
Sfx_A2_Snd:
+
even
incbin "sound/sfx_A2.snd"
+
SoundA4: binclude "sound/sfx/SndA4 - Skid.bin"
Sfx_A3_Snd:
+
even
incbin "sound/sfx_A3.snd"
+
SoundA5: binclude "sound/sfx/SndA5.bin"
Sfx_A4_Snd:
+
even
incbin "sound/sfx_A4.snd"
+
SoundA6: binclude "sound/sfx/SndA6 - Hit Spikes.bin"
Sfx_A5_Snd:
+
even
incbin "sound/sfx_A5.snd"
+
SoundA7: binclude "sound/sfx/SndA7 - Push Block.bin"
Sfx_A6_Snd:
+
even
incbin "sound/sfx_A6.snd"
+
SoundA8: binclude "sound/sfx/SndA8 - SS Goal.bin"
Sfx_A7_Snd:
+
even
incbin "sound/sfx_A7.snd"
+
SoundA9: binclude "sound/sfx/SndA9 - SS Item.bin"
Sfx_A8_Snd:
+
even
incbin "sound/sfx_A8.snd"
+
SoundAA: binclude "sound/sfx/SndAA - Splash.bin"
Sfx_A9_Snd:
+
even
incbin "sound/sfx_A9.snd"
+
SoundAB: binclude "sound/sfx/SndAB.bin"
Sfx_AA_Snd:
+
even
incbin "sound/sfx_AA.snd"
+
SoundAC: binclude "sound/sfx/SndAC - Hit Boss.bin"
Sfx_AB_Snd:
+
even
incbin "sound/sfx_AB.snd"
+
SoundAD: binclude "sound/sfx/SndAD - Get Bubble.bin"
Sfx_AC_Snd:
+
even
incbin "sound/sfx_AC.snd"
+
SoundAE: binclude "sound/sfx/SndAE - Fireball.bin"
Sfx_AD_Snd:
+
even
incbin "sound/sfx_AD.snd"
+
SoundAF: binclude "sound/sfx/SndAF - Shield.bin"
Sfx_AE_Snd:
+
even
incbin "sound/sfx_AE.snd"
+
SoundB0: binclude "sound/sfx/SndB0 - Saw.bin"
Sfx_AF_Snd:
+
even
incbin "sound/sfx_AF.snd"
+
SoundB1: binclude "sound/sfx/SndB1 - Electric.bin"
Sfx_B0_Snd:
+
even
incbin "sound/sfx_B0.snd"
+
SoundB2: binclude "sound/sfx/SndB2 - Drown Death.bin"
Sfx_B1_Snd:
+
even
incbin "sound/sfx_B1.snd"
+
SoundB3: binclude "sound/sfx/SndB3 - Flamethrower.bin"
Sfx_B2_Snd:
+
even
incbin "sound/sfx_B2.snd"
+
SoundB4: binclude "sound/sfx/SndB4 - Bumper.bin"
Sfx_B3_Snd:
+
even
incbin "sound/sfx_B3.snd"
+
SoundB5: binclude "sound/sfx/SndB5 - Ring.bin"
Sfx_B4_Snd:
+
even
incbin "sound/sfx_B4.snd"
+
SoundB6: binclude "sound/sfx/SndB6 - Spikes Move.bin"
Sfx_B5_Snd:
+
even
incbin "sound/sfx_B5.snd"
+
SoundB7: binclude "sound/sfx/SndB7 - Rumbling.bin"
Sfx_B6_Snd:
+
even
incbin "sound/sfx_B6.snd"
+
SoundB8: binclude "sound/sfx/SndB8.bin"
Sfx_B7_Snd:
+
even
incbin "sound/sfx_B7.snd"
+
SoundB9: binclude "sound/sfx/SndB9 - Collapse.bin"
Sfx_B8_Snd:
+
even
incbin "sound/sfx_B8.snd"
+
SoundBA: binclude "sound/sfx/SndBA - SS Glass.bin"
Sfx_B9_Snd:
+
even
incbin "sound/sfx_B9.snd"
+
SoundBB: binclude "sound/sfx/SndBB - Door.bin"
Sfx_BA_Snd:
+
even
incbin "sound/sfx_BA.snd"
+
SoundBC: binclude "sound/sfx/SndBC - Teleport.bin"
Sfx_BB_Snd:
+
even
incbin "sound/sfx_BB.snd"
+
SoundBD: binclude "sound/sfx/SndBD - ChainStomp.bin"
Sfx_BC_Snd:
+
even
incbin "sound/sfx_BC.snd"
+
SoundBE: binclude "sound/sfx/SndBE - Roll.bin"
Sfx_BD_Snd:
+
even
incbin "sound/sfx_BD.snd"
+
SoundBF: binclude "sound/sfx/SndBF - Get Continue.bin"
Sfx_BE_Snd:
+
even
incbin "sound/sfx_BE.snd"
+
SoundC0: binclude "sound/sfx/SndC0 - Basaran Flap.bin"
Sfx_BF_Snd:
+
even
incbin "sound/sfx_BF.snd"
+
SoundC1: binclude "sound/sfx/SndC1 - Break Item.bin"
Sfx_C0_Snd:
+
even
incbin "sound/sfx_C0.snd"
+
SoundC2: binclude "sound/sfx/SndC2 - Drown Warning.bin"
Sfx_C1_Snd:
+
even
incbin "sound/sfx_C1.snd"
+
SoundC3: binclude "sound/sfx/SndC3 - Giant Ring.bin"
Sfx_C2_Snd:
+
even
incbin "sound/sfx_C2.snd"
+
SoundC4: binclude "sound/sfx/SndC4 - Bomb.bin"
Sfx_C3_Snd:
+
even
incbin "sound/sfx_C3.snd"
+
SoundC5: binclude "sound/sfx/SndC5 - Cash Register.bin"
Sfx_C4_Snd:
+
even
incbin "sound/sfx_C4.snd"
+
SoundC6: binclude "sound/sfx/SndC6 - Ring Loss.bin"
Sfx_C5_Snd:
+
even
incbin "sound/sfx_C5.snd"
+
SoundC7: binclude "sound/sfx/SndC7 - Chain Rising.bin"
Sfx_C6_Snd:
+
even
incbin "sound/sfx_C6.snd"
+
SoundC8: binclude "sound/sfx/SndC8 - Burning.bin"
Sfx_C7_Snd:
+
even
incbin "sound/sfx_C7.snd"
+
SoundC9: binclude "sound/sfx/SndC9 - Hidden Bonus.bin"
Sfx_C8_Snd:
+
even
incbin "sound/sfx_C8.snd"
+
SoundCA: binclude "sound/sfx/SndCA - Enter SS.bin"
Sfx_C9_Snd:
+
even
incbin "sound/sfx_C9.snd"
+
SoundCB: binclude "sound/sfx/SndCB - Wall Smash.bin"
Sfx_CA_Snd:
+
even
incbin "sound/sfx_CA.snd"
+
SoundCC: binclude "sound/sfx/SndCC - Spring.bin"
Sfx_CB_Snd:
+
even
incbin "sound/sfx_CB.snd"
+
SoundCD: binclude "sound/sfx/SndCD - Switch.bin"
Sfx_CC_Snd:
+
even
incbin "sound/sfx_CC.snd"
+
SoundCE: binclude "sound/sfx/SndCE - Ring Left Speaker.bin"
Sfx_CD_Snd:
+
even
incbin "sound/sfx_CD.snd"
+
SoundCF: binclude "sound/sfx/SndCF - Signpost.bin"
Sfx_CE_Snd:
+
even
incbin "sound/sfx_CE.snd"
+
SoundD0: binclude "sound/sfx/SndD0 - Waterfall.bin"
Sfx_CF_Snd:
+
even
incbin "sound/sfx_CF.snd"
+
 
Sfx_D0_Snd:
+
cnop ($8000-Size_of_SegaPCM),$8000
incbin "sound/sfx_D0.snd"
+
SegaPCM: binclude "sound/dac/segapcm.bin"
Sfx_D1_Snd:
+
SegaPCM_End
incbin "sound/sfx_D1.snd"
+
even
Sfx_D2_Snd:
+
 
incbin "sound/sfx_D2.snd"
+
if SegaPCM_End-SegaPCM>$8000
Sfx_D3_Snd:
+
fatal "Sega sound must fit within $8000 bytes, but you have a $\{SegaPCM_End-SegaPCM} byte Sega sound."
incbin "sound/sfx_D3.snd"
+
endif
Sfx_D4_Snd:
+
if SegaPCM_End-SegaPCM>Size_of_SegaPCM
incbin "sound/sfx_D4.snd"
+
fatal "Size_of_SegaPCM = $\{Size_of_SegaPCM}, but you have a $\{SegaPCM_End-SegaPCM} byte Sega sound."
Sfx_D5_Snd:
+
endif
incbin "sound/sfx_D5.snd"
 
Sfx_D6_Snd:
 
incbin "sound/sfx_D6.snd"
 
Sfx_D7_Snd:
 
incbin "sound/sfx_D7.snd"
 
Sfx_D8_Snd:
 
incbin "sound/sfx_D8.snd"
 
Sfx_D9_Snd:
 
incbin "sound/sfx_D9.snd"
 
Sfx_DA_Snd:
 
incbin "sound/sfx_DA.snd"
 
Sfx_DB_Snd:
 
incbin "sound/sfx_DB.snd"
 
Sfx_DC_Snd:
 
incbin "sound/sfx_DC.snd"
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
the old compressed pcm driver remains until I am sure it is safe to remove.
 
===Driver data files===
 
===Driver data files===
 
Then unpack this into the sound folder, and remove the original files since we no longer need them anymore:
 
Then unpack this into the sound folder, and remove the original files since we no longer need them anymore:

Revision as of 05:42, 10 May 2017

(Original guide by Kram1024)
Updated by User:Kram1024

You probably saw a quick and dirty way to do this on SSRG, but lets do it the proper way, the way that Sonic Team would do it.

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.

Hivebrain Disassembly users, start here

if yours uses snasm68k, please move to one of the other choices since snasm68k doesnt understand these macros and has benn known to have compatibility issues with some versions of Windows and with Wine. AS Users: change "incbin" to "binclude".

Macros

Before going on with this guide, add these macros to the start of your disassembly:

; (since the DAC banks are incbin'd, this macro isn't in use, yet)
; for DAC pointers
zPtrDAC: macro addr
     dc.w ((((addr&$7FFF)+$8000)<<8)&$FF00)+(((addr&$7FFF)+$8000)>>8)
     endm

; for special pointers in the driver itself
zPtrSpec: macro addr
     dc.w (((addr&$1FFF)>>$08)|((addr&$1FFF)<<$08))&$FFFF
     endm

; for pointers to things that the 68k will interact with in the Z80 Driver
z68kPtr: macro addr
     dc.w (((addr&$FFFF)|$8000>>$08)|((addr&$FFFF)|$8000<<$08))&$FFFF
     endm

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.

Prepare Vertical Interrupt Handler for new driver

Sonic 1 calls a early 68k smps driver in both the vertical blank routine and the horizontal blank routine, we don need this for the new driver, so we will have to make a few deletions here and there.

Sonic 2 also does this with it's compressed z80 driver, so if you are actually placing this in sonic 2, you might want to make a note of that.

first we will fix the vertical interrupt, by deleting this line:

		jsr	(sub_71B4C).l

under:

loc_B5E:				; XREF: loc_B88

Prepare Hoizontal Interrupt Handler for new driver

Now we locate:

loc_119E:				; XREF: PalToCRAM
		clr.b	($FFFFF64F).w
		movem.l	d0-a6,-(sp)
		bsr.w	Demo_Time
		jsr	(sub_71B4C).l
		movem.l	(sp)+,d0-a6
		rte	
; End of function PalToCRAM

See another familiar line? Yes, you've got it, do the same thing to it:

loc_119E:				; XREF: PalToCRAM
		clr.b	($FFFFF64F).w
		movem.l	d0-a6,-(sp)
		bsr.w	Demo_Time
 		movem.l	(sp)+,d0-a6
		rte	
; End of function PalToCRAM

That effectively disables the Sonic 1/2 style interrupt handler which we will not need and prevents a nasty error down the road.

Upgrading the Load Driver Routine

Okay, we disabled the driver's interrupt handler, wouldn't we want now to use the sonic3 driver instead? Here is where we start installing it. Locate:

; ---------------------------------------------------------------------------
; Subroutine to	load the sound driver
; ---------------------------------------------------------------------------

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


SoundDriverLoad:			; XREF: GameClrRAM; TitleScreen
		nop	
		move.w	#$100,($A11100).l ; stop the Z80
		move.w	#$100,($A11200).l ; reset the Z80
		lea	(Kos_Z80).l,a0	; load sound driver
		lea	($A00000).l,a1
		bsr.w	KosDec		; decompress
		move.w	#0,($A11200).l
		nop	
		nop	
		nop	
		nop	
		move.w	#$100,($A11200).l ; reset the Z80
		move.w	#0,($A11100).l	; start	the Z80
		rts	
; End of function SoundDriverLoad

and replace it all with:

; ---------------------------------------------------------------------------
; Subroutine to	load the sound driver
; ---------------------------------------------------------------------------

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

SoundDriverLoad:					; XREF: GameClrRAM;	TitleScreen
		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-1,d0

@loadDriver
		move.b	(a0)+,(a1)+
		dbf	d0,@loadDriver
		lea	(DriverPointers).l,a0
		lea	($A01300).l,a1
		move.w	#DriverPointersEnd-DriverPointers-1,d0

@loadPointers
		move.b	(a0)+,(a1)+
		dbf	d0,	@loadPointers
		lea	(UniversalVoiceBank).l,a0
		lea	($A017D8).l,a1
		move.w	#UniversalVoiceBankEnd-UniversalVoiceBank-1,d0

@loadUVB
		move.b	(a0)+,(a1)+
		dbf	d0,@loadUVB
		lea	(DriverResetData).l,a0
		lea	($A01C00).l,a1
		move.w	#DriverResetDataEnd-DriverResetData-1,d0

@loadResetData
		move.b	(a0)+,(a1)+
		dbf	d0,@loadResetData
		btst	#6,($FFFFFFF8).w
		beq.s	@restartZ80
		move.b	#1,($A01C02).l

@restartZ80
		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:
		dc.b	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DriverResetDataEnd:

if you are using an as based disassembly replace @ with .

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 PlaySound routine, locate:

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

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


PlaySound:
		move.b	d0,($FFFFF00A).w
		rts	
; End of function PlaySound

and replace it completely with:

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

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


PlaySound:
		cmpi.w	#$FB,d0
		blt.s	PlayNotSpecialFlag
		bhi.s	TestForNormalSpeed
		move	#8,d0
		jmp	SetTempo

TestForNormalSpeed:
		cmpi.w	#$FC,d0
		bne.s	PlayNotSpecialFlag
		clr.w	d0
		jmp	SetTempo

PlayNotSpecialFlag:
		move.w	#$100,($A11100).l

PlaySoundZ80NotStopped:
		btst	#0,($A11100).l
		bne.s	PlaySoundZ80NotStopped	; loop until it says it's stopped
		move.b	d0,($A01C0A).l
		move.w	#0,($A11100).l
		rts
; End of function PlaySound

; ---------------------------------------------------------------------------
; Exclusive sound/music subroutine
; ---------------------------------------------------------------------------


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



PlaySound_Ex:
		tst.b	4(A0)
		bpl.s	SkipPlaySound_Special

Do not be alarmed about the new sound routine that was added, it is equivalent to the PlaySound_Local routine (as a matter of fact, it is identical, why sonic1 does not already have it is beyond me, since it indeed does work in Sonic 1)

sound playback routines

now find:

; ---------------------------------------------------------------------------
; Subroutine to	play a special sound/music (E0-E4)
;
; E0 - Fade out
; E1 - Sega
; E2 - Speed up
; E3 - Normal speed
; E4 - Stop
; ---------------------------------------------------------------------------

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


PlaySound_Special:
		move.b	d0,($FFFFF00B).w
		rts	
; End of function PlaySound_Special

; ===========================================================================
; ---------------------------------------------------------------------------
; Unused sound/music subroutine
; ---------------------------------------------------------------------------

PlaySound_Unk:
		move.b	d0,($FFFFF00C).w
		rts

and replace it entirely with:

; ---------------------------------------------------------------------------
; Subroutine to	play a special sound/music (FB-FF)
; ---------------------------------------------------------------------------

PlaySound_Special:
		move.w	#$100,($A11100).l

PlaySound_SpecialZ80NotStopped:
		btst	#0,($A11100).l
		bne.s	PlaySound_SpecialZ80NotStopped
		cmp.b	($A01C0B).l,d0
		beq.s	PlaySound_Special1
		tst.b	($A01C0B).l
		bne.s	PlaySound_Special0
		move.b	d0,($A01C0B).l
		move.w	#0,($A11100).l
		rts

PlaySound_Special0:
		move.b	d0,($A01C0C).l

PlaySound_Special1:
		move.w	#0,($A11100).l

SkipPlaySound_Special:
		rts
; End of function PlaySound_Special

; ---------------------------------------------------------------------------
; Subroutine to change the music tempo
; ---------------------------------------------------------------------------

SetTempo:
		move.w	#$100,($A11100).l

SetTempoZ80NotStopped:
		btst	#0,($A11100).l
		bne.s	SetTempoZ80NotStopped
		move.b	D0,($A01C08).l
		move.w	#0,($A11100).l
		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 |||||||||||||||||||||||||||||||||||||||


PauseGame:				; XREF: Level_MainLoop; et al
		nop	
		tst.b	($FFFFFE12).w	; do you have any lives	left?
		beq.s	Unpause		; if not, branch
		tst.w	($FFFFF63A).w	; is game already paused?
		bne.s	loc_13BE	; if yes, branch
		btst	#7,($FFFFF605).w ; is Start button pressed?
		beq.s	Pause_DoNothing	; if not, branch

loc_13BE:
		move.w	#1,($FFFFF63A).w ; freeze time
		move.b	#1,($FFFFF003).w ; pause music

loc_13CA:
		move.b	#$10,($FFFFF62A).w
		bsr.w	DelayProgram
		tst.b	($FFFFFFE1).w	; is slow-motion cheat on?
		beq.s	Pause_ChkStart	; if not, branch
		btst	#6,($FFFFF605).w ; is button A pressed?
		beq.s	Pause_ChkBC	; if not, branch
		move.b	#4,($FFFFF600).w ; set game mode to 4 (title screen)
		nop	
		bra.s	loc_1404
; ===========================================================================

Pause_ChkBC:				; XREF: PauseGame
		btst	#4,($FFFFF604).w ; is button B pressed?
		bne.s	Pause_SlowMo	; if yes, branch
		btst	#5,($FFFFF605).w ; is button C pressed?
		bne.s	Pause_SlowMo	; if yes, branch

Pause_ChkStart:				; XREF: PauseGame
		btst	#7,($FFFFF605).w ; is Start button pressed?
		beq.s	loc_13CA	; if not, branch

loc_1404:				; XREF: PauseGame
		move.b	#$80,($FFFFF003).w

Unpause:				; XREF: PauseGame
		move.w	#0,($FFFFF63A).w ; unpause the game

Pause_DoNothing:			; XREF: PauseGame
		rts	
; ===========================================================================

Pause_SlowMo:				; XREF: PauseGame
		move.w	#1,($FFFFF63A).w
		move.b	#$80,($FFFFF003).w
		rts	
; End of function PauseGame

and replace it completely with:

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

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


PauseGame:				; XREF: Level_MainLoop; et al
		nop
		tst.b	($FFFFFE12).w ; do you have any lives left
		beq	Unpause           ; if not, branch
		tst.w	($FFFFF63A).w ;is the game already paused?
		bne.s	PauseGame_AlreadyPaused ;if yes, branch
		move.b	($FFFFF605).w,d0 ;did you press start
		or.b	($FFFFF607).w,d0         ;on either controller?
		andi.b	#$80,d0
		beq	Pause_DoNothing         ;if not, branch

PauseGame_AlreadyPaused:	
		move.w	#1,($FFFFF63A).w ;unpause the game
		move.w	#$100,($A11100).l  ;stop the z80

PauseGameZ80NotStopped:
		btst	#0,($A11100).l
		bne.s	PauseGameZ80NotStopped
		move.b	#1,($A01C10).l ;unpause the music ;)
		move.w	#0,($A11100).l ;start the z80

PauseGameLoop:
		move.b	#$10,($FFFFF62A).w ;re-pause the game (used in slow-mo and frame advance)
		jsr	DelayProgram ;wait...
		tst.b	($FFFFFFE1).w ; Edit: the value is $FFFFFFE1 in Sonic 1 (slow-mo/frame advance mode)
		beq.s	Pause_ChkStart
		btst	#6,($FFFFF605).w ;is player 1 pressing either A?
		beq.s	Pause_ChkBC ;if not, branch
		move.b	#$4,($FFFFF600).w ; Go To Title Screen
		nop
		bra.s	PauseGame1 ;time to stop the z80 again

Pause_ChkBC:
		btst	#4,($FFFFF604).w ;did you press a?
		bne.s	Pause_SlowMo ;if so, branch
		btst	#5,($FFFFF605).w ;did you press b?
		bne.s	Pause_SlowMo ;if so, branch

Pause_ChkStart:
		btst	#4,($FFFFF605).w            ;did you press a?
		beq.s	PauseGame0           ;if yes, then paise the freaken game
		move.b	#$0,($FFFFF600).w  ;prepare to go to sega screen (level select is not 0xC0 in sonic1, but part of title screen code)
		bra.s	PauseGame1                   ;go to title screen

PauseGame0:
		move.b	($FFFFF605).w,d0  ;on controller 1?
		or.b	($FFFFF607).w,d0          ;or 2?
		andi.b	#$80,d0                 ;if not, no change
		beq.s	PauseGameLoop   ;in other words, don't pause

PauseGame1:
		move.w	#$100,($A11100).l  ;stop the z80

Pause_ChkStartZ80NotStopped:
		btst	#0,($A11100).l
		bne.s	Pause_ChkStartZ80NotStopped
		move.b	#$80,($A01C10).l ;pause the music
		move.w	#0,($A11100).l     ;start the z80

Unpause:
		move.w	#0,($FFFFF63A).w ;unpause the game

Pause_DoNothing:
		rts

Pause_SlowMo:
		move.w	#1,($FFFFF63A).w ;unpause the music for a frame
		move.w	#$100,($A11100).l  ;stop the z80

Pause_SlowMoZ80NotStopped:
		btst	#0,($A11100).l
		bne.s	Pause_SlowMoZ80NotStopped
		move.b	#$80,($A01C10).l ;pause the music again
		move.w	#0,($A11100).l ;start the z80
		rts
; End of function PauseGame

Replacing 68k driver with new Z80 driver

We need the sound driver itself if we are going to have any sound and music, so we locate:

		align 2

Go_SoundTypes:	dc.l SoundTypes		; XREF: Sound_Play
Go_SoundD0:	dc.l SoundD0Index	; XREF: Sound_D0toDF
Go_MusicIndex:	dc.l MusicIndex		; XREF: Sound_81to9F
Go_SoundIndex:	dc.l SoundIndex		; XREF: Sound_A0toCF
off_719A0:	dc.l byte_71A94		; XREF: Sound_81to9F
Go_PSGIndex:	dc.l PSG_Index		; XREF: sub_72926
; ---------------------------------------------------------------------------
; PSG instruments used in music
; ---------------------------------------------------------------------------
PSG_Index:	dc.l PSG1, PSG2, PSG3
		dc.l PSG4, PSG5, PSG6
		dc.l PSG7, PSG8, PSG9
PSG1:		binclude	sound\psg1.bin
PSG2:		binclude	sound\psg2.bin
PSG3:		binclude	sound\psg3.bin
PSG4:		binclude	sound\psg4.bin
PSG6:		binclude	sound\psg6.bin
PSG5:		binclude	sound\psg5.bin
PSG7:		binclude	sound\psg7.bin
PSG8:		binclude	sound\psg8.bin
PSG9:		binclude	sound\psg9.bin

byte_71A94:	dc.b 7,	$72, $73, $26, $15, 8, $FF, 5
; ---------------------------------------------------------------------------
; Music	Pointers
; ---------------------------------------------------------------------------
MusicIndex:	dc.l Music81, Music82
		dc.l Music83, Music84
		dc.l Music85, Music86
		dc.l Music87, Music88
		dc.l Music89, Music8A
		dc.l Music8B, Music8C
		dc.l Music8D, Music8E
		dc.l Music8F, Music90
		dc.l Music91, Music92
		dc.l Music93
; ---------------------------------------------------------------------------
; Type of sound	being played ($90 = music; $70 = normal	sound effect)
; ---------------------------------------------------------------------------
SoundTypes:	dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$80
		dc.b $70, $70, $70, $70, $70, $70, $70,	$70, $70, $68, $70, $70, $70, $60, $70,	$70
		dc.b $60, $70, $60, $70, $70, $70, $70,	$70, $70, $70, $70, $70, $70, $70, $7F,	$60
		dc.b $70, $70, $70, $70, $70, $70, $70,	$70, $70, $70, $70, $70, $70, $70, $70,	$80
		dc.b $80, $80, $80, $80, $80, $80, $80,	$80, $80, $80, $80, $80, $80, $80, $80,	$90
		dc.b $90, $90, $90, $90

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


sub_71B4C:				; XREF: loc_B10; PalToCRAM
		move.w	#$100,($A11100).l ; stop the Z80
		nop	
		nop	
		nop	

loc_71B5A:
		btst	#0,($A11100).l
		bne.s	loc_71B5A

		btst	#7,($A01FFD).l
		beq.s	loc_71B82
		move.w	#0,($A11100).l	; start	the Z80
		nop	
		nop	
		nop	
		nop	
		nop	
		bra.s	sub_71B4C
; ===========================================================================

loc_71B82:
		lea	($FFF000).l,a6
		clr.b	$E(a6)
		tst.b	3(a6)		; is music paused?
		bne.w	loc_71E50	; if yes, branch
		subq.b	#1,1(a6)
		bne.s	loc_71B9E
		jsr	sub_7260C(pc)

loc_71B9E:
		move.b	4(a6),d0
		beq.s	loc_71BA8
		jsr	sub_72504(pc)

loc_71BA8:
		tst.b	$24(a6)
		beq.s	loc_71BB2
		jsr	sub_7267C(pc)

loc_71BB2:
		tst.w	$A(a6)		; is music or sound being played?
		beq.s	loc_71BBC	; if not, branch
		jsr	Sound_Play(pc)

loc_71BBC:
		cmpi.b	#$80,9(a6)
		beq.s	loc_71BC8
		jsr	Sound_ChkValue(pc)

loc_71BC8:
		lea	$40(a6),a5
		tst.b	(a5)
		bpl.s	loc_71BD4
		jsr	sub_71C4E(pc)

loc_71BD4:
		clr.b	8(a6)
		moveq	#5,d7

loc_71BDA:
		adda.w	#$30,a5
		tst.b	(a5)
		bpl.s	loc_71BE6
		jsr	sub_71CCA(pc)

loc_71BE6:
		dbf	d7,loc_71BDA

		moveq	#2,d7

loc_71BEC:
		adda.w	#$30,a5
		tst.b	(a5)
		bpl.s	loc_71BF8
		jsr	sub_72850(pc)

loc_71BF8:
		dbf	d7,loc_71BEC

		move.b	#$80,$E(a6)
		moveq	#2,d7

loc_71C04:
		adda.w	#$30,a5
		tst.b	(a5)
		bpl.s	loc_71C10
		jsr	sub_71CCA(pc)

loc_71C10:
		dbf	d7,loc_71C04

		moveq	#2,d7

loc_71C16:
		adda.w	#$30,a5
		tst.b	(a5)
		bpl.s	loc_71C22
		jsr	sub_72850(pc)

loc_71C22:
		dbf	d7,loc_71C16
		move.b	#$40,$E(a6)
		adda.w	#$30,a5
		tst.b	(a5)
		bpl.s	loc_71C38
		jsr	sub_71CCA(pc)

loc_71C38:
		adda.w	#$30,a5
		tst.b	(a5)
		bpl.s	loc_71C44
		jsr	sub_72850(pc)

loc_71C44:
		move.w	#0,($A11100).l	; start	the Z80
		rts	
; End of function sub_71B4C


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


sub_71C4E:				; XREF: sub_71B4C
		subq.b	#1,$E(a5)
		bne.s	locret_71CAA
		move.b	#$80,8(a6)
		movea.l	4(a5),a4

loc_71C5E:
		moveq	#0,d5
		move.b	(a4)+,d5
		cmpi.b	#-$20,d5
		bcs.s	loc_71C6E
		jsr	sub_72A5A(pc)
		bra.s	loc_71C5E
; ===========================================================================

loc_71C6E:
		tst.b	d5
		bpl.s	loc_71C84
		move.b	d5,$10(a5)
		move.b	(a4)+,d5
		bpl.s	loc_71C84
		subq.w	#1,a4
		move.b	$F(a5),$E(a5)
		bra.s	loc_71C88
; ===========================================================================

loc_71C84:
		jsr	sub_71D40(pc)

loc_71C88:
		move.l	a4,4(a5)
		btst	#2,(a5)
		bne.s	locret_71CAA
		moveq	#0,d0
		move.b	$10(a5),d0
		cmpi.b	#$80,d0
		beq.s	locret_71CAA
		btst	#3,d0
		bne.s	loc_71CAC
		move.b	d0,($A01FFF).l

locret_71CAA:
		rts	
; ===========================================================================

loc_71CAC:
		subi.b	#$88,d0
		move.b	byte_71CC4(pc,d0.w),d0
		move.b	d0,($A000EA).l
		move.b	#$83,($A01FFF).l
		rts	
; End of function sub_71C4E

; ===========================================================================
byte_71CC4:	dc.b $12, $15, $1C, $1D, $FF, $FF

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


sub_71CCA:				; XREF: sub_71B4C
		subq.b	#1,$E(a5)
		bne.s	loc_71CE0
		bclr	#4,(a5)
		jsr	sub_71CEC(pc)
		jsr	sub_71E18(pc)
		bra.w	loc_726E2
; ===========================================================================

loc_71CE0:
		jsr	sub_71D9E(pc)
		jsr	sub_71DC6(pc)
		bra.w	loc_71E24
; End of function sub_71CCA


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


sub_71CEC:				; XREF: sub_71CCA
		movea.l	4(a5),a4
		bclr	#1,(a5)

loc_71CF4:
		moveq	#0,d5
		move.b	(a4)+,d5
		cmpi.b	#-$20,d5
		bcs.s	loc_71D04
		jsr	sub_72A5A(pc)
		bra.s	loc_71CF4
; ===========================================================================

loc_71D04:
		jsr	sub_726FE(pc)
		tst.b	d5
		bpl.s	loc_71D1A
		jsr	sub_71D22(pc)
		move.b	(a4)+,d5
		bpl.s	loc_71D1A
		subq.w	#1,a4
		bra.w	sub_71D60
; ===========================================================================

loc_71D1A:
		jsr	sub_71D40(pc)
		bra.w	sub_71D60
; End of function sub_71CEC


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


sub_71D22:				; XREF: sub_71CEC
		subi.b	#$80,d5
		beq.s	loc_71D58
		add.b	8(a5),d5
		andi.w	#$7F,d5
		lsl.w	#1,d5
		lea	word_72790(pc),a0
		move.w	(a0,d5.w),d6
		move.w	d6,$10(a5)
		rts	
; End of function sub_71D22


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


sub_71D40:				; XREF: sub_71C4E; sub_71CEC; sub_72878
		move.b	d5,d0
		move.b	2(a5),d1

loc_71D46:
		subq.b	#1,d1
		beq.s	loc_71D4E
		add.b	d5,d0
		bra.s	loc_71D46
; ===========================================================================

loc_71D4E:
		move.b	d0,$F(a5)
		move.b	d0,$E(a5)
		rts	
; End of function sub_71D40

; ===========================================================================

loc_71D58:				; XREF: sub_71D22
		bset	#1,(a5)
		clr.w	$10(a5)

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


sub_71D60:				; XREF: sub_71CEC; sub_72878; sub_728AC
		move.l	a4,4(a5)
		move.b	$F(a5),$E(a5)
		btst	#4,(a5)
		bne.s	locret_71D9C
		move.b	$13(a5),$12(a5)
		clr.b	$C(a5)
		btst	#3,(a5)
		beq.s	locret_71D9C
		movea.l	$14(a5),a0
		move.b	(a0)+,$18(a5)
		move.b	(a0)+,$19(a5)
		move.b	(a0)+,$1A(a5)
		move.b	(a0)+,d0
		lsr.b	#1,d0
		move.b	d0,$1B(a5)
		clr.w	$1C(a5)

locret_71D9C:
		rts	
; End of function sub_71D60


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


sub_71D9E:				; XREF: sub_71CCA; sub_72850
		tst.b	$12(a5)
		beq.s	locret_71DC4
		subq.b	#1,$12(a5)
		bne.s	locret_71DC4
		bset	#1,(a5)
		tst.b	1(a5)
		bmi.w	loc_71DBE
		jsr	sub_726FE(pc)
		addq.w	#4,sp
		rts	
; ===========================================================================

loc_71DBE:
		jsr	sub_729A0(pc)
		addq.w	#4,sp

locret_71DC4:
		rts	
; End of function sub_71D9E


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


sub_71DC6:				; XREF: sub_71CCA; sub_72850
		addq.w	#4,sp
		btst	#3,(a5)
		beq.s	locret_71E16
		tst.b	$18(a5)
		beq.s	loc_71DDA
		subq.b	#1,$18(a5)
		rts	
; ===========================================================================

loc_71DDA:
		subq.b	#1,$19(a5)
		beq.s	loc_71DE2
		rts	
; ===========================================================================

loc_71DE2:
		movea.l	$14(a5),a0
		move.b	1(a0),$19(a5)
		tst.b	$1B(a5)
		bne.s	loc_71DFE
		move.b	3(a0),$1B(a5)
		neg.b	$1A(a5)
		rts	
; ===========================================================================

loc_71DFE:
		subq.b	#1,$1B(a5)
		move.b	$1A(a5),d6
		ext.w	d6
		add.w	$1C(a5),d6
		move.w	d6,$1C(a5)
		add.w	$10(a5),d6
		subq.w	#4,sp

locret_71E16:
		rts	
; End of function sub_71DC6



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


sub_71E18:				; XREF: sub_71CCA
		btst	#1,(a5)
		bne.s	locret_71E48
		move.w	$10(a5),d6
		beq.s	loc_71E4A

loc_71E24:				; XREF: sub_71CCA
		move.b	$1E(a5),d0
		ext.w	d0
		add.w	d0,d6
		btst	#2,(a5)
		bne.s	locret_71E48
		move.w	d6,d1
		lsr.w	#8,d1
		move.b	#-$5C,d0
		jsr	sub_72722(pc)
		move.b	d6,d1
		move.b	#-$60,d0
		jsr	sub_72722(pc)

locret_71E48:
		rts	
; ===========================================================================

loc_71E4A:
		bset	#1,(a5)
		rts	
; End of function sub_71E18

; ===========================================================================

loc_71E50:				; XREF: sub_71B4C
		bmi.s	loc_71E94
		cmpi.b	#2,3(a6)
		beq.w	loc_71EFE
		move.b	#2,3(a6)
		moveq	#2,d3
		move.b	#-$4C,d0
		moveq	#0,d1

loc_71E6A:
		jsr	sub_7272E(pc)
		jsr	sub_72764(pc)
		addq.b	#1,d0
		dbf	d3,loc_71E6A

		moveq	#2,d3
		moveq	#$28,d0

loc_71E7C:
		move.b	d3,d1
		jsr	sub_7272E(pc)
		addq.b	#4,d1
		jsr	sub_7272E(pc)
		dbf	d3,loc_71E7C

		jsr	sub_729B6(pc)
		bra.w	loc_71C44
; ===========================================================================

loc_71E94:				; XREF: loc_71E50
		clr.b	3(a6)
		moveq	#$30,d3
		lea	$40(a6),a5
		moveq	#6,d4

loc_71EA0:
		btst	#7,(a5)
		beq.s	loc_71EB8
		btst	#2,(a5)
		bne.s	loc_71EB8
		move.b	#-$4C,d0
		move.b	$A(a5),d1
		jsr	sub_72722(pc)

loc_71EB8:
		adda.w	d3,a5
		dbf	d4,loc_71EA0

		lea	$220(a6),a5
		moveq	#2,d4

loc_71EC4:
		btst	#7,(a5)
		beq.s	loc_71EDC
		btst	#2,(a5)
		bne.s	loc_71EDC
		move.b	#-$4C,d0
		move.b	$A(a5),d1
		jsr	sub_72722(pc)

loc_71EDC:
		adda.w	d3,a5
		dbf	d4,loc_71EC4

		lea	$340(a6),a5
		btst	#7,(a5)
		beq.s	loc_71EFE
		btst	#2,(a5)
		bne.s	loc_71EFE
		move.b	#-$4C,d0
		move.b	$A(a5),d1
		jsr	sub_72722(pc)

loc_71EFE:
		bra.w	loc_71C44

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

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


Sound_Play:				; XREF: sub_71B4C
		movea.l	(Go_SoundTypes).l,a0
		lea	$A(a6),a1	; load music track number
		move.b	0(a6),d3
		moveq	#2,d4

loc_71F12:
		move.b	(a1),d0		; move track number to d0
		move.b	d0,d1
		clr.b	(a1)+
		subi.b	#$81,d0
		bcs.s	loc_71F3E
		cmpi.b	#$80,9(a6)
		beq.s	loc_71F2C
		move.b	d1,$A(a6)
		bra.s	loc_71F3E
; ===========================================================================

loc_71F2C:
		andi.w	#$7F,d0
		move.b	(a0,d0.w),d2
		cmp.b	d3,d2
		bcs.s	loc_71F3E
		move.b	d2,d3
		move.b	d1,9(a6)	; set music flag

loc_71F3E:
		dbf	d4,loc_71F12

		tst.b	d3
		bmi.s	locret_71F4A
		move.b	d3,0(a6)

locret_71F4A:
		rts	
; End of function Sound_Play


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


Sound_ChkValue:				; XREF: sub_71B4C
		moveq	#0,d7
		move.b	9(a6),d7
		beq.w	Sound_E4
		bpl.s	locret_71F8C
		move.b	#$80,9(a6)	; reset	music flag
		cmpi.b	#$9F,d7
		bls.w	Sound_81to9F	; music	$81-$9F
		cmpi.b	#$A0,d7
		bcs.w	locret_71F8C
		cmpi.b	#$CF,d7
		bls.w	Sound_A0toCF	; sound	$A0-$CF
		cmpi.b	#$D0,d7
		bcs.w	locret_71F8C
		cmpi.b	#$E0,d7
		bcs.w	Sound_D0toDF	; sound	$D0-$DF
		cmpi.b	#$E4,d7
		bls.s	Sound_E0toE4	; sound	$E0-$E4

locret_71F8C:
		rts	
; ===========================================================================

Sound_E0toE4:				; XREF: Sound_ChkValue
		subi.b	#$E0,d7
		lsl.w	#2,d7
		jmp	Sound_ExIndex(pc,d7.w)
; ===========================================================================

Sound_ExIndex:
		bra.w	Sound_E0
; ===========================================================================
		bra.w	Sound_E1
; ===========================================================================
		bra.w	Sound_E2
; ===========================================================================
		bra.w	Sound_E3
; ===========================================================================
		bra.w	Sound_E4
; ===========================================================================
; ---------------------------------------------------------------------------
; Play "Say-gaa" PCM sound
; ---------------------------------------------------------------------------

Sound_E1:				; XREF: Sound_ExIndex
		move.b	#$88,($A01FFF).l
		move.w	#0,($A11100).l	; start	the Z80
		move.w	#$11,d1

loc_71FC0:
		move.w	#-1,d0

loc_71FC4:
		nop	
		dbf	d0,loc_71FC4

		dbf	d1,loc_71FC0

		addq.w	#4,sp
		rts	
; ===========================================================================
; ---------------------------------------------------------------------------
; Play music track $81-$9F
; ---------------------------------------------------------------------------

Sound_81to9F:				; XREF: Sound_ChkValue
		cmpi.b	#$88,d7		; is "extra life" music	played?
		bne.s	loc_72024	; if not, branch
		tst.b	$27(a6)
		bne.w	loc_721B6
		lea	$40(a6),a5
		moveq	#9,d0

loc_71FE6:
		bclr	#2,(a5)
		adda.w	#$30,a5
		dbf	d0,loc_71FE6

		lea	$220(a6),a5
		moveq	#5,d0

loc_71FF8:
		bclr	#7,(a5)
		adda.w	#$30,a5
		dbf	d0,loc_71FF8
		clr.b	0(a6)
		movea.l	a6,a0
		lea	$3A0(a6),a1
		move.w	#$87,d0

loc_72012:
		move.l	(a0)+,(a1)+
		dbf	d0,loc_72012

		move.b	#$80,$27(a6)
		clr.b	0(a6)
		bra.s	loc_7202C
; ===========================================================================

loc_72024:
		clr.b	$27(a6)
		clr.b	$26(a6)

loc_7202C:
		jsr	sub_725CA(pc)
		movea.l	(off_719A0).l,a4
		subi.b	#$81,d7
		move.b	(a4,d7.w),$29(a6)
		movea.l	(Go_MusicIndex).l,a4
		lsl.w	#2,d7
		movea.l	(a4,d7.w),a4
		moveq	#0,d0
		move.w	(a4),d0
		add.l	a4,d0
		move.l	d0,$18(a6)
		move.b	5(a4),d0
		move.b	d0,$28(a6)
		tst.b	$2A(a6)
		beq.s	loc_72068
		move.b	$29(a6),d0

loc_72068:
		move.b	d0,2(a6)
		move.b	d0,1(a6)
		moveq	#0,d1
		movea.l	a4,a3
		addq.w	#6,a4
		moveq	#0,d7
		move.b	2(a3),d7
		beq.w	loc_72114
		subq.b	#1,d7
		move.b	#-$40,d1
		move.b	4(a3),d4
		moveq	#$30,d6
		move.b	#1,d5
		lea	$40(a6),a1
		lea	byte_721BA(pc),a2

loc_72098:
		bset	#7,(a1)
		move.b	(a2)+,1(a1)
		move.b	d4,2(a1)
		move.b	d6,$D(a1)
		move.b	d1,$A(a1)
		move.b	d5,$E(a1)
		moveq	#0,d0
		move.w	(a4)+,d0
		add.l	a3,d0
		move.l	d0,4(a1)
		move.w	(a4)+,8(a1)
		adda.w	d6,a1
		dbf	d7,loc_72098
		cmpi.b	#7,2(a3)
		bne.s	loc_720D8
		moveq	#$2B,d0
		moveq	#0,d1
		jsr	sub_7272E(pc)
		bra.w	loc_72114
; ===========================================================================

loc_720D8:
		moveq	#$28,d0
		moveq	#6,d1
		jsr	sub_7272E(pc)
		move.b	#$42,d0
		moveq	#$7F,d1
		jsr	sub_72764(pc)
		move.b	#$4A,d0
		moveq	#$7F,d1
		jsr	sub_72764(pc)
		move.b	#$46,d0
		moveq	#$7F,d1
		jsr	sub_72764(pc)
		move.b	#$4E,d0
		moveq	#$7F,d1
		jsr	sub_72764(pc)
		move.b	#-$4A,d0
		move.b	#-$40,d1
		jsr	sub_72764(pc)

loc_72114:
		moveq	#0,d7
		move.b	3(a3),d7
		beq.s	loc_72154
		subq.b	#1,d7
		lea	$190(a6),a1
		lea	byte_721C2(pc),a2

loc_72126:
		bset	#7,(a1)
		move.b	(a2)+,1(a1)
		move.b	d4,2(a1)
		move.b	d6,$D(a1)
		move.b	d5,$E(a1)
		moveq	#0,d0
		move.w	(a4)+,d0
		add.l	a3,d0
		move.l	d0,4(a1)
		move.w	(a4)+,8(a1)
		move.b	(a4)+,d0
		move.b	(a4)+,$B(a1)
		adda.w	d6,a1
		dbf	d7,loc_72126

loc_72154:
		lea	$220(a6),a1
		moveq	#5,d7

loc_7215A:
		tst.b	(a1)
		bpl.w	loc_7217C
		moveq	#0,d0
		move.b	1(a1),d0
		bmi.s	loc_7216E
		subq.b	#2,d0
		lsl.b	#2,d0
		bra.s	loc_72170
; ===========================================================================

loc_7216E:
		lsr.b	#3,d0

loc_72170:
		lea	dword_722CC(pc),a0
		movea.l	(a0,d0.w),a0
		bset	#2,(a0)

loc_7217C:
		adda.w	d6,a1
		dbf	d7,loc_7215A

		tst.w	$340(a6)
		bpl.s	loc_7218E
		bset	#2,$100(a6)

loc_7218E:
		tst.w	$370(a6)
		bpl.s	loc_7219A
		bset	#2,$1F0(a6)

loc_7219A:
		lea	$70(a6),a5
		moveq	#5,d4

loc_721A0:
		jsr	sub_726FE(pc)
		adda.w	d6,a5
		dbf	d4,loc_721A0
		moveq	#2,d4

loc_721AC:
		jsr	sub_729A0(pc)
		adda.w	d6,a5
		dbf	d4,loc_721AC

loc_721B6:
		addq.w	#4,sp
		rts	
; ===========================================================================
byte_721BA:	dc.b 6,	0, 1, 2, 4, 5, 6, 0
		align 2
byte_721C2:	dc.b $80, $A0, $C0, 0
		align 2
; ===========================================================================
; ---------------------------------------------------------------------------
; Play normal sound effect
; ---------------------------------------------------------------------------

Sound_A0toCF:				; XREF: Sound_ChkValue
		tst.b	$27(a6)
		bne.w	loc_722C6
		tst.b	4(a6)
		bne.w	loc_722C6
		tst.b	$24(a6)
		bne.w	loc_722C6
		cmpi.b	#$B5,d7		; is ring sound	effect played?
		bne.s	Sound_notB5	; if not, branch
		tst.b	$2B(a6)
		bne.s	loc_721EE
		move.b	#$CE,d7		; play ring sound in left speaker

loc_721EE:
		bchg	#0,$2B(a6)	; change speaker

Sound_notB5:
		cmpi.b	#$A7,d7		; is "pushing" sound played?
		bne.s	Sound_notA7	; if not, branch
		tst.b	$2C(a6)
		bne.w	locret_722C4
		move.b	#$80,$2C(a6)

Sound_notA7:
		movea.l	(Go_SoundIndex).l,a0
		subi.b	#$A0,d7
		lsl.w	#2,d7
		movea.l	(a0,d7.w),a3
		movea.l	a3,a1
		moveq	#0,d1
		move.w	(a1)+,d1
		add.l	a3,d1
		move.b	(a1)+,d5
		move.b	(a1)+,d7
		subq.b	#1,d7
		moveq	#$30,d6

loc_72228:
		moveq	#0,d3
		move.b	1(a1),d3
		move.b	d3,d4
		bmi.s	loc_72244
		subq.w	#2,d3
		lsl.w	#2,d3
		lea	dword_722CC(pc),a5
		movea.l	(a5,d3.w),a5
		bset	#2,(a5)
		bra.s	loc_7226E
; ===========================================================================

loc_72244:
		lsr.w	#3,d3
		lea	dword_722CC(pc),a5
		movea.l	(a5,d3.w),a5
		bset	#2,(a5)
		cmpi.b	#$C0,d4
		bne.s	loc_7226E
		move.b	d4,d0
		ori.b	#$1F,d0
		move.b	d0,($C00011).l
		bchg	#5,d0
		move.b	d0,($C00011).l

loc_7226E:
		movea.l	dword_722EC(pc,d3.w),a5
		movea.l	a5,a2
		moveq	#$B,d0

loc_72276:
		clr.l	(a2)+
		dbf	d0,loc_72276

		move.w	(a1)+,(a5)
		move.b	d5,2(a5)
		moveq	#0,d0
		move.w	(a1)+,d0
		add.l	a3,d0
		move.l	d0,4(a5)
		move.w	(a1)+,8(a5)
		move.b	#1,$E(a5)
		move.b	d6,$D(a5)
		tst.b	d4
		bmi.s	loc_722A8
		move.b	#$C0,$A(a5)
		move.l	d1,$20(a5)

loc_722A8:
		dbf	d7,loc_72228

		tst.b	$250(a6)
		bpl.s	loc_722B8
		bset	#2,$340(a6)

loc_722B8:
		tst.b	$310(a6)
		bpl.s	locret_722C4
		bset	#2,$370(a6)

locret_722C4:
		rts	
; ===========================================================================

loc_722C6:
		clr.b	0(a6)
		rts	
; ===========================================================================
dword_722CC:	dc.l $FFF0D0
		dc.l 0
		dc.l $FFF100
		dc.l $FFF130
		dc.l $FFF190
		dc.l $FFF1C0
		dc.l $FFF1F0
		dc.l $FFF1F0
dword_722EC:	dc.l $FFF220
		dc.l 0
		dc.l $FFF250
		dc.l $FFF280
		dc.l $FFF2B0
		dc.l $FFF2E0
		dc.l $FFF310
		dc.l $FFF310
; ===========================================================================
; ---------------------------------------------------------------------------
; Play GHZ waterfall sound
; ---------------------------------------------------------------------------

Sound_D0toDF:				; XREF: Sound_ChkValue
		tst.b	$27(a6)
		bne.w	locret_723C6
		tst.b	4(a6)
		bne.w	locret_723C6
		tst.b	$24(a6)
		bne.w	locret_723C6
		movea.l	(Go_SoundD0).l,a0
		subi.b	#$D0,d7
		lsl.w	#2,d7
		movea.l	(a0,d7.w),a3
		movea.l	a3,a1
		moveq	#0,d0
		move.w	(a1)+,d0
		add.l	a3,d0
		move.l	d0,$20(a6)
		move.b	(a1)+,d5
		move.b	(a1)+,d7
		subq.b	#1,d7
		moveq	#$30,d6

loc_72348:
		move.b	1(a1),d4
		bmi.s	loc_7235A
		bset	#2,$100(a6)
		lea	$340(a6),a5
		bra.s	loc_72364
; ===========================================================================

loc_7235A:
		bset	#2,$1F0(a6)
		lea	$370(a6),a5

loc_72364:
		movea.l	a5,a2
		moveq	#$B,d0

loc_72368:
		clr.l	(a2)+
		dbf	d0,loc_72368

		move.w	(a1)+,(a5)
		move.b	d5,2(a5)
		moveq	#0,d0
		move.w	(a1)+,d0
		add.l	a3,d0
		move.l	d0,4(a5)
		move.w	(a1)+,8(a5)
		move.b	#1,$E(a5)
		move.b	d6,$D(a5)
		tst.b	d4
		bmi.s	loc_72396
		move.b	#$C0,$A(a5)

loc_72396:
		dbf	d7,loc_72348

		tst.b	$250(a6)
		bpl.s	loc_723A6
		bset	#2,$340(a6)

loc_723A6:
		tst.b	$310(a6)
		bpl.s	locret_723C6
		bset	#2,$370(a6)
		ori.b	#$1F,d4
		move.b	d4,($C00011).l
		bchg	#5,d4
		move.b	d4,($C00011).l

locret_723C6:
		rts	
; End of function Sound_ChkValue

; ===========================================================================
		dc.l $FFF100
		dc.l $FFF1F0
		dc.l $FFF250
		dc.l $FFF310
		dc.l $FFF340
		dc.l $FFF370

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


Snd_FadeOut1:				; XREF: Sound_E0
		clr.b	0(a6)
		lea	$220(a6),a5
		moveq	#5,d7

loc_723EA:
		tst.b	(a5)
		bpl.w	loc_72472
		bclr	#7,(a5)
		moveq	#0,d3
		move.b	1(a5),d3
		bmi.s	loc_7243C
		jsr	sub_726FE(pc)
		cmpi.b	#4,d3
		bne.s	loc_72416
		tst.b	$340(a6)
		bpl.s	loc_72416
		lea	$340(a6),a5
		movea.l	$20(a6),a1
		bra.s	loc_72428
; ===========================================================================

loc_72416:
		subq.b	#2,d3
		lsl.b	#2,d3
		lea	dword_722CC(pc),a0
		movea.l	a5,a3
		movea.l	(a0,d3.w),a5
		movea.l	$18(a6),a1

loc_72428:
		bclr	#2,(a5)
		bset	#1,(a5)
		move.b	$B(a5),d0
		jsr	sub_72C4E(pc)
		movea.l	a3,a5
		bra.s	loc_72472
; ===========================================================================

loc_7243C:
		jsr	sub_729A0(pc)
		lea	$370(a6),a0
		cmpi.b	#$E0,d3
		beq.s	loc_7245A
		cmpi.b	#$C0,d3
		beq.s	loc_7245A
		lsr.b	#3,d3
		lea	dword_722CC(pc),a0
		movea.l	(a0,d3.w),a0

loc_7245A:
		bclr	#2,(a0)
		bset	#1,(a0)
		cmpi.b	#$E0,1(a0)
		bne.s	loc_72472
		move.b	$1F(a0),($C00011).l

loc_72472:
		adda.w	#$30,a5
		dbf	d7,loc_723EA

		rts	
; End of function Snd_FadeOut1


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


Snd_FadeOut2:				; XREF: Sound_E0
		lea	$340(a6),a5
		tst.b	(a5)
		bpl.s	loc_724AE
		bclr	#7,(a5)
		btst	#2,(a5)
		bne.s	loc_724AE
		jsr	loc_7270A(pc)
		lea	$100(a6),a5
		bclr	#2,(a5)
		bset	#1,(a5)
		tst.b	(a5)
		bpl.s	loc_724AE
		movea.l	$18(a6),a1
		move.b	$B(a5),d0
		jsr	sub_72C4E(pc)

loc_724AE:
		lea	$370(a6),a5
		tst.b	(a5)
		bpl.s	locret_724E4
		bclr	#7,(a5)
		btst	#2,(a5)
		bne.s	locret_724E4
		jsr	loc_729A6(pc)
		lea	$1F0(a6),a5
		bclr	#2,(a5)
		bset	#1,(a5)
		tst.b	(a5)
		bpl.s	locret_724E4
		cmpi.b	#-$20,1(a5)
		bne.s	locret_724E4
		move.b	$1F(a5),($C00011).l

locret_724E4:
		rts	
; End of function Snd_FadeOut2

; ===========================================================================
; ---------------------------------------------------------------------------
; Fade out music
; ---------------------------------------------------------------------------

Sound_E0:				; XREF: Sound_ExIndex
		jsr	Snd_FadeOut1(pc)
		jsr	Snd_FadeOut2(pc)
		move.b	#3,6(a6)
		move.b	#$28,4(a6)
		clr.b	$40(a6)
		clr.b	$2A(a6)
		rts	

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


sub_72504:				; XREF: sub_71B4C
		move.b	6(a6),d0
		beq.s	loc_72510
		subq.b	#1,6(a6)
		rts	
; ===========================================================================

loc_72510:
		subq.b	#1,4(a6)
		beq.w	Sound_E4
		move.b	#3,6(a6)
		lea	$70(a6),a5
		moveq	#5,d7

loc_72524:
		tst.b	(a5)
		bpl.s	loc_72538
		addq.b	#1,9(a5)
		bpl.s	loc_72534
		bclr	#7,(a5)
		bra.s	loc_72538
; ===========================================================================

loc_72534:
		jsr	sub_72CB4(pc)

loc_72538:
		adda.w	#$30,a5
		dbf	d7,loc_72524

		moveq	#2,d7

loc_72542:
		tst.b	(a5)
		bpl.s	loc_72560
		addq.b	#1,9(a5)
		cmpi.b	#$10,9(a5)
		bcs.s	loc_72558
		bclr	#7,(a5)
		bra.s	loc_72560
; ===========================================================================

loc_72558:
		move.b	9(a5),d6
		jsr	sub_7296A(pc)

loc_72560:
		adda.w	#$30,a5
		dbf	d7,loc_72542

		rts	
; End of function sub_72504


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


sub_7256A:				; XREF: Sound_E4; sub_725CA
		moveq	#2,d3
		moveq	#$28,d0

loc_7256E:
		move.b	d3,d1
		jsr	sub_7272E(pc)
		addq.b	#4,d1
		jsr	sub_7272E(pc)
		dbf	d3,loc_7256E

		moveq	#$40,d0
		moveq	#$7F,d1
		moveq	#2,d4

loc_72584:
		moveq	#3,d3

loc_72586:
		jsr	sub_7272E(pc)
		jsr	sub_72764(pc)
		addq.w	#4,d0
		dbf	d3,loc_72586

		subi.b	#$F,d0
		dbf	d4,loc_72584

		rts	
; End of function sub_7256A

; ===========================================================================
; ---------------------------------------------------------------------------
; Stop music
; ---------------------------------------------------------------------------

Sound_E4:				; XREF: Sound_ChkValue; Sound_ExIndex; sub_72504
		moveq	#$2B,d0
		move.b	#$80,d1
		jsr	sub_7272E(pc)
		moveq	#$27,d0
		moveq	#0,d1
		jsr	sub_7272E(pc)
		movea.l	a6,a0
		move.w	#$E3,d0

loc_725B6:
		clr.l	(a0)+
		dbf	d0,loc_725B6

		move.b	#$80,9(a6)	; set music to $80 (silence)
		jsr	sub_7256A(pc)
		bra.w	sub_729B6

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


sub_725CA:				; XREF: Sound_ChkValue
		movea.l	a6,a0
		move.b	0(a6),d1
		move.b	$27(a6),d2
		move.b	$2A(a6),d3
		move.b	$26(a6),d4
		move.w	$A(a6),d5
		move.w	#$87,d0

loc_725E4:
		clr.l	(a0)+
		dbf	d0,loc_725E4

		move.b	d1,0(a6)
		move.b	d2,$27(a6)
		move.b	d3,$2A(a6)
		move.b	d4,$26(a6)
		move.w	d5,$A(a6)
		move.b	#$80,9(a6)
		jsr	sub_7256A(pc)
		bra.w	sub_729B6
; End of function sub_725CA


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


sub_7260C:				; XREF: sub_71B4C
		move.b	2(a6),1(a6)
		lea	$4E(a6),a0
		moveq	#$30,d0
		moveq	#9,d1

loc_7261A:
		addq.b	#1,(a0)
		adda.w	d0,a0
		dbf	d1,loc_7261A

		rts	
; End of function sub_7260C

; ===========================================================================
; ---------------------------------------------------------------------------
; Speed	up music
; ---------------------------------------------------------------------------

Sound_E2:				; XREF: Sound_ExIndex
		tst.b	$27(a6)
		bne.s	loc_7263E
		move.b	$29(a6),2(a6)
		move.b	$29(a6),1(a6)
		move.b	#$80,$2A(a6)
		rts	
; ===========================================================================

loc_7263E:
		move.b	$3C9(a6),$3A2(a6)
		move.b	$3C9(a6),$3A1(a6)
		move.b	#$80,$3CA(a6)
		rts	
; ===========================================================================
; ---------------------------------------------------------------------------
; Change music back to normal speed
; ---------------------------------------------------------------------------

Sound_E3:				; XREF: Sound_ExIndex
		tst.b	$27(a6)
		bne.s	loc_7266A
		move.b	$28(a6),2(a6)
		move.b	$28(a6),1(a6)
		clr.b	$2A(a6)
		rts	
; ===========================================================================

loc_7266A:
		move.b	$3C8(a6),$3A2(a6)
		move.b	$3C8(a6),$3A1(a6)
		clr.b	$3CA(a6)
		rts	

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


sub_7267C:				; XREF: sub_71B4C
		tst.b	$25(a6)
		beq.s	loc_72688
		subq.b	#1,$25(a6)
		rts	
; ===========================================================================

loc_72688:
		tst.b	$26(a6)
		beq.s	loc_726D6
		subq.b	#1,$26(a6)
		move.b	#2,$25(a6)
		lea	$70(a6),a5
		moveq	#5,d7

loc_7269E:
		tst.b	(a5)
		bpl.s	loc_726AA
		subq.b	#1,9(a5)
		jsr	sub_72CB4(pc)

loc_726AA:
		adda.w	#$30,a5
		dbf	d7,loc_7269E
		moveq	#2,d7

loc_726B4:
		tst.b	(a5)
		bpl.s	loc_726CC
		subq.b	#1,9(a5)
		move.b	9(a5),d6
		cmpi.b	#$10,d6
		bcs.s	loc_726C8
		moveq	#$F,d6

loc_726C8:
		jsr	sub_7296A(pc)

loc_726CC:
		adda.w	#$30,a5
		dbf	d7,loc_726B4
		rts	
; ===========================================================================

loc_726D6:
		bclr	#2,$40(a6)
		clr.b	$24(a6)
		rts	
; End of function sub_7267C

; ===========================================================================

loc_726E2:				; XREF: sub_71CCA
		btst	#1,(a5)
		bne.s	locret_726FC
		btst	#2,(a5)
		bne.s	locret_726FC
		moveq	#$28,d0
		move.b	1(a5),d1
		ori.b	#-$10,d1
		bra.w	sub_7272E
; ===========================================================================

locret_726FC:
		rts	

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


sub_726FE:				; XREF: sub_71CEC; sub_71D9E; Sound_ChkValue; Snd_FadeOut1
		btst	#4,(a5)
		bne.s	locret_72714
		btst	#2,(a5)
		bne.s	locret_72714

loc_7270A:				; XREF: Snd_FadeOut2
		moveq	#$28,d0
		move.b	1(a5),d1
		bra.w	sub_7272E
; ===========================================================================

locret_72714:
		rts	
; End of function sub_726FE

; ===========================================================================

loc_72716:				; XREF: sub_72A5A
		btst	#2,(a5)
		bne.s	locret_72720
		bra.w	sub_72722
; ===========================================================================

locret_72720:
		rts	

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


sub_72722:				; XREF: sub_71E18; sub_72C4E; sub_72CB4
		btst	#2,1(a5)
		bne.s	loc_7275A
		add.b	1(a5),d0
; End of function sub_72722


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


sub_7272E:				; XREF: loc_71E6A
		move.b	($A04000).l,d2
		btst	#7,d2
		bne.s	sub_7272E
		move.b	d0,($A04000).l
		nop	
		nop	
		nop	

loc_72746:
		move.b	($A04000).l,d2
		btst	#7,d2
		bne.s	loc_72746

		move.b	d1,($A04001).l
		rts	
; End of function sub_7272E

; ===========================================================================

loc_7275A:				; XREF: sub_72722
		move.b	1(a5),d2
		bclr	#2,d2
		add.b	d2,d0

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


sub_72764:				; XREF: loc_71E6A; Sound_ChkValue; sub_7256A; sub_72764
		move.b	($A04000).l,d2
		btst	#7,d2
		bne.s	sub_72764
		move.b	d0,($A04002).l
		nop	
		nop	
		nop	

loc_7277C:
		move.b	($A04000).l,d2
		btst	#7,d2
		bne.s	loc_7277C

		move.b	d1,($A04003).l
		rts	
; End of function sub_72764

; ===========================================================================
word_72790:	dc.w $25E, $284, $2AB, $2D3, $2FE, $32D, $35C, $38F, $3C5
		dc.w $3FF, $43C, $47C, $A5E, $A84, $AAB, $AD3, $AFE, $B2D
		dc.w $B5C, $B8F, $BC5, $BFF, $C3C, $C7C, $125E,	$1284
		dc.w $12AB, $12D3, $12FE, $132D, $135C,	$138F, $13C5, $13FF
		dc.w $143C, $147C, $1A5E, $1A84, $1AAB,	$1AD3, $1AFE, $1B2D
		dc.w $1B5C, $1B8F, $1BC5, $1BFF, $1C3C,	$1C7C, $225E, $2284
		dc.w $22AB, $22D3, $22FE, $232D, $235C,	$238F, $23C5, $23FF
		dc.w $243C, $247C, $2A5E, $2A84, $2AAB,	$2AD3, $2AFE, $2B2D
		dc.w $2B5C, $2B8F, $2BC5, $2BFF, $2C3C,	$2C7C, $325E, $3284
		dc.w $32AB, $32D3, $32FE, $332D, $335C,	$338F, $33C5, $33FF
		dc.w $343C, $347C, $3A5E, $3A84, $3AAB,	$3AD3, $3AFE, $3B2D
		dc.w $3B5C, $3B8F, $3BC5, $3BFF, $3C3C,	$3C7C

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


sub_72850:				; XREF: sub_71B4C
		subq.b	#1,$E(a5)
		bne.s	loc_72866
		bclr	#4,(a5)
		jsr	sub_72878(pc)
		jsr	sub_728DC(pc)
		bra.w	loc_7292E
; ===========================================================================

loc_72866:
		jsr	sub_71D9E(pc)
		jsr	sub_72926(pc)
		jsr	sub_71DC6(pc)
		jsr	sub_728E2(pc)
		rts	
; End of function sub_72850


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


sub_72878:				; XREF: sub_72850
		bclr	#1,(a5)
		movea.l	4(a5),a4

loc_72880:
		moveq	#0,d5
		move.b	(a4)+,d5
		cmpi.b	#$E0,d5
		bcs.s	loc_72890
		jsr	sub_72A5A(pc)
		bra.s	loc_72880
; ===========================================================================

loc_72890:
		tst.b	d5
		bpl.s	loc_728A4
		jsr	sub_728AC(pc)
		move.b	(a4)+,d5
		tst.b	d5
		bpl.s	loc_728A4
		subq.w	#1,a4
		bra.w	sub_71D60
; ===========================================================================

loc_728A4:
		jsr	sub_71D40(pc)
		bra.w	sub_71D60
; End of function sub_72878


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


sub_728AC:				; XREF: sub_72878
		subi.b	#$81,d5
		bcs.s	loc_728CA
		add.b	8(a5),d5
		andi.w	#$7F,d5
		lsl.w	#1,d5
		lea	word_729CE(pc),a0
		move.w	(a0,d5.w),$10(a5)
		bra.w	sub_71D60
; ===========================================================================

loc_728CA:
		bset	#1,(a5)
		move.w	#-1,$10(a5)
		jsr	sub_71D60(pc)
		bra.w	sub_729A0
; End of function sub_728AC


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


sub_728DC:				; XREF: sub_72850
		move.w	$10(a5),d6
		bmi.s	loc_72920
; End of function sub_728DC


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


sub_728E2:				; XREF: sub_72850
		move.b	$1E(a5),d0
		ext.w	d0
		add.w	d0,d6
		btst	#2,(a5)
		bne.s	locret_7291E
		btst	#1,(a5)
		bne.s	locret_7291E
		move.b	1(a5),d0
		cmpi.b	#$E0,d0
		bne.s	loc_72904
		move.b	#$C0,d0

loc_72904:
		move.w	d6,d1
		andi.b	#$F,d1
		or.b	d1,d0
		lsr.w	#4,d6
		andi.b	#$3F,d6
		move.b	d0,($C00011).l
		move.b	d6,($C00011).l

locret_7291E:
		rts	
; End of function sub_728E2

; ===========================================================================

loc_72920:				; XREF: sub_728DC
		bset	#1,(a5)
		rts	

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


sub_72926:				; XREF: sub_72850
		tst.b	$B(a5)
		beq.w	locret_7298A

loc_7292E:				; XREF: sub_72850
		move.b	9(a5),d6
		moveq	#0,d0
		move.b	$B(a5),d0
		beq.s	sub_7296A
		movea.l	(Go_PSGIndex).l,a0
		subq.w	#1,d0
		lsl.w	#2,d0
		movea.l	(a0,d0.w),a0
		move.b	$C(a5),d0
		move.b	(a0,d0.w),d0
		addq.b	#1,$C(a5)
		btst	#7,d0
		beq.s	loc_72960
		cmpi.b	#$80,d0
		beq.s	loc_7299A

loc_72960:
		add.w	d0,d6
		cmpi.b	#$10,d6
		bcs.s	sub_7296A
		moveq	#$F,d6
; End of function sub_72926


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


sub_7296A:				; XREF: sub_72504; sub_7267C; sub_72926
		btst	#1,(a5)
		bne.s	locret_7298A
		btst	#2,(a5)
		bne.s	locret_7298A
		btst	#4,(a5)
		bne.s	loc_7298C

loc_7297C:
		or.b	1(a5),d6
		addi.b	#$10,d6
		move.b	d6,($C00011).l

locret_7298A:
		rts	
; ===========================================================================

loc_7298C:
		tst.b	$13(a5)
		beq.s	loc_7297C
		tst.b	$12(a5)
		bne.s	loc_7297C
		rts	
; End of function sub_7296A

; ===========================================================================

loc_7299A:				; XREF: sub_72926
		subq.b	#1,$C(a5)
		rts	

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


sub_729A0:				; XREF: sub_71D9E; Sound_ChkValue; Snd_FadeOut1; sub_728AC
		btst	#2,(a5)
		bne.s	locret_729B4

loc_729A6:				; XREF: Snd_FadeOut2
		move.b	1(a5),d0
		ori.b	#$1F,d0
		move.b	d0,($C00011).l

locret_729B4:
		rts	
; End of function sub_729A0


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


sub_729B6:				; XREF: loc_71E7C
		lea	($C00011).l,a0
		move.b	#$9F,(a0)
		move.b	#$BF,(a0)
		move.b	#$DF,(a0)
		move.b	#$FF,(a0)
		rts	
; End of function sub_729B6

; ===========================================================================
word_729CE:	dc.w $356, $326, $2F9, $2CE, $2A5, $280, $25C, $23A, $21A
		dc.w $1FB, $1DF, $1C4, $1AB, $193, $17D, $167, $153, $140
		dc.w $12E, $11D, $10D, $FE, $EF, $E2, $D6, $C9,	$BE, $B4
		dc.w $A9, $A0, $97, $8F, $87, $7F, $78,	$71, $6B, $65
		dc.w $5F, $5A, $55, $50, $4B, $47, $43,	$40, $3C, $39
		dc.w $36, $33, $30, $2D, $2B, $28, $26,	$24, $22, $20
		dc.w $1F, $1D, $1B, $1A, $18, $17, $16,	$15, $13, $12
		dc.w $11, 0

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


sub_72A5A:				; XREF: sub_71C4E; sub_71CEC; sub_72878
		subi.w	#$E0,d5
		lsl.w	#2,d5
		jmp	loc_72A64(pc,d5.w)
; End of function sub_72A5A

; ===========================================================================

loc_72A64:
		bra.w	loc_72ACC
; ===========================================================================
		bra.w	loc_72AEC
; ===========================================================================
		bra.w	loc_72AF2
; ===========================================================================
		bra.w	loc_72AF8
; ===========================================================================
		bra.w	loc_72B14
; ===========================================================================
		bra.w	loc_72B9E
; ===========================================================================
		bra.w	loc_72BA4
; ===========================================================================
		bra.w	loc_72BAE
; ===========================================================================
		bra.w	loc_72BB4
; ===========================================================================
		bra.w	loc_72BBE
; ===========================================================================
		bra.w	loc_72BC6
; ===========================================================================
		bra.w	loc_72BD0
; ===========================================================================
		bra.w	loc_72BE6
; ===========================================================================
		bra.w	loc_72BEE
; ===========================================================================
		bra.w	loc_72BF4
; ===========================================================================
		bra.w	loc_72C26
; ===========================================================================
		bra.w	loc_72D30
; ===========================================================================
		bra.w	loc_72D52
; ===========================================================================
		bra.w	loc_72D58
; ===========================================================================
		bra.w	loc_72E06
; ===========================================================================
		bra.w	loc_72E20
; ===========================================================================
		bra.w	loc_72E26
; ===========================================================================
		bra.w	loc_72E2C
; ===========================================================================
		bra.w	loc_72E38
; ===========================================================================
		bra.w	loc_72E52
; ===========================================================================
		bra.w	loc_72E64
; ===========================================================================

loc_72ACC:				; XREF: loc_72A64
		move.b	(a4)+,d1
		tst.b	1(a5)
		bmi.s	locret_72AEA
		move.b	$A(a5),d0
		andi.b	#$37,d0
		or.b	d0,d1
		move.b	d1,$A(a5)
		move.b	#$B4,d0
		bra.w	loc_72716
; ===========================================================================

locret_72AEA:
		rts	
; ===========================================================================

loc_72AEC:				; XREF: loc_72A64
		move.b	(a4)+,$1E(a5)
		rts	
; ===========================================================================

loc_72AF2:				; XREF: loc_72A64
		move.b	(a4)+,7(a6)
		rts	
; ===========================================================================

loc_72AF8:				; XREF: loc_72A64
		moveq	#0,d0
		move.b	$D(a5),d0
		movea.l	(a5,d0.w),a4
		move.l	#0,(a5,d0.w)
		addq.w	#2,a4
		addq.b	#4,d0
		move.b	d0,$D(a5)
		rts	
; ===========================================================================

loc_72B14:				; XREF: loc_72A64
		movea.l	a6,a0
		lea	$3A0(a6),a1
		move.w	#$87,d0

loc_72B1E:
		move.l	(a1)+,(a0)+
		dbf	d0,loc_72B1E

		bset	#2,$40(a6)
		movea.l	a5,a3
		move.b	#$28,d6
		sub.b	$26(a6),d6
		moveq	#5,d7
		lea	$70(a6),a5

loc_72B3A:
		btst	#7,(a5)
		beq.s	loc_72B5C
		bset	#1,(a5)
		add.b	d6,9(a5)
		btst	#2,(a5)
		bne.s	loc_72B5C
		moveq	#0,d0
		move.b	$B(a5),d0
		movea.l	$18(a6),a1
		jsr	sub_72C4E(pc)

loc_72B5C:
		adda.w	#$30,a5
		dbf	d7,loc_72B3A

		moveq	#2,d7

loc_72B66:
		btst	#7,(a5)
		beq.s	loc_72B78
		bset	#1,(a5)
		jsr	sub_729A0(pc)
		add.b	d6,9(a5)

loc_72B78:
		adda.w	#$30,a5
		dbf	d7,loc_72B66
		movea.l	a3,a5
		move.b	#$80,$24(a6)
		move.b	#$28,$26(a6)
		clr.b	$27(a6)
		move.w	#0,($A11100).l
		addq.w	#8,sp
		rts	
; ===========================================================================

loc_72B9E:				; XREF: loc_72A64
		move.b	(a4)+,2(a5)
		rts	
; ===========================================================================

loc_72BA4:				; XREF: loc_72A64
		move.b	(a4)+,d0
		add.b	d0,9(a5)
		bra.w	sub_72CB4
; ===========================================================================

loc_72BAE:				; XREF: loc_72A64
		bset	#4,(a5)
		rts	
; ===========================================================================

loc_72BB4:				; XREF: loc_72A64
		move.b	(a4),$12(a5)
		move.b	(a4)+,$13(a5)
		rts	
; ===========================================================================

loc_72BBE:				; XREF: loc_72A64
		move.b	(a4)+,d0
		add.b	d0,8(a5)
		rts	
; ===========================================================================

loc_72BC6:				; XREF: loc_72A64
		move.b	(a4),2(a6)
		move.b	(a4)+,1(a6)
		rts	
; ===========================================================================

loc_72BD0:				; XREF: loc_72A64
		lea	$40(a6),a0
		move.b	(a4)+,d0
		moveq	#$30,d1
		moveq	#9,d2

loc_72BDA:
		move.b	d0,2(a0)
		adda.w	d1,a0
		dbf	d2,loc_72BDA

		rts	
; ===========================================================================

loc_72BE6:				; XREF: loc_72A64
		move.b	(a4)+,d0
		add.b	d0,9(a5)
		rts	
; ===========================================================================

loc_72BEE:				; XREF: loc_72A64
		clr.b	$2C(a6)
		rts	
; ===========================================================================

loc_72BF4:				; XREF: loc_72A64
		bclr	#7,(a5)
		bclr	#4,(a5)
		jsr	sub_726FE(pc)
		tst.b	$250(a6)
		bmi.s	loc_72C22
		movea.l	a5,a3
		lea	$100(a6),a5
		movea.l	$18(a6),a1
		bclr	#2,(a5)
		bset	#1,(a5)
		move.b	$B(a5),d0
		jsr	sub_72C4E(pc)
		movea.l	a3,a5

loc_72C22:
		addq.w	#8,sp
		rts	
; ===========================================================================

loc_72C26:				; XREF: loc_72A64
		moveq	#0,d0
		move.b	(a4)+,d0
		move.b	d0,$B(a5)
		btst	#2,(a5)
		bne.w	locret_72CAA
		movea.l	$18(a6),a1
		tst.b	$E(a6)
		beq.s	sub_72C4E
		movea.l	$20(a5),a1
		tst.b	$E(a6)
		bmi.s	sub_72C4E
		movea.l	$20(a6),a1

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


sub_72C4E:				; XREF: Snd_FadeOut1; et al
		subq.w	#1,d0
		bmi.s	loc_72C5C
		move.w	#$19,d1

loc_72C56:
		adda.w	d1,a1
		dbf	d0,loc_72C56

loc_72C5C:
		move.b	(a1)+,d1
		move.b	d1,$1F(a5)
		move.b	d1,d4
		move.b	#$B0,d0
		jsr	sub_72722(pc)
		lea	byte_72D18(pc),a2
		moveq	#$13,d3

loc_72C72:
		move.b	(a2)+,d0
		move.b	(a1)+,d1
		jsr	sub_72722(pc)
		dbf	d3,loc_72C72
		moveq	#3,d5
		andi.w	#7,d4
		move.b	byte_72CAC(pc,d4.w),d4
		move.b	9(a5),d3

loc_72C8C:
		move.b	(a2)+,d0
		move.b	(a1)+,d1
		lsr.b	#1,d4
		bcc.s	loc_72C96
		add.b	d3,d1

loc_72C96:
		jsr	sub_72722(pc)
		dbf	d5,loc_72C8C
		move.b	#$B4,d0
		move.b	$A(a5),d1
		jsr	sub_72722(pc)

locret_72CAA:
		rts	
; End of function sub_72C4E

; ===========================================================================
byte_72CAC:	dc.b 8,	8, 8, 8, $A, $E, $E, $F

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


sub_72CB4:				; XREF: sub_72504; sub_7267C; loc_72BA4
		btst	#2,(a5)
		bne.s	locret_72D16
		moveq	#0,d0
		move.b	$B(a5),d0
		movea.l	$18(a6),a1
		tst.b	$E(a6)
		beq.s	loc_72CD8
		movea.l	$20(a6),a1
		tst.b	$E(a6)
		bmi.s	loc_72CD8
		movea.l	$20(a6),a1

loc_72CD8:
		subq.w	#1,d0
		bmi.s	loc_72CE6
		move.w	#$19,d1

loc_72CE0:
		adda.w	d1,a1
		dbf	d0,loc_72CE0

loc_72CE6:
		adda.w	#$15,a1
		lea	byte_72D2C(pc),a2
		move.b	$1F(a5),d0
		andi.w	#7,d0
		move.b	byte_72CAC(pc,d0.w),d4
		move.b	9(a5),d3
		bmi.s	locret_72D16
		moveq	#3,d5

loc_72D02:
		move.b	(a2)+,d0
		move.b	(a1)+,d1
		lsr.b	#1,d4
		bcc.s	loc_72D12
		add.b	d3,d1
		bcs.s	loc_72D12
		jsr	sub_72722(pc)

loc_72D12:
		dbf	d5,loc_72D02

locret_72D16:
		rts	
; End of function sub_72CB4

; ===========================================================================
byte_72D18:	dc.b $30, $38, $34, $3C, $50, $58, $54,	$5C, $60, $68
		dc.b $64, $6C, $70, $78, $74, $7C, $80,	$88, $84, $8C
byte_72D2C:	dc.b $40, $48, $44, $4C
; ===========================================================================

loc_72D30:				; XREF: loc_72A64
		bset	#3,(a5)
		move.l	a4,$14(a5)
		move.b	(a4)+,$18(a5)
		move.b	(a4)+,$19(a5)
		move.b	(a4)+,$1A(a5)
		move.b	(a4)+,d0
		lsr.b	#1,d0
		move.b	d0,$1B(a5)
		clr.w	$1C(a5)
		rts	
; ===========================================================================

loc_72D52:				; XREF: loc_72A64
		bset	#3,(a5)
		rts	
; ===========================================================================

loc_72D58:				; XREF: loc_72A64
		bclr	#7,(a5)
		bclr	#4,(a5)
		tst.b	1(a5)
		bmi.s	loc_72D74
		tst.b	8(a6)
		bmi.w	loc_72E02
		jsr	sub_726FE(pc)
		bra.s	loc_72D78
; ===========================================================================

loc_72D74:
		jsr	sub_729A0(pc)

loc_72D78:
		tst.b	$E(a6)
		bpl.w	loc_72E02
		clr.b	0(a6)
		moveq	#0,d0
		move.b	1(a5),d0
		bmi.s	loc_72DCC
		lea	dword_722CC(pc),a0
		movea.l	a5,a3
		cmpi.b	#4,d0
		bne.s	loc_72DA8
		tst.b	$340(a6)
		bpl.s	loc_72DA8
		lea	$340(a6),a5
		movea.l	$20(a6),a1
		bra.s	loc_72DB8
; ===========================================================================

loc_72DA8:
		subq.b	#2,d0
		lsl.b	#2,d0
		movea.l	(a0,d0.w),a5
		tst.b	(a5)
		bpl.s	loc_72DC8
		movea.l	$18(a6),a1

loc_72DB8:
		bclr	#2,(a5)
		bset	#1,(a5)
		move.b	$B(a5),d0
		jsr	sub_72C4E(pc)

loc_72DC8:
		movea.l	a3,a5
		bra.s	loc_72E02
; ===========================================================================

loc_72DCC:
		lea	$370(a6),a0
		tst.b	(a0)
		bpl.s	loc_72DE0
		cmpi.b	#$E0,d0
		beq.s	loc_72DEA
		cmpi.b	#$C0,d0
		beq.s	loc_72DEA

loc_72DE0:
		lea	dword_722CC(pc),a0
		lsr.b	#3,d0
		movea.l	(a0,d0.w),a0

loc_72DEA:
		bclr	#2,(a0)
		bset	#1,(a0)
		cmpi.b	#$E0,1(a0)
		bne.s	loc_72E02
		move.b	$1F(a0),($C00011).l

loc_72E02:
		addq.w	#8,sp
		rts	
; ===========================================================================

loc_72E06:				; XREF: loc_72A64
		move.b	#$E0,1(a5)
		move.b	(a4)+,$1F(a5)
		btst	#2,(a5)
		bne.s	locret_72E1E
		move.b	-1(a4),($C00011).l

locret_72E1E:
		rts	
; ===========================================================================

loc_72E20:				; XREF: loc_72A64
		bclr	#3,(a5)
		rts	
; ===========================================================================

loc_72E26:				; XREF: loc_72A64
		move.b	(a4)+,$B(a5)
		rts	
; ===========================================================================

loc_72E2C:				; XREF: loc_72A64
		move.b	(a4)+,d0
		lsl.w	#8,d0
		move.b	(a4)+,d0
		adda.w	d0,a4
		subq.w	#1,a4
		rts	
; ===========================================================================

loc_72E38:				; XREF: loc_72A64
		moveq	#0,d0
		move.b	(a4)+,d0
		move.b	(a4)+,d1
		tst.b	$24(a5,d0.w)
		bne.s	loc_72E48
		move.b	d1,$24(a5,d0.w)

loc_72E48:
		subq.b	#1,$24(a5,d0.w)
		bne.s	loc_72E2C
		addq.w	#2,a4
		rts	
; ===========================================================================

loc_72E52:				; XREF: loc_72A64
		moveq	#0,d0
		move.b	$D(a5),d0
		subq.b	#4,d0
		move.l	a4,(a5,d0.w)
		move.b	d0,$D(a5)
		bra.s	loc_72E2C
; ===========================================================================

loc_72E64:				; XREF: loc_72A64
		move.b	#$88,d0
		move.b	#$F,d1
		jsr	sub_7272E(pc)
		move.b	#$8C,d0
		move.b	#$F,d1
		bra.w	sub_7272E
; ===========================================================================
Kos_Z80:	binclude	sound\z80_1.bin
		dc.w ((SegaPCM&$FF)<<8)+((SegaPCM&$FF00)>>8)
		dc.b $21
		dc.w (((EndOfRom-SegaPCM)&$FF)<<8)+(((EndOfRom-SegaPCM)&$FF00)>>8)
		binclude	sound\z80_2.bin
		align 2
Music81:	binclude	sound\music81.bin
		align 2
Music82:	binclude	sound\music82.bin
		align 2
Music83:	binclude	sound\music83.bin
		align 2
Music84:	binclude	sound\music84.bin
		align 2
Music85:	binclude	sound\music85.bin
		align 2
Music86:	binclude	sound\music86.bin
		align 2
Music87:	binclude	sound\music87.bin
		align 2
Music88:	binclude	sound\music88.bin
		align 2
Music89:	binclude	sound\music89.bin
		align 2
Music8A:	binclude	sound\music8A.bin
		align 2
Music8B:	binclude	sound\music8B.bin
		align 2
Music8C:	binclude	sound\music8C.bin
		align 2
Music8D:	binclude	sound\music8D.bin
		align 2
Music8E:	binclude	sound\music8E.bin
		align 2
Music8F:	binclude	sound\music8F.bin
		align 2
Music90:	binclude	sound\music90.bin
		align 2
Music91:	binclude	sound\music91.bin
		align 2
Music92:	binclude	sound\music92.bin
		align 2
Music93:	binclude	sound\music93.bin
		align 2
; ---------------------------------------------------------------------------
; Sound	effect pointers
; ---------------------------------------------------------------------------
SoundIndex:	dc.l SoundA0, SoundA1, SoundA2
		dc.l SoundA3, SoundA4, SoundA5
		dc.l SoundA6, SoundA7, SoundA8
		dc.l SoundA9, SoundAA, SoundAB
		dc.l SoundAC, SoundAD, SoundAE
		dc.l SoundAF, SoundB0, SoundB1
		dc.l SoundB2, SoundB3, SoundB4
		dc.l SoundB5, SoundB6, SoundB7
		dc.l SoundB8, SoundB9, SoundBA
		dc.l SoundBB, SoundBC, SoundBD
		dc.l SoundBE, SoundBF, SoundC0
		dc.l SoundC1, SoundC2, SoundC3
		dc.l SoundC4, SoundC5, SoundC6
		dc.l SoundC7, SoundC8, SoundC9
		dc.l SoundCA, SoundCB, SoundCC
		dc.l SoundCD, SoundCE, SoundCF
SoundD0Index:	dc.l SoundD0
SoundA0:	binclude	sound\soundA0.bin
		align 2
SoundA1:	binclude	sound\soundA1.bin
		align 2
SoundA2:	binclude	sound\soundA2.bin
		align 2
SoundA3:	binclude	sound\soundA3.bin
		align 2
SoundA4:	binclude	sound\soundA4.bin
		align 2
SoundA5:	binclude	sound\soundA5.bin
		align 2
SoundA6:	binclude	sound\soundA6.bin
		align 2
SoundA7:	binclude	sound\soundA7.bin
		align 2
SoundA8:	binclude	sound\soundA8.bin
		align 2
SoundA9:	binclude	sound\soundA9.bin
		align 2
SoundAA:	binclude	sound\soundAA.bin
		align 2
SoundAB:	binclude	sound\soundAB.bin
		align 2
SoundAC:	binclude	sound\soundAC.bin
		align 2
SoundAD:	binclude	sound\soundAD.bin
		align 2
SoundAE:	binclude	sound\soundAE.bin
		align 2
SoundAF:	binclude	sound\soundAF.bin
		align 2
SoundB0:	binclude	sound\soundB0.bin
		align 2
SoundB1:	binclude	sound\soundB1.bin
		align 2
SoundB2:	binclude	sound\soundB2.bin
		align 2
SoundB3:	binclude	sound\soundB3.bin
		align 2
SoundB4:	binclude	sound\soundB4.bin
		align 2
SoundB5:	binclude	sound\soundB5.bin
		align 2
SoundB6:	binclude	sound\soundB6.bin
		align 2
SoundB7:	binclude	sound\soundB7.bin
		align 2
SoundB8:	binclude	sound\soundB8.bin
		align 2
SoundB9:	binclude	sound\soundB9.bin
		align 2
SoundBA:	binclude	sound\soundBA.bin
		align 2
SoundBB:	binclude	sound\soundBB.bin
		align 2
SoundBC:	binclude	sound\soundBC.bin
		align 2
SoundBD:	binclude	sound\soundBD.bin
		align 2
SoundBE:	binclude	sound\soundBE.bin
		align 2
SoundBF:	binclude	sound\soundBF.bin
		align 2
SoundC0:	binclude	sound\soundC0.bin
		align 2
SoundC1:	binclude	sound\soundC1.bin
		align 2
SoundC2:	binclude	sound\soundC2.bin
		align 2
SoundC3:	binclude	sound\soundC3.bin
		align 2
SoundC4:	binclude	sound\soundC4.bin
		align 2
SoundC5:	binclude	sound\soundC5.bin
		align 2
SoundC6:	binclude	sound\soundC6.bin
		align 2
SoundC7:	binclude	sound\soundC7.bin
		align 2
SoundC8:	binclude	sound\soundC8.bin
		align 2
SoundC9:	binclude	sound\soundC9.bin
		align 2
SoundCA:	binclude	sound\soundCA.bin
		align 2
SoundCB:	binclude	sound\soundCB.bin
		align 2
SoundCC:	binclude	sound\soundCC.bin
		align 2
SoundCD:	binclude	sound\soundCD.bin
		align 2
SoundCE:	binclude	sound\soundCE.bin
		align 2
SoundCF:	binclude	sound\soundCF.bin
		align 2
SoundD0:	binclude	sound\soundD0.bin
		align 2
SegaPCM:	binclude	sound\segapcm.bin
		align 2

and replace it completely with:

		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
		zPtrSpec   $1300
		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
		zPtrSpec	Z80DefaultBankSwitch
		dc.b	$CD
		zPtrSpec	Z80BankSwitch0
		dc.b	$18,$03
Z80DefaultBankSwitch:
		dc.b	$CD
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch		
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch		
		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
		zPtrSpec   Z80BankSwitch		
		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
		zPtrSpec   Z80BankSwitch	
		dc.b	$00,$00,$00,$00,$00,$00,$00,$00,$00
		dc.b	$21
		z68kPtr   SegaSnd
		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:
		zPtrSpec	MusicPointers
		zPtrSpec	UniversalVoiceBank
		zPtrSpec	MusicPointers
		zPtrSpec	SndPointers
		zPtrSpec	PSGNoisePointers
		zPtrSpec	PSGTonePointers
		dc.w	$3300

;credit goes to Varion Icaria for finding this index
PSGNoisePointers:
		zPtrSpec	PSGN_0
		zPtrSpec	PSGN_1
		zPtrSpec	PSGN_2
		zPtrSpec	PSGN_3
		zPtrSpec	PSGN_4
		zPtrSpec	PSGN_5
		zPtrSpec	PSGN_6
		zPtrSpec	PSGN_7

PSGN_1: incbin sound/PSGN1.bin
PSGN_0: incbin sound/PSGN0.bin
PSGN_2: incbin sound/PSGN2.bin
PSGN_3: incbin sound/PSGN3.bin
PSGN_4: incbin sound/PSGN4.bin
PSGN_5: incbin sound/PSGN5.bin
PSGN_6: incbin sound/PSGN6.bin
PSGN_7: incbin sound/PSGN7.bin

;credit goes to Varion Icaria for finding this index
PSGTonePointers:
		zPtrSpec	PSGT_00
		zPtrSpec	PSGT_01
		zPtrSpec	PSGT_02
		zPtrSpec	PSGT_03
		zPtrSpec	PSGT_04
		zPtrSpec	PSGT_05
		zPtrSpec	PSGT_06
		zPtrSpec	PSGT_07
		zPtrSpec	PSGT_08
		zPtrSpec	PSGT_09
		zPtrSpec	PSGT_0A
		zPtrSpec	PSGT_0B
		zPtrSpec	PSGT_0C
		zPtrSpec	PSGT_0D
		zPtrSpec	PSGT_0E
		zPtrSpec	PSGT_0F
		zPtrSpec	PSGT_10
		zPtrSpec	PSGT_11
		zPtrSpec	PSGT_12
		zPtrSpec	PSGT_13
		zPtrSpec	PSGT_14
		zPtrSpec	PSGT_15
		zPtrSpec	PSGT_16
		zPtrSpec	PSGT_17
		zPtrSpec	PSGT_18
		zPtrSpec	PSGT_19
		zPtrSpec	PSGT_1A
		zPtrSpec	PSGT_1B
		zPtrSpec	PSGT_1C
		zPtrSpec	PSGT_1D
		zPtrSpec	PSGT_1E
		zPtrSpec	PSGT_1F
		zPtrSpec	PSGT_20
		zPtrSpec	PSGT_21
		zPtrSpec	PSGT_22
		zPtrSpec	PSGT_23
		zPtrSpec	PSGT_24
		zPtrSpec	PSGT_25
		zPtrSpec	PSGT_26

PSGT_00: incbin sound/PSGT00.bin
PSGT_01: incbin sound/PSGT01.bin
PSGT_02: incbin sound/PSGT02.bin
PSGT_03: incbin sound/PSGT03.bin
PSGT_04: incbin sound/PSGT04.bin
PSGT_05: incbin sound/PSGT05.bin
PSGT_06: incbin sound/PSGT06.bin
PSGT_07: incbin sound/PSGT07.bin
PSGT_08: incbin sound/PSGT08.bin
PSGT_09: incbin sound/PSGT09.bin
PSGT_0A: incbin sound/PSGT0A.bin
PSGT_0B: incbin sound/PSGT0B.bin
PSGT_0C: incbin sound/PSGT0C.bin
PSGT_0D: incbin sound/PSGT0D.bin
PSGT_0E: incbin sound/PSGT0E.bin
PSGT_0F: incbin sound/PSGT0F.bin
PSGT_10: incbin sound/PSGT10.bin
PSGT_11: incbin sound/PSGT11.bin
PSGT_12: incbin sound/PSGT12.bin
PSGT_13: incbin sound/PSGT13.bin
PSGT_14: incbin sound/PSGT14.bin
PSGT_15: incbin sound/PSGT15.bin
PSGT_16: incbin sound/PSGT16.bin
PSGT_17: incbin sound/PSGT17.bin
PSGT_18: incbin sound/PSGT18.bin
PSGT_19: incbin sound/PSGT19.bin
PSGT_1A: incbin sound/PSGT1A.bin
PSGT_1B: incbin sound/PSGT1B.bin
PSGT_1C: incbin sound/PSGT1C.bin
PSGT_1D: incbin sound/PSGT1D.bin
PSGT_1E: incbin sound/PSGT1E.bin
PSGT_1F: incbin sound/PSGT1F.bin
PSGT_20: incbin sound/PSGT20.bin
PSGT_21: incbin sound/PSGT21.bin
PSGT_22: incbin sound/PSGT22.bin
PSGT_23: incbin sound/PSGT23.bin
PSGT_24: incbin sound/PSGT24.bin
PSGT_25: incbin sound/PSGT25.bin
PSGT_26: incbin sound/PSGT26.bin

MusicPointers:	
		z68kPtr	Angel_Island_1_Snd
		z68kPtr	Angel_Island_2_Snd
		z68kPtr	Hydrocity_1_Snd
		z68kPtr	Hydrocity_2_Snd
		z68kPtr	Marble_Garden_1_Snd
		z68kPtr	Marble_Garden_2_Snd
		z68kPtr	Carnival_Night_1_Snd
		z68kPtr	Carnival_Night_2_Snd
		z68kPtr	Flying_Battery_1_Snd
		z68kPtr	Flying_Battery_2_Snd
		z68kPtr	Icecap_1_Snd
		z68kPtr	Icecap_2_Snd
		z68kPtr	Launch_Base_1_Snd
		z68kPtr	Launch_Base_2_Snd
		z68kPtr	Mushroom_Hill_1_Snd
		z68kPtr	Mushroom_Hill_2_Snd
		z68kPtr	Sandopolis_1_Snd
		z68kPtr	Sandopolis_2_Snd
		z68kPtr	Lava_Reef_1_Snd
		z68kPtr	Lava_Reef_2_Snd
		z68kPtr	Sky_Sanctuary_Snd
		z68kPtr	Death_Egg_1_Snd
		z68kPtr	Death_Egg_2_Snd
		z68kPtr	Mini_Boss_SK_Snd
		z68kPtr	Boss_Snd
		z68kPtr	The_Doomsday_Snd
		z68kPtr	Glowing_Spheres_Bonus_Stage_snd
		z68kPtr	Special_Stage_Snd
		z68kPtr	Slot_Machine_Bonus_Stage_snd
		z68kPtr	Gum_Ball_Machine_Bonus_Stage_snd
		z68kPtr	Knuckles_Theme_Snd
		z68kPtr	Azure_Lake_Snd
		z68kPtr	Balloon_Park_Snd
		z68kPtr	Desert_Palace_Snd
		z68kPtr	Chrome_Gadget_Snd
		z68kPtr	Endless_Mine_Snd
		z68kPtr	Title_Screen_Snd
		z68kPtr	Credits_Snd
		z68kPtr	Time_Game_Over_Snd
		z68kPtr	Continue_Sound
		z68kPtr	Level_Results_Snd
		z68kPtr	Extra_Life_Snd
		z68kPtr	Emerald_Snd
		z68kPtr	Invincibility_Snd
		z68kPtr	Competition_Menu_Snd
		z68kPtr	Mini_Boss_Snd
		z68kPtr	Menu_Snd
		z68kPtr	Final_Boss_Snd
		z68kPtr	Underwater_Timming_Snd
		z68kPtr	Presented_by_SEGA_Snd

SndPointers:
		z68kPtr	Sfx_34_Snd
		z68kPtr	Sfx_35_Snd
		z68kPtr	Sfx_36_Snd
		z68kPtr	Sfx_37_Snd
		z68kPtr	Sfx_38_Snd
		z68kPtr	Sfx_39_Snd
		z68kPtr	Sfx_3A_Snd
		z68kPtr	Sfx_3B_Snd
		z68kPtr	Sfx_3C_Snd
		z68kPtr	Sfx_3D_Snd
		z68kPtr	Sfx_3E_Snd
		z68kPtr	Sfx_3F_Snd
		z68kPtr	Sfx_40_Snd
		z68kPtr	Sfx_41_Snd
		z68kPtr	Sfx_42_Snd
		z68kPtr	Sfx_43_Snd
		z68kPtr	Sfx_44_Snd
		z68kPtr	Sfx_45_Snd
		z68kPtr	Sfx_46_Snd
		z68kPtr	Sfx_47_Snd
		z68kPtr	Sfx_48_Snd
		z68kPtr	Sfx_49_Snd
		z68kPtr	Sfx_4A_Snd
		z68kPtr	Sfx_4B_Snd
		z68kPtr	Sfx_4C_Snd
		z68kPtr	Sfx_4D_Snd
		z68kPtr	Sfx_4E_Snd
		z68kPtr	Sfx_4F_Snd
		z68kPtr	Sfx_50_Snd
		z68kPtr	Sfx_51_Snd
		z68kPtr	Sfx_52_Snd
		z68kPtr	Sfx_53_Snd
		z68kPtr	Sfx_54_Snd
		z68kPtr	Sfx_55_Snd
		z68kPtr	Sfx_56_Snd
		z68kPtr	Sfx_57_Snd
		z68kPtr	Sfx_58_Snd
		z68kPtr	Sfx_59_Snd
		z68kPtr	Sfx_5A_Snd
		z68kPtr	Sfx_5B_Snd
		z68kPtr	Sfx_5C_Snd
		z68kPtr	Sfx_5D_Snd
		z68kPtr	Sfx_5E_Snd
		z68kPtr	Sfx_5F_Snd
		z68kPtr	Sfx_60_Snd
		z68kPtr	Sfx_61_Snd
		z68kPtr	Sfx_62_Snd
		z68kPtr	Sfx_63_Snd
		z68kPtr	Sfx_64_Snd
		z68kPtr	Sfx_65_Snd
		z68kPtr	Sfx_66_Snd
		z68kPtr	Sfx_67_Snd
		z68kPtr	Sfx_68_Snd
		z68kPtr	Sfx_69_Snd
		z68kPtr	Sfx_6A_Snd
		z68kPtr	Sfx_6B_Snd
		z68kPtr	Sfx_6C_Snd
		z68kPtr	Sfx_6D_Snd
		z68kPtr	Sfx_6E_Snd
		z68kPtr	Sfx_6F_Snd
		z68kPtr	Sfx_70_Snd
		z68kPtr	Sfx_71_Snd
		z68kPtr	Sfx_72_Snd
		z68kPtr	Sfx_73_Snd
		z68kPtr	Sfx_74_Snd
		z68kPtr	Sfx_75_Snd
		z68kPtr	Sfx_76_Snd
		z68kPtr	Sfx_77_Snd
		z68kPtr	Sfx_78_Snd
		z68kPtr	Sfx_79_Snd
		z68kPtr	Sfx_7A_Snd
		z68kPtr	Sfx_7B_Snd
		z68kPtr	Sfx_7C_Snd
		z68kPtr	Sfx_7D_Snd
		z68kPtr	Sfx_7E_Snd
		z68kPtr	Sfx_7F_Snd
		z68kPtr	Sfx_80_Snd
		z68kPtr	Sfx_81_Snd
		z68kPtr	Sfx_82_Snd
		z68kPtr	Sfx_83_Snd
		z68kPtr	Sfx_84_Snd
		z68kPtr	Sfx_85_Snd
		z68kPtr	Sfx_86_Snd
		z68kPtr	Sfx_87_Snd
		z68kPtr	Sfx_88_Snd
		z68kPtr	Sfx_89_Snd
		z68kPtr	Sfx_8A_Snd
		z68kPtr	Sfx_8B_Snd
		z68kPtr	Sfx_8C_Snd
		z68kPtr	Sfx_8D_Snd
		z68kPtr	Sfx_8E_Snd
		z68kPtr	Sfx_8F_Snd
		z68kPtr	Sfx_90_Snd
		z68kPtr	Sfx_91_Snd
		z68kPtr	Sfx_92_Snd
		z68kPtr	Sfx_93_Snd
		z68kPtr	Sfx_94_Snd
		z68kPtr	Sfx_95_Snd
		z68kPtr	Sfx_96_Snd
		z68kPtr	Sfx_97_Snd
		z68kPtr	Sfx_98_Snd
		z68kPtr	Sfx_99_Snd
		z68kPtr	Sfx_9A_Snd
		z68kPtr	Sfx_9B_Snd
		z68kPtr	Sfx_9C_Snd
		z68kPtr	Sfx_9D_Snd
		z68kPtr	Sfx_9E_Snd
		z68kPtr	Sfx_9F_Snd
		z68kPtr	Sfx_A0_Snd
		z68kPtr	Sfx_A1_Snd
		z68kPtr	Sfx_A2_Snd
		z68kPtr	Sfx_A3_Snd
		z68kPtr	Sfx_A4_Snd
		z68kPtr	Sfx_A5_Snd
		z68kPtr	Sfx_A6_Snd
		z68kPtr	Sfx_A7_Snd
		z68kPtr	Sfx_A8_Snd
		z68kPtr	Sfx_A9_Snd
		z68kPtr	Sfx_AA_Snd
		z68kPtr	Sfx_AB_Snd
		z68kPtr	Sfx_AC_Snd
		z68kPtr	Sfx_AD_Snd
		z68kPtr	Sfx_AE_Snd
		z68kPtr	Sfx_AF_Snd
		z68kPtr	Sfx_B0_Snd
		z68kPtr	Sfx_B1_Snd
		z68kPtr	Sfx_B2_Snd
		z68kPtr	Sfx_B3_Snd
		z68kPtr	Sfx_B4_Snd
		z68kPtr	Sfx_B5_Snd
		z68kPtr	Sfx_B6_Snd
		z68kPtr	Sfx_B7_Snd
		z68kPtr	Sfx_B8_Snd
		z68kPtr	Sfx_B9_Snd
		z68kPtr	Sfx_BA_Snd
		z68kPtr	Sfx_BB_Snd
		z68kPtr	Sfx_BC_Snd
		z68kPtr	Sfx_BD_Snd
		z68kPtr	Sfx_BE_Snd
		z68kPtr	Sfx_BF_Snd
		z68kPtr	Sfx_C0_Snd
		z68kPtr	Sfx_C1_Snd
		z68kPtr	Sfx_C2_Snd
		z68kPtr	Sfx_C3_Snd
		z68kPtr	Sfx_C4_Snd
		z68kPtr	Sfx_C5_Snd
		z68kPtr	Sfx_C6_Snd
		z68kPtr	Sfx_C7_Snd
		z68kPtr	Sfx_C8_Snd
		z68kPtr	Sfx_C9_Snd
		z68kPtr	Sfx_CA_Snd
		z68kPtr	Sfx_CB_Snd
		z68kPtr	Sfx_CC_Snd
		z68kPtr	Sfx_CD_Snd
		z68kPtr	Sfx_CE_Snd
		z68kPtr	Sfx_CF_Snd
		z68kPtr	Sfx_D0_Snd
		z68kPtr	Sfx_D1_Snd
		z68kPtr	Sfx_D2_Snd
		z68kPtr	Sfx_D3_Snd
		z68kPtr	Sfx_D4_Snd
		z68kPtr	Sfx_D5_Snd
		z68kPtr	Sfx_D6_Snd
		z68kPtr	Sfx_D7_Snd
		z68kPtr	Sfx_D8_Snd
		z68kPtr	Sfx_D9_Snd
		z68kPtr	Sfx_DA_Snd
		z68kPtr	Sfx_DB_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
DriverPointersEnd:

UniversalVoiceBank:
		incbin	"sound/uvb.bin"
UniversalVoiceBankEnd:
		align	$8000

DacBank0:
		incbin	"sound/dac_0.bin"

		align	$8000
DacBank1:
		incbin	"sound/dac_1.bin"
		align	$8000

DacBank2:
		incbin	"sound/dac_2.bin"
		align	$8000

Bank0:
		incbin	"sound/filler.bin"
Mini_Boss_Snd:
		incbin	"sound/miniboss.snd"
Final_Boss_Snd:
		incbin	"sound/f_boss.snd"
		align	$8000

Bank1:
Angel_Island_1_Snd:
		incbin	"sound/aiz1.snd"
Angel_Island_2_Snd:
		incbin	"sound/aiz2.snd"
Hydrocity_1_Snd:
		incbin	"sound/hcz1.snd"
Hydrocity_2_Snd:
		incbin	"sound/hcz2.snd"
Marble_Garden_1_Snd:
		incbin	"sound/mgz1.snd"
Marble_Garden_2_Snd:
		incbin	"sound/mgz2.snd"
Carnival_Night_2_Snd:
		incbin	"sound/cnz2.snd"
Carnival_Night_1_Snd:
		incbin	"sound/cnz1.snd"
Flying_Battery_1_Snd:
		incbin	"sound/fbz1.snd"
Flying_Battery_2_Snd:
		incbin	"sound/fbz2.snd"
The_Doomsday_Snd:
		incbin	"sound/tdz.snd"
		align	$8000

Bank2:
Icecap_2_Snd:
		incbin	"sound/iz2.snd"
Icecap_1_Snd:
		incbin	"sound/iz1.snd"
Launch_Base_2_Snd:
		incbin	"sound/lbz2.snd"
Launch_Base_1_Snd:
		incbin	"sound/lbz1.snd"
Mushroom_Hill_1_Snd:
		incbin	"sound/mhz1.snd"
Mushroom_Hill_2_Snd:
		incbin	"sound/mhz2.snd"
Sandopolis_1_Snd:
		incbin	"sound/sz1.snd"
Sandopolis_2_Snd:
		incbin	"sound/sz2.snd"
Lava_Reef_1_Snd:
		incbin	"sound/lrz1.snd"
Lava_Reef_2_Snd:
		incbin	"sound/lrz2.snd"
Sky_Sanctuary_Snd:
		incbin	"sound/scz.snd"
Death_Egg_1_Snd:
		incbin	"sound/dez1.snd"
Death_Egg_2_Snd:
		incbin	"sound/dez2.snd"
Mini_Boss_SK_Snd:
		incbin	"sound/mb_sk.snd"
Boss_Snd:
		incbin	"sound/boss.snd"
Glowing_Spheres_Bonus_Stage_snd:
		incbin	"sound/gs_bs.snd"
Special_Stage_Snd:
		incbin	"sound/ss.snd"
Level_Results_Snd:
		incbin	"sound/lr.snd"
Menu_Snd:		
		incbin	"sound/menu.snd"
		align	$8000

Bank3:
Slot_Machine_Bonus_Stage_snd:
		incbin	"sound/sm_bs.snd"
Gum_Ball_Machine_Bonus_Stage_snd:
		incbin	"sound/gbm_bs.snd"
Knuckles_Theme_Snd:
		incbin	"sound/kte.snd"
Azure_Lake_Snd:
		incbin	"sound/alz.snd"
Balloon_Park_Snd:
		incbin	"sound/bpz.snd"
Desert_Palace_Snd:
		incbin	"sound/dpz.snd"
Chrome_Gadget_Snd:
		incbin	"sound/cgz.snd"
Endless_Mine_Snd:
		incbin	"sound/emz.snd"
Title_Screen_Snd:
		incbin	"sound/ts.snd"
Credits_Snd:		
		incbin	"sound/credits.snd"
Time_Game_Over_Snd:
		incbin	"sound/tgovr.snd"
Continue_Snd:
		incbin	"sound/continue.snd"
Extra_Life_Snd:
		incbin	"sound/1up.snd"
Emerald_Snd:
		incbin	"sound/emerald.snd"
Invincibility_Snd:
		incbin	"sound/invcblty.snd"
Competition_Menu_Snd:
		incbin	"sound/2p_menu.snd"	
Underwater_Timming_Snd:
		incbin	"sound/panic.snd"
Presented_by_SEGA_Snd:
		incbin	"sound/p_sega.snd"
		align	$8000

SndBank:
SegaPCMBank:
SegaSnd:
		incbin	"sound/sega.snd"
Sfx_34_Snd:
		incbin	"sound/sfx_34.snd"
Sfx_35_Snd:
		incbin	"sound/sfx_35.snd"
Sfx_36_Snd:
		incbin	"sound/sfx_36.snd"
Sfx_37_Snd:
		incbin	"sound/sfx_37.snd"
Sfx_38_Snd:
		incbin	"sound/sfx_38.snd"
Sfx_39_Snd:
		incbin	"sound/sfx_39.snd"
Sfx_3A_Snd:
		incbin	"sound/sfx_3A.snd"
Sfx_3B_Snd:
		incbin	"sound/sfx_3B.snd"
Sfx_3C_Snd:
		incbin	"sound/sfx_3C.snd"
Sfx_3D_Snd:
		incbin	"sound/sfx_3D.snd"
Sfx_3E_Snd:
		incbin	"sound/sfx_3E.snd"
Sfx_3F_Snd:
		incbin	"sound/sfx_3F.snd"
Sfx_40_Snd:
		incbin	"sound/sfx_40.snd"
Sfx_41_Snd:
		incbin	"sound/sfx_41.snd"
Sfx_42_Snd:
		incbin	"sound/sfx_42.snd"
Sfx_43_Snd:
		incbin	"sound/sfx_43.snd"
Sfx_44_Snd:
		incbin	"sound/sfx_44.snd"
Sfx_45_Snd:
		incbin	"sound/sfx_45.snd"
Sfx_46_Snd:
		incbin	"sound/sfx_46.snd"
Sfx_47_Snd:
		incbin	"sound/sfx_47.snd"
Sfx_48_Snd:
		incbin	"sound/sfx_48.snd"
Sfx_49_Snd:
		incbin	"sound/sfx_49.snd"
Sfx_4A_Snd:
		incbin	"sound/sfx_4A.snd"
Sfx_4B_Snd:
		incbin	"sound/sfx_4B.snd"
Sfx_4C_Snd:
		incbin	"sound/sfx_4C.snd"
Sfx_4D_Snd:
		incbin	"sound/sfx_4D.snd"
Sfx_4E_Snd:
		incbin	"sound/sfx_4E.snd"
Sfx_4F_Snd:
		incbin	"sound/sfx_4F.snd"
Sfx_50_Snd:
		incbin	"sound/sfx_50.snd"
Sfx_51_Snd:
		incbin	"sound/sfx_51.snd"
Sfx_52_Snd:
		incbin	"sound/sfx_52.snd"
Sfx_53_Snd:
		incbin	"sound/sfx_53.snd"
Sfx_54_Snd:
		incbin	"sound/sfx_54.snd"
Sfx_55_Snd:
		incbin	"sound/sfx_55.snd"
Sfx_56_Snd:
		incbin	"sound/sfx_56.snd"
Sfx_57_Snd:
		incbin	"sound/sfx_57.snd"
Sfx_58_Snd:
		incbin	"sound/sfx_58.snd"
Sfx_59_Snd:
		incbin	"sound/sfx_59.snd"
Sfx_5A_Snd:
		incbin	"sound/sfx_5A.snd"
Sfx_5B_Snd:
		incbin	"sound/sfx_5B.snd"
Sfx_5C_Snd:
		incbin	"sound/sfx_5C.snd"
Sfx_5D_Snd:
		incbin	"sound/sfx_5D.snd"
Sfx_5E_Snd:
		incbin	"sound/sfx_5E.snd"
Sfx_5F_Snd:
		incbin	"sound/sfx_5F.snd"
Sfx_60_Snd:
		incbin	"sound/sfx_60.snd"
Sfx_61_Snd:
		incbin	"sound/sfx_61.snd"
Sfx_62_Snd:
		incbin	"sound/sfx_62.snd"
Sfx_63_Snd:
		incbin	"sound/sfx_63.snd"
Sfx_64_Snd:
		incbin	"sound/sfx_64.snd"
Sfx_65_Snd:
		incbin	"sound/sfx_65.snd"
Sfx_66_Snd:
		incbin	"sound/sfx_66.snd"
Sfx_67_Snd:
		incbin	"sound/sfx_67.snd"
Sfx_68_Snd:
		incbin	"sound/sfx_68.snd"
Sfx_69_Snd:
		incbin	"sound/sfx_69.snd"
Sfx_6A_Snd:
		incbin	"sound/sfx_6A.snd"
Sfx_6B_Snd:
		incbin	"sound/sfx_6B.snd"
Sfx_6C_Snd:
		incbin	"sound/sfx_6C.snd"
Sfx_6D_Snd:
		incbin	"sound/sfx_6D.snd"
Sfx_6E_Snd:
		incbin	"sound/sfx_6E.snd"
Sfx_6F_Snd:
		incbin	"sound/sfx_6F.snd"
Sfx_70_Snd:
		incbin	"sound/sfx_70.snd"
Sfx_71_Snd:
		incbin	"sound/sfx_71.snd"
Sfx_72_Snd:
		incbin	"sound/sfx_72.snd"
Sfx_73_Snd:
		incbin	"sound/sfx_73.snd"
Sfx_74_Snd:
		incbin	"sound/sfx_74.snd"
Sfx_75_Snd:
		incbin	"sound/sfx_75.snd"
Sfx_76_Snd:
		incbin	"sound/sfx_76.snd"
Sfx_77_Snd:
		incbin	"sound/sfx_77.snd"
Sfx_78_Snd:
		incbin	"sound/sfx_78.snd"
Sfx_79_Snd:
		incbin	"sound/sfx_79.snd"
Sfx_7A_Snd:
		incbin	"sound/sfx_7A.snd"
Sfx_7B_Snd:
		incbin	"sound/sfx_7B.snd"
Sfx_7C_Snd:
		incbin	"sound/sfx_7C.snd"
Sfx_7D_Snd:
		incbin	"sound/sfx_7D.snd"
Sfx_7E_Snd:
		incbin	"sound/sfx_7E.snd"
Sfx_7F_Snd:
		incbin	"sound/sfx_7F.snd"
Sfx_80_Snd:
		incbin	"sound/sfx_80.snd"
Sfx_81_Snd:
		incbin	"sound/sfx_81.snd"
Sfx_82_Snd:
		incbin	"sound/sfx_82.snd"
Sfx_83_Snd:
		incbin	"sound/sfx_83.snd"
Sfx_84_Snd:
		incbin	"sound/sfx_84.snd"
Sfx_85_Snd:
		incbin	"sound/sfx_85.snd"
Sfx_86_Snd:
		incbin	"sound/sfx_86.snd"
Sfx_87_Snd:
		incbin	"sound/sfx_87.snd"
Sfx_88_Snd:
		incbin	"sound/sfx_88.snd"
Sfx_89_Snd:
		incbin	"sound/sfx_89.snd"
Sfx_8A_Snd:
		incbin	"sound/sfx_8A.snd"
Sfx_8B_Snd:
		incbin	"sound/sfx_8B.snd"
Sfx_8C_Snd:
		incbin	"sound/sfx_8C.snd"
Sfx_8D_Snd:
		incbin	"sound/sfx_8D.snd"
Sfx_8E_Snd:
		incbin	"sound/sfx_8E.snd"
Sfx_8F_Snd:
		incbin	"sound/sfx_8F.snd"
Sfx_90_Snd:
		incbin	"sound/sfx_90.snd"
Sfx_91_Snd:
		incbin	"sound/sfx_91.snd"
Sfx_92_Snd:
		incbin	"sound/sfx_92.snd"
Sfx_93_Snd:
		incbin	"sound/sfx_93.snd"
Sfx_94_Snd:
		incbin	"sound/sfx_94.snd"
Sfx_95_Snd:
		incbin	"sound/sfx_95.snd"
Sfx_96_Snd:
		incbin	"sound/sfx_96.snd"
Sfx_97_Snd:
		incbin	"sound/sfx_97.snd"
Sfx_98_Snd:
		incbin	"sound/sfx_98.snd"
Sfx_99_Snd:
		incbin	"sound/sfx_99.snd"
Sfx_9A_Snd:
		incbin	"sound/sfx_9A.snd"
Sfx_9B_Snd:
		incbin	"sound/sfx_9B.snd"
Sfx_9C_Snd:
		incbin	"sound/sfx_9C.snd"
Sfx_9D_Snd:
		incbin	"sound/sfx_9D.snd"
Sfx_9E_Snd:
		incbin	"sound/sfx_9E.snd"
Sfx_9F_Snd:
		incbin	"sound/sfx_9F.snd"
Sfx_A0_Snd:
		incbin	"sound/sfx_A0.snd"
Sfx_A1_Snd:
		incbin	"sound/sfx_A1.snd"
Sfx_A2_Snd:
		incbin	"sound/sfx_A2.snd"
Sfx_A3_Snd:
		incbin	"sound/sfx_A3.snd"
Sfx_A4_Snd:
		incbin	"sound/sfx_A4.snd"
Sfx_A5_Snd:
		incbin	"sound/sfx_A5.snd"
Sfx_A6_Snd:
		incbin	"sound/sfx_A6.snd"
Sfx_A7_Snd:
		incbin	"sound/sfx_A7.snd"
Sfx_A8_Snd:
		incbin	"sound/sfx_A8.snd"
Sfx_A9_Snd:
		incbin	"sound/sfx_A9.snd"
Sfx_AA_Snd:
		incbin	"sound/sfx_AA.snd"
Sfx_AB_Snd:
		incbin	"sound/sfx_AB.snd"
Sfx_AC_Snd:
		incbin	"sound/sfx_AC.snd"
Sfx_AD_Snd:
		incbin	"sound/sfx_AD.snd"
Sfx_AE_Snd:
		incbin	"sound/sfx_AE.snd"
Sfx_AF_Snd:
		incbin	"sound/sfx_AF.snd"
Sfx_B0_Snd:
		incbin	"sound/sfx_B0.snd"
Sfx_B1_Snd:
		incbin	"sound/sfx_B1.snd"
Sfx_B2_Snd:
		incbin	"sound/sfx_B2.snd"
Sfx_B3_Snd:
		incbin	"sound/sfx_B3.snd"
Sfx_B4_Snd:
		incbin	"sound/sfx_B4.snd"
Sfx_B5_Snd:
		incbin	"sound/sfx_B5.snd"
Sfx_B6_Snd:
		incbin	"sound/sfx_B6.snd"
Sfx_B7_Snd:
		incbin	"sound/sfx_B7.snd"
Sfx_B8_Snd:
		incbin	"sound/sfx_B8.snd"
Sfx_B9_Snd:
		incbin	"sound/sfx_B9.snd"
Sfx_BA_Snd:
		incbin	"sound/sfx_BA.snd"
Sfx_BB_Snd:
		incbin	"sound/sfx_BB.snd"
Sfx_BC_Snd:
		incbin	"sound/sfx_BC.snd"
Sfx_BD_Snd:
		incbin	"sound/sfx_BD.snd"
Sfx_BE_Snd:
		incbin	"sound/sfx_BE.snd"
Sfx_BF_Snd:
		incbin	"sound/sfx_BF.snd"
Sfx_C0_Snd:
		incbin	"sound/sfx_C0.snd"
Sfx_C1_Snd:
		incbin	"sound/sfx_C1.snd"
Sfx_C2_Snd:
		incbin	"sound/sfx_C2.snd"
Sfx_C3_Snd:
		incbin	"sound/sfx_C3.snd"
Sfx_C4_Snd:
		incbin	"sound/sfx_C4.snd"
Sfx_C5_Snd:
		incbin	"sound/sfx_C5.snd"
Sfx_C6_Snd:
		incbin	"sound/sfx_C6.snd"
Sfx_C7_Snd:
		incbin	"sound/sfx_C7.snd"
Sfx_C8_Snd:
		incbin	"sound/sfx_C8.snd"
Sfx_C9_Snd:
		incbin	"sound/sfx_C9.snd"
Sfx_CA_Snd:
		incbin	"sound/sfx_CA.snd"
Sfx_CB_Snd:
		incbin	"sound/sfx_CB.snd"
Sfx_CC_Snd:
		incbin	"sound/sfx_CC.snd"
Sfx_CD_Snd:
		incbin	"sound/sfx_CD.snd"
Sfx_CE_Snd:
		incbin	"sound/sfx_CE.snd"
Sfx_CF_Snd:
		incbin	"sound/sfx_CF.snd"
Sfx_D0_Snd:
		incbin	"sound/sfx_D0.snd"
Sfx_D1_Snd:
		incbin	"sound/sfx_D1.snd"
Sfx_D2_Snd:
		incbin	"sound/sfx_D2.snd"
Sfx_D3_Snd:
		incbin	"sound/sfx_D3.snd"
Sfx_D4_Snd:
		incbin	"sound/sfx_D4.snd"
Sfx_D5_Snd:
		incbin	"sound/sfx_D5.snd"
Sfx_D6_Snd:
		incbin	"sound/sfx_D6.snd"
Sfx_D7_Snd:
		incbin	"sound/sfx_D7.snd"
Sfx_D8_Snd:
		incbin	"sound/sfx_D8.snd"
Sfx_D9_Snd:
		incbin	"sound/sfx_D9.snd"
Sfx_DA_Snd:
		incbin	"sound/sfx_DA.snd"
Sfx_DB_Snd:
		incbin	"sound/sfx_DB.snd"
Sfx_DC_Snd:
		incbin	"sound/sfx_DC.snd"

Driver data files

Then unpack this into the sound folder, and 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)

Enabling Sonic 2 / 3 Level Music Memory

Doing this is optional as it has little to do with the driver itself, but is a very useful and quick hack that makes life a lot easier for the more painful phase of using a massively different sound system than before, fixing the freaken sound. Sonic 1 uses a second index for restoring music as opposed to actually memorizing it like later sonic games do.

First we will locate:

Level_PlayBgm:
		lea	(MusicList).l,a1 ; load	music playlist
		move.b	(a1,d0.w),d0	; add d0 to a1
		bsr.w	PlaySound	; play music
		move.b	#$34,($FFFFD080).w ; load title	card object

and insert a new line to make it read:

Level_PlayBgm:
		lea	(MusicList).l,a1 ; load	music playlist
		move.b	(a1,d0.w),d0	; add d0 to a1
		move.w	d0,($FFFFFF90).w	; store level music
		bsr.w	PlaySound	; play music
		move.b	#$34,($FFFFD080).w ; load title	card object

Now we will locate:

		move.b	($FFFFFE10).w,d0
		cmpi.w	#$103,($FFFFFE10).w ; check if level is	SBZ3
		bne.s	Obj01_PlayMusic
		moveq	#5,d0		; play SBZ music

Obj01_PlayMusic:
		lea	(MusicList2).l,a1
		move.b	(a1,d0.w),d0
		jsr	(PlaySound).l	; play normal music

seems the invincibility stars conflict with music memory, so we will just make it use music list 1, so the result is:

		move.b	($FFFFFE10).w,d0
		cmpi.w	#$103,($FFFFFE10).w ; check if level is	SBZ3
		bne.s	Obj01_PlayMusic
		moveq	#5,d0		; play SBZ music

Obj01_PlayMusic:
		lea	(MusicList).l,a1 ; load	music playlist
		move.b	(a1,d0.w),d0	; add d0 to a1
		move.w	d0,($FFFFFF90).w	; store level music
		jsr	(PlaySound).l	; play normal music

then remove:

; ---------------------------------------------------------------------------
; Music	to play	after invincibility wears off
; ---------------------------------------------------------------------------
MusicList2:	binclude	misc\muslist2.bin

now we want to fix the underwater counter music restore code, so locate:

ResumeMusic:				; XREF: Obj64_Wobble; Sonic_Water; Obj0A_ReduceAir
		cmpi.w	#$C,($FFFFFE14).w
		bhi.s	loc_140AC
		move.w	#$82,d0		; play LZ music
		cmpi.w	#$103,($FFFFFE10).w ; check if level is	0103 (SBZ3)
		bne.s	loc_140A6
		move.w	#$86,d0		; play SBZ music

loc_140A6:
		jsr	(PlaySound).l

and replace it with:

ResumeMusic:				; XREF: Obj64_Wobble; Sonic_Water; Obj0A_ReduceAir
		cmpi.w	#$C,($FFFFFE14).w
		bhi.s	loc_140AC
		move.w	($FFFFFF90).w,d0	      ;resume music
		jsr	(PlaySound).l

that sets up music memory for later.

GIT Disassembly users, start here

Note to AS disassembly users

This guide assumes you are not using that fork, but if you are, I will provide alternate versions of the new macros when I need to and you can always replace @ with . and use my new macro setup especially for you that can be otherwise skipped.

Macro Setup (skip if you are not using an AS disassembly)

Open MacroSetup.asm and add this at the bottom of the file:

incbin macro filename
	binclude filename
	endm

That will make it so that incbin will work with asw (also known as asl on linux) and thus make it so that you no longer have to replace incbin with binclude.

Macros

If you are using the as fork please prepare the macro setup part first before continuing, otherwise, here we will define some new macros for working with z80 pointers, these will not be needed after part 2, but if we skip them now, the driver will be broken, so open Macros.asm and add this at the bottom of the file:

; (since the DAC banks are incbin'd, this macro isn't in use, yet)
; for DAC pointers
zPtrDAC: macro addr
     dc.w ((((addr&$7FFF)+$8000)<<8)&$FF00)+(((addr&$7FFF)+$8000)>>8)
     endm

; for special pointers in the driver itself
zPtrSpec: macro addr
     dc.w (((addr&$1FFF)>>$08)|((addr&$1FFF)<<$08))&$FFFF
     endm

; for pointers to things that the 68k will interact with in the Z80 Driver
z68kPtr: macro addr
     dc.w (((addr&$FFFF)|$8000>>$08)|((addr&$FFFF)|$8000<<$08))&$FFFF
     endm

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.

Prepare Vertical Interrupt Handler for new driver

Sonic 1 calls a early 68k smps driver in both the vertical blank routine and the horizontal blank routine, we don need this for the new driver, so we will have to make a few deletions here and there. Sonic 2 also does this with it's compressed z80 driver, so if you are actually placing this in sonic 2, you might want to make a note of that.<p> First we will open sonic.asm and fix the vertical interrupt, by deleting this line:

		jsr	(UpdateMusic).l

under:

VBla_Music:

Prepare Hoizontal Interrupt Handler for new driver

Now we locate:

loc_119E:
		clr.b	($FFFFF64F).w
		movem.l	d0-a6,-(sp)
		bsr.w	Demo_Time
		jsr	(UpdateMusic).l
		movem.l	(sp)+,d0-a6
		rte	
; End of function HBlank

See another familiar line? Yes, you've got it, do the same thing to it:

loc_119E:
		clr.b	($FFFFF64F).w
		movem.l	d0-a6,-(sp)
		bsr.w	Demo_Time
		movem.l	(sp)+,d0-a6
		rte	
; End of function HBlank

That effectively disables the Sonic 1/2 style interrupt handler which we will not need and prevents a nasty error down the road.

Upgrading the Load Driver Routine

Okay, we disabled the driver's interrupt handler, wouldn't we want now to use the sonic3 driver instead? Here is where we start installing it. Locate:

SoundDriverLoad:
		nop	
		stopZ80
		resetZ80
		lea	(Kos_Z80).l,a0	; load sound driver
		lea	(z80_ram).l,a1	; target Z80 RAM
		bsr.w	KosDec		; decompress
		resetZ80a
		nop	
		nop	
		nop	
		nop	
		resetZ80
		startZ80
		rts

and replace it all with:

SoundDriverLoad:					; XREF: GameClrRAM;	TitleScreen
		nop
		stopZ80
		resetZ80
		lea	(DriverData).l,a0
		lea	(z80_ram).l,a1
		move.w	#DriverDataEnd-DriverData-1,d0

@loadDriver
		move.b	(a0)+,(a1)+
		dbf	d0,@loadDriver
		lea	(DriverPointers).l,a0
		lea	(z80_ram+$1300).l,a1
		move.w	#DriverPointersEnd-DriverPointers-1,d0

@loadPointers
		move.b	(a0)+,(a1)+
		dbf	d0,	@loadPointers
		lea	(UniversalVoiceBank).l,a0
		lea	(z80_ram+$17D8).l,a1
		move.w	#UniversalVoiceBankEnd-UniversalVoiceBank-1,d0

@loadUVB
		move.b	(a0)+,(a1)+
		dbf	d0,@loadUVB
		lea	(DriverResetData).l,a0
		lea	(z80_ram+$1C00).l,a1
		move.w	#DriverResetDataEnd-DriverResetData-1,d0

@loadResetData
		move.b	(a0)+,(a1)+
		dbf	d0,@loadResetData
		btst	#6,($FFFFFFF8).w
		beq.s	@restartZ80
		move.b	#1,(z80_ram+$1C02).l

@restartZ80
		resetZ80a
		nop
		nop
		nop
		nop
		resetZ80
		startZ80
		rts
DriverResetData:
		dc.b	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DriverResetDataEnd:

Upgrading the Playback Routines

Now we have the code to load the new driver, time to add the new playback routines. Open "sub PlaySound.asm" in the _incObj folder.

Upgrade Music Routine

First the PlaySound routine, locate:

PlaySound:
		move.b	d0,(v_snddriver_ram+v_playsnd1).w
		rts

and replace it completely with:

PlaySound:
		cmpi.w	#$FB,d0
		blt.s	PlayNotSpecialFlag
		bhi.s	TestForNormalSpeed
		move	#8,d0
		jmp	SetTempo

TestForNormalSpeed:
		cmpi.w	#$FC,d0
		bne.s	PlayNotSpecialFlag
		clr.w	d0
		jmp	SetTempo

PlayNotSpecialFlag:
		stopZ80

PlaySoundZ80NotStopped:
		resetZ80a
		bne.s	PlaySoundZ80NotStopped	; loop until it says it's stopped
		move.b	d0,(z80_ram+$1C0A).l
		startZ80
		rts

PlaySound_Ex:
		tst.b	4(A0)
		bpl.s	SkipPlaySound_Special

Do not be alarmed about the new sound routine that was added, it is equivalent to the PlaySound_Local routine (as a matter of fact, it is identical, why sonic1 does not already have it is beyond me, since it indeed does work in Sonic 1)

sound playback routines

now find:

; ---------------------------------------------------------------------------
; Subroutine to	play a sound effect
; ---------------------------------------------------------------------------

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


PlaySound_Special:
		move.b	d0,(v_snddriver_ram+v_playsnd2).w
		rts	
; End of function PlaySound_Special

; ===========================================================================
; ---------------------------------------------------------------------------
; Unused sound/music subroutine
; ---------------------------------------------------------------------------

PlaySound_Unused:
		move.b	d0,(v_snddriver_ram+v_playnull).w
		rts

and replace it entirely with:

; ---------------------------------------------------------------------------
; Subroutine to	play a special sound/music (FB-FF)
; ---------------------------------------------------------------------------

PlaySound_Special:
		stopZ80
		waitZ80
		cmp.b	(z80_ram+$1C0B).l,d0
		beq.s	PlaySound_Special1
		tst.b	(z80_ram+$1C0B).l
		bne.s	PlaySound_Special0
		move.b	d0,(z80_ram+$1C0B).l
		startZ80
		rts

PlaySound_Special0:
		move.b	d0,(z80_ram+$1C0C).l

PlaySound_Special1:
		startZ80

SkipPlaySound_Special:
		rts
; End of function PlaySound_Special

; ---------------------------------------------------------------------------
; Subroutine to change the music tempo
; ---------------------------------------------------------------------------

SetTempo:
		stopZ80
		waitZ80
		move.b	D0,(z80_ram+$1C08).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.

Open "PauseGame.asm" in the _inc folder and replace the contents with:

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

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


PauseGame:				; XREF: Level_MainLoop; et al
		nop
		tst.b	(v_lives).w ; do you have any lives left
		beq	Unpause           ; if not, branch
		tst.w	(f_pause).w ;is the game already paused?
		bne.s	Pause_StopGame ;if yes, branch
		move.b	(v_jpadpress1).w,d0 ;did you press start
		andi.b	#$80,d0
		beq	Pause_DoNothing         ;if not, branch

Pause_StopGame:	
		move.w	#1,(f_pause).w ;unpause the game
		stopZ80
		waitZ80
		move.b	#1,(z80_ram+$1C10).l ;unpause the music ;)
		startZ80

Pause_Loop:
		move.b	#$10,(f_pause).w ;re-pause the game (used in slow-mo and frame advance)
		jsr	DelayProgram ;wait...
		tst.b	(f_slomocheat).w ; Edit: the value is $FFFFFFE1 in Sonic 1 (slow-mo/frame advance mode)
		beq.s	Pause_ChkA
		btst	#bitA,(v_jpadpress1).w ;is player 1 pressing either A?
		beq.s	Pause_ChkBC ;if not, branch
		nop
		bra.s	Pause_Exit ;time to stop the z80 again

Pause_ChkBC:
		btst	#bitB,(v_jpadhold1).w ;did you press b?
		bne.s	Pause_SlowMo ;if so, branch
		btst	#bitC,(v_jpadpress1).w ;did you hold c?
		bne.s	Pause_SlowMo ;if so, branch

Pause_ChkA:
		btst	#bitA,(v_jpadpress1).w            ;did you press a?
		beq.s	Pause_ChkStart           ;if yes, then paise the freaken game
Pause_Exit:
		move.b	#id_Sega,(v_gamemode).w  ;prepare to go to sega screen (level select is not 0xC0 in sonic1, but part of title screen code)
		bra.s	Pause_ResetZ80                   ;go to title screen

Pause_ChkStart:
		move.b	(v_jpadpress1).w,d0  ;on controller 1?
		andi.b	#$80,d0                 ;if not, no change
		beq.s	Pause_Loop   ;in other words, don't pause

Pause_ResetZ80:
		stopZ80
		waitZ80
		move.b	#$80,(z80_ram+$1C10).l ;pause the music
		startZ80

Unpause:
		move.w	#0,(f_pause).w ;unpause the game

Pause_DoNothing:
		rts

Pause_SlowMo:
		move.w	#1,(f_pause).w ;unpause the music for a frame
		stopZ80
		waitZ80
		move.b	#$80,(z80_ram+$1C10).l ;pause the music again
		startZ80
		rts
; End of function PauseGame

Home Info Forums GitHub IRC Chat SEGA Retro Main Games Game Info Hacking Info Fan Gaming Music TV Printed Media

Search Sonic Retro

Actions

SCHG How-to Discussion Edit History Move Unwatch SCHG How-to Editing Port Sonic 3's Sound Driver to Sonic 1 (section)

Replacing 68k driver with new Z80 driver

We need the sound driver itself if we are going to have any sound and music, so we open s1.sounddriver.asm and delete all of this:

; ---------------------------------------------------------------------------
; Go_SoundTypes:
Go_SoundPriorities:	dc.l SoundPriorities
; Go_SoundD0:
Go_SpecSoundIndex:	dc.l SpecSoundIndex
Go_MusicIndex:		dc.l MusicIndex
Go_SoundIndex:		dc.l SoundIndex
; off_719A0:
Go_SpeedUpIndex:	dc.l SpeedUpIndex
Go_PSGIndex:		dc.l PSG_Index
; ---------------------------------------------------------------------------
; PSG instruments used in music
; ---------------------------------------------------------------------------
PSG_Index:
		dc.l PSG1, PSG2, PSG3
		dc.l PSG4, PSG5, PSG6
		dc.l PSG7, PSG8, PSG9
PSG1:		binclude	"sound/psg/psg1.bin"
PSG2:		binclude	"sound/psg/psg2.bin"
PSG3:		binclude	"sound/psg/psg3.bin"
PSG4:		binclude	"sound/psg/psg4.bin"
PSG6:		binclude	"sound/psg/psg6.bin"
PSG5:		binclude	"sound/psg/psg5.bin"
PSG7:		binclude	"sound/psg/psg7.bin"
PSG8:		binclude	"sound/psg/psg8.bin"
PSG9:		binclude	"sound/psg/psg9.bin"
; ---------------------------------------------------------------------------
; New tempos for songs during speed shoes
; ---------------------------------------------------------------------------
; DANGER! several songs will use the first few bytes of MusicIndex as their main
; tempos while speed shoes are active. If you don't want that, you should add
; their "correct" sped-up main tempos to the list.
; byte_71A94:
SpeedUpIndex:
		dc.b 7		; GHZ
		dc.b $72	; LZ
		dc.b $73	; MZ
		dc.b $26	; SLZ
		dc.b $15	; SYZ
		dc.b 8		; SBZ
		dc.b $FF	; Invincibility
		dc.b 5		; Extra Life
		;dc.b ?		; Special Stage
		;dc.b ?		; Title Screen
		;dc.b ?		; Ending
		;dc.b ?		; Boss
		;dc.b ?		; FZ
		;dc.b ?		; Sonic Got Through
		;dc.b ?		; Game Over
		;dc.b ?		; Continue Screen
		;dc.b ?		; Credits
		;dc.b ?		; Drowning
		;dc.b ?		; Get Emerald

; ---------------------------------------------------------------------------
; Music	Pointers
; ---------------------------------------------------------------------------
MusicIndex:
ptr_mus81:	dc.l Music81
ptr_mus82:	dc.l Music82
ptr_mus83:	dc.l Music83
ptr_mus84:	dc.l Music84
ptr_mus85:	dc.l Music85
ptr_mus86:	dc.l Music86
ptr_mus87:	dc.l Music87
ptr_mus88:	dc.l Music88
ptr_mus89:	dc.l Music89
ptr_mus8A:	dc.l Music8A
ptr_mus8B:	dc.l Music8B
ptr_mus8C:	dc.l Music8C
ptr_mus8D:	dc.l Music8D
ptr_mus8E:	dc.l Music8E
ptr_mus8F:	dc.l Music8F
ptr_mus90:	dc.l Music90
ptr_mus91:	dc.l Music91
ptr_mus92:	dc.l Music92
ptr_mus93:	dc.l Music93
ptr_musend
; ---------------------------------------------------------------------------
; Priority of sound. New music or SFX must have a priority higher than or equal
; to what is stored in v_sndprio or it won't play. If bit 7 of new priority is
; set ($80 and up), the new music or SFX will not set its priority -- meaning
; any music or SFX can override it (as long as it can override whatever was
; playing before). Usually, SFX will only override SFX, special SFX ($D0-$DF)
; will only override special SFX and music will only override music.
; ---------------------------------------------------------------------------
; SoundTypes:
SoundPriorities:
		dc.b     $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90	; $81
		dc.b $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90	; $90
		dc.b $80,$70,$70,$70,$70,$70,$70,$70,$70,$70,$68,$70,$70,$70,$60,$70	; $A0
		dc.b $70,$60,$70,$60,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$7F	; $B0
		dc.b $60,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70,$70	; $C0
		dc.b $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80	; $D0
		dc.b $90,$90,$90,$90,$90                                            	; $E0

; ---------------------------------------------------------------------------
; Subroutine to update music more than once per frame
; (Called by horizontal & vert. interrupts)
; ---------------------------------------------------------------------------

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

; sub_71B4C:
UpdateMusic:
		stopZ80
		nop	
		nop	
		nop	
; loc_71B5A:
.updateloop:
		btst	#0,(z80_bus_request).l		; Is the z80 busy?
		bne.s	.updateloop			; If so, wait

		btst	#7,(z80_dac_status).l		; Is DAC accepting new samples?
		beq.s	.driverinput			; Branch if yes
		startZ80
		nop	
		nop	
		nop	
		nop	
		nop	
		bra.s	UpdateMusic
; ===========================================================================
; loc_71B82:
.driverinput:
		lea	(v_snddriver_ram&$FFFFFF).l,a6
		clr.b	f_voice_selector(a6)
		tst.b	f_stopmusic(a6)			; is music paused?
		bne.w	PauseMusic			; if yes, branch
		subq.b	#1,v_main_tempo_timeout(a6)	; Has main tempo timer expired?
		bne.s	.skipdelay
		jsr	TempoWait(pc)
; loc_71B9E:
.skipdelay:
		move.b	v_fadeout_counter(a6),d0
		beq.s	.skipfadeout
		jsr	DoFadeOut(pc)
; loc_71BA8:
.skipfadeout:
		tst.b	f_fadein_flag(a6)
		beq.s	.skipfadein
		jsr	DoFadeIn(pc)
; loc_71BB2:
.skipfadein:
		; DANGER! The following line only checks v_playsnd1 and v_playsnd2, breaking v_playnull.
		tst.w	v_playsnd1(a6)		; is a music or sound queued for played?
		beq.s	.nosndinput		; if not, branch
		jsr	Sound_Play(pc)
; loc_71BBC:
.nosndinput:
		cmpi.b	#$80,v_playsnd0(a6)	; is song queue set for silence (empty)?
		beq.s	.nonewsound		; If yes, branch
		jsr	Sound_ChkValue(pc)
; loc_71BC8:
.nonewsound:
		lea	v_music_dac_track(a6),a5
		tst.b	zTrackPlaybackControl(a5) ; Is DAC track playing?
		bpl.s	.dacdone		; Branch if not
		jsr	UpdateDAC(pc)
; loc_71BD4:
.dacdone:
		clr.b	f_updating_dac(a6)
		moveq	#((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7	; 6 FM tracks
; loc_71BDA:
.bgmfmloop:
		adda.w	#zTrackSz,a5
		tst.b	zTrackPlaybackControl(a5) ; Is track playing?
		bpl.s	.bgmfmnext		; Branch if not
		jsr	FMUpdateTrack(pc)
; loc_71BE6:
.bgmfmnext:
		dbf	d7,.bgmfmloop

		moveq	#((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7 ; 3 PSG tracks
; loc_71BEC:
.bgmpsgloop:
		adda.w	#zTrackSz,a5
		tst.b	zTrackPlaybackControl(a5) ; Is track playing?
		bpl.s	.bgmpsgnext		; Branch if not
		jsr	PSGUpdateTrack(pc)
; loc_71BF8:
.bgmpsgnext:
		dbf	d7,.bgmpsgloop

		move.b	#$80,f_voice_selector(a6)			; Now at SFX tracks
		moveq	#((v_sfx_fm_tracks_end-v_sfx_fm_tracks)/zTrackSz)-1,d7	; 3 FM tracks (SFX)
; loc_71C04:
.sfxfmloop:
		adda.w	#zTrackSz,a5
		tst.b	zTrackPlaybackControl(a5) ; Is track playing?
		bpl.s	.sfxfmnext		; Branch if not
		jsr	FMUpdateTrack(pc)
; loc_71C10:
.sfxfmnext:
		dbf	d7,.sfxfmloop

		moveq	#((v_sfx_psg_tracks_end-v_sfx_psg_tracks)/zTrackSz)-1,d7 ; 3 PSG tracks (SFX)
; loc_71C16:
.sfxpsgloop:
		adda.w	#zTrackSz,a5
		tst.b	zTrackPlaybackControl(a5) ; Is track playing?
		bpl.s	.sfxpsgnext		; Branch of not
		jsr	PSGUpdateTrack(pc)
; loc_71C22:
.sfxpsgnext:
		dbf	d7,.sfxpsgloop
		
		move.b	#$40,f_voice_selector(a6) ; Now at special SFX tracks
		adda.w	#zTrackSz,a5
		tst.b	zTrackPlaybackControl(a5) ; Is track playing?
		bpl.s	.specfmdone		; Branch if not
		jsr	FMUpdateTrack(pc)
; loc_71C38:
.specfmdone:
		adda.w	#zTrackSz,a5
		tst.b	zTrackPlaybackControl(a5) ; Is track playing
		bpl.s	DoStartZ80		; Branch if not
		jsr	PSGUpdateTrack(pc)
; loc_71C44:
DoStartZ80:
		startZ80
		rts	
; End of function UpdateMusic


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

; sub_71C4E:
UpdateDAC:
		subq.b	#1,zTrackDurationTimeout(a5)	; Has DAC sample timeout expired?
		bne.s	.locret				; Return if not
		move.b	#$80,f_updating_dac(a6)		; Set flag to indicate this is the DAC
		movea.l	zTrackDataPointer(a5),a4	; DAC track data pointer
; loc_71C5E:
.sampleloop:
		moveq	#0,d5
		move.b	(a4)+,d5	; Get next SMPS unit
		cmpi.b	#$E0,d5		; Is it a coord. flag?
		blo.s	.notcoord	; Branch if not
		jsr	CoordFlag(pc)
		bra.s	.sampleloop
; ===========================================================================
; loc_71C6E:
.notcoord:
		tst.b	d5			; Is it a sample?
		bpl.s	.gotduration		; Branch if not (duration)
		move.b	d5,zTrackSavedDAC(a5)	; Store new sample
		move.b	(a4)+,d5		; Get another byte
		bpl.s	.gotduration		; Branch if it is a duration
		subq.w	#1,a4			; Put byte back
		move.b	zTrackSavedDuration(a5),zTrackDurationTimeout(a5) ; Use last duration
		bra.s	.gotsampleduration
; ===========================================================================
; loc_71C84:
.gotduration:
		jsr	SetDuration(pc)
; loc_71C88:
.gotsampleduration:
		move.l	a4,zTrackDataPointer(a5) ; Save pointer
		btst	#2,zTrackPlaybackControl(a5) ; Is track being overridden?
		bne.s	.locret			; Return if yes
		moveq	#0,d0
		move.b	zTrackSavedDAC(a5),d0	; Get sample
		cmpi.b	#$80,d0			; Is it a rest?
		beq.s	.locret			; Return if yes
		btst	#3,d0			; Is bit 3 set (samples between $88-$8F)?
		bne.s	.timpani		; Various timpani
		move.b	d0,(z80_dac_sample).l
; locret_71CAA:
.locret:
		rts	
; ===========================================================================
; loc_71CAC:
.timpani:
		subi.b	#$88,d0		; Convert into an index
		move.b	DAC_sample_rate(pc,d0.w),d0
		; Warning: this affects the raw pitch of sample $83, meaning it will
		; use this value from then on.
		move.b	d0,(z80_dac3_pitch).l
		move.b	#$83,(z80_dac_sample).l	; Use timpani
		rts	
; End of function UpdateDAC

; ===========================================================================
; Note: this only defines rates for samples $88-$8D, meaning $8E-$8F are invalid.
; Also, $8C-$8D are so slow you may want to skip them.
; byte_71CC4:
DAC_sample_rate: dc.b $12, $15, $1C, $1D, $FF, $FF

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

; sub_71CCA:
FMUpdateTrack:
		subq.b	#1,zTrackDurationTimeout(a5)	; Update duration timeout
		bne.s	.notegoing			; Branch if it hasn't expired
		bclr	#4,zTrackPlaybackControl(a5)	; Clear 'do not attack next note' bit
		jsr	FMDoNext(pc)
		jsr	FMPrepareNote(pc)
		bra.w	FMNoteOn
; ===========================================================================
; loc_71CE0:
.notegoing:
		jsr	NoteFillUpdate(pc)
		jsr	DoModulation(pc)
		bra.w	FMUpdateFreq
; End of function FMUpdateTrack


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

; sub_71CEC:
FMDoNext:
		movea.l	zTrackDataPointer(a5),a4	; Track data pointer
		bclr	#1,zTrackPlaybackControl(a5)	; Clear 'track at rest' bit
; loc_71CF4:
.noteloop:
		moveq	#0,d5
		move.b	(a4)+,d5	; Get byte from track
		cmpi.b	#$E0,d5		; Is this a coord. flag?
		blo.s	.gotnote	; Branch if not
		jsr	CoordFlag(pc)
		bra.s	.noteloop
; ===========================================================================
; loc_71D04:
.gotnote:
		jsr	FMNoteOff(pc)
		tst.b	d5		; Is this a note?
		bpl.s	.gotduration	; Branch if not
		jsr	FMSetFreq(pc)
		move.b	(a4)+,d5	; Get another byte
		bpl.s	.gotduration	; Branch if it is a duration
		subq.w	#1,a4		; Otherwise, put it back
		bra.w	FinishTrackUpdate
; ===========================================================================
; loc_71D1A:
.gotduration:
		jsr	SetDuration(pc)
		bra.w	FinishTrackUpdate
; End of function FMDoNext


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

; sub_71D22:
FMSetFreq:
		subi.b	#$80,d5			; Make it a zero-based index
		beq.s	TrackSetRest
		add.b	zTrackTranspose(a5),d5	; Add track transposition
		andi.w	#$7F,d5			; Clear high byte and sign bit
		lsl.w	#1,d5
		lea	FM_Notes(pc),a0
		move.w	(a0,d5.w),d6
		move.w	d6,zTrackFreq(a5)	; Store new frequency
		rts	
; End of function FMSetFreq


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

; sub_71D40:
SetDuration:
		move.b	d5,d0
		move.b	zTrackTempoDivider(a5),d1	; Get dividing timing
; loc_71D46:
.multloop:
		subq.b	#1,d1
		beq.s	.donemult
		add.b	d5,d0
		bra.s	.multloop
; ===========================================================================
; loc_71D4E:
.donemult:
		move.b	d0,zTrackSavedDuration(a5)	; Save duration
		move.b	d0,zTrackDurationTimeout(a5)	; Save duration timeout
		rts	
; End of function SetDuration

; ===========================================================================
; loc_71D58:
TrackSetRest:
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		clr.w	zTrackFreq(a5)			; Clear frequency

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

; sub_71D60:
FinishTrackUpdate:
		move.l	a4,zTrackDataPointer(a5)	; Store new track position
		move.b	zTrackSavedDuration(a5),zTrackDurationTimeout(a5) ; Reset note timeout
		btst	#4,zTrackPlaybackControl(a5)	; Is track set to not attack note?
		bne.s	.locret				; If so, branch
		move.b	zTrackNoteFillMaster(a5),zTrackNoteFillTimeout(a5) ; Reset note fill timeout
		clr.b	zTrackVolFlutter(a5)		; Reset PSG flutter index (even on FM tracks...)
		btst	#3,zTrackPlaybackControl(a5)	; Is modulation on?
		beq.s	.locret				; If not, return
		movea.l	zTrackModulationPtr(a5),a0	; Modulation data pointer
		move.b	(a0)+,zTrackModulationWait(a5)	; Reset wait
		move.b	(a0)+,zTrackModulationSpeed(a5)	; Reset speed
		move.b	(a0)+,zTrackModulationDelta(a5)	; Reset delta
		move.b	(a0)+,d0			; Get steps
		lsr.b	#1,d0				; Halve them
		move.b	d0,zTrackModulationSteps(a5)	; Then store
		clr.w	zTrackModulationVal(a5)		; Reset frequency change
; locret_71D9C:
.locret:
		rts	
; End of function FinishTrackUpdate


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

; sub_71D9E:
NoteFillUpdate:
		tst.b	zTrackNoteFillTimeout(a5)	; Is note fill on?
		beq.s	.locret
		subq.b	#1,zTrackNoteFillTimeout(a5)	; Update note fill timeout
		bne.s	.locret				; Return if it hasn't expired
		bset	#1,zTrackPlaybackControl(a5)	; Put track at rest
		tst.b	zTrackVoiceControl(a5)		; Is this a psg track?
		bmi.w	.psgnoteoff			; If yes, branch
		jsr	FMNoteOff(pc)
		addq.w	#4,sp				; Do not return to caller
		rts	
; ===========================================================================
; loc_71DBE:
.psgnoteoff:
		jsr	PSGNoteOff(pc)
		addq.w	#4,sp		; Do not return to caller
; locret_71DC4:
.locret:
		rts	
; End of function NoteFillUpdate


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

; sub_71DC6:
DoModulation:
		addq.w	#4,sp				; Do not return to caller (but see below)
		btst	#3,zTrackPlaybackControl(a5)	; Is modulation active?
		beq.s	.locret				; Return if not
		tst.b	zTrackModulationWait(a5)	; Has modulation wait expired?
		beq.s	.waitdone			; If yes, branch
		subq.b	#1,zTrackModulationWait(a5)	; Update wait timeout
		rts	
; ===========================================================================
; loc_71DDA:
.waitdone:
		subq.b	#1,zTrackModulationSpeed(a5)	; Update speed
		beq.s	.updatemodulation		; If it expired, want to update modulation
		rts	
; ===========================================================================
; loc_71DE2:
.updatemodulation:
		movea.l	zTrackModulationPtr(a5),a0	; Get modulation data
		move.b	1(a0),zTrackModulationSpeed(a5)	; Restore modulation speed
		tst.b	zTrackModulationSteps(a5)	; Check number of steps
		bne.s	.calcfreq			; If nonzero, branch
		move.b	3(a0),zTrackModulationSteps(a5)	; Restore from modulation data
		neg.b	zTrackModulationDelta(a5)	; Negate modulation delta
		rts	
; ===========================================================================
; loc_71DFE:
.calcfreq:
		subq.b	#1,zTrackModulationSteps(a5)	; Update modulation steps
		move.b	zTrackModulationDelta(a5),d6	; Get modulation delta
		ext.w	d6
		add.w	zTrackModulationVal(a5),d6	; Add cumulative modulation change
		move.w	d6,zTrackModulationVal(a5)	; Store it
		add.w	zTrackFreq(a5),d6		; Add note frequency to it
		subq.w	#4,sp		; In this case, we want to return to caller after all
; locret_71E16:
.locret:
		rts	
; End of function DoModulation


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

; sub_71E18:
FMPrepareNote:
		btst	#1,zTrackPlaybackControl(a5)	; Is track resting?
		bne.s	locret_71E48			; Return if so
		move.w	zTrackFreq(a5),d6		; Get current note frequency
		beq.s	FMSetRest			; Branch if zero
; loc_71E24:
FMUpdateFreq:
		move.b	zTrackDetune(a5),d0 	; Get detune value
		ext.w	d0
		add.w	d0,d6				; Add note frequency
		btst	#2,zTrackPlaybackControl(a5)	; Is track being overridden?
		bne.s	locret_71E48			; Return if so
		move.w	d6,d1
		lsr.w	#8,d1
		move.b	#$A4,d0			; Register for upper 6 bits of frequency
		jsr	WriteFMIorII(pc)
		move.b	d6,d1
		move.b	#$A0,d0			; Register for lower 8 bits of frequency
		jsr	WriteFMIorII(pc)	; (It would be better if this were a jmp)
; locret_71E48:
locret_71E48:
		rts	
; ===========================================================================
; loc_71E4A:
FMSetRest:
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		rts	
; End of function FMPrepareNote

; ===========================================================================
; loc_71E50:
PauseMusic:
		bmi.s	.unpausemusic		; Branch if music is being unpaused
		cmpi.b	#2,f_stopmusic(a6)
		beq.w	.unpausedallfm
		move.b	#2,f_stopmusic(a6)
		moveq	#2,d3
		move.b	#$B4,d0		; Command to set AMS/FMS/panning
		moveq	#0,d1		; No panning, AMS or FMS
; loc_71E6A:
.killpanloop:
		jsr	WriteFMI(pc)
		jsr	WriteFMII(pc)
		addq.b	#1,d0
		dbf	d3,.killpanloop

		moveq	#2,d3
		moveq	#$28,d0		; Key on/off register
; loc_71E7C:
.noteoffloop:
		move.b	d3,d1		; FM1, FM2, FM3
		jsr	WriteFMI(pc)
		addq.b	#4,d1		; FM4, FM5, FM6
		jsr	WriteFMI(pc)
		dbf	d3,.noteoffloop

		jsr	PSGSilenceAll(pc)
		bra.w	DoStartZ80
; ===========================================================================
; loc_71E94:
.unpausemusic:
		clr.b	f_stopmusic(a6)
		moveq	#zTrackSz,d3
		lea	v_music_fmdac_tracks(a6),a5
		moveq	#((v_music_fmdac_tracks_end-v_music_fmdac_tracks)/zTrackSz)-1,d4	; 6 FM + 1 DAC tracks
; loc_71EA0:
.bgmfmloop:
		btst	#7,zTrackPlaybackControl(a5)	; Is track playing?
		beq.s	.bgmfmnext			; Branch if not
		btst	#2,zTrackPlaybackControl(a5)	; Is track being overridden?
		bne.s	.bgmfmnext			; Branch if yes
		move.b	#$B4,d0				; Command to set AMS/FMS/panning
		move.b	zTrackAMSFMSPan(a5),d1		; Get value from track RAM
		jsr	WriteFMIorII(pc)
; loc_71EB8:
.bgmfmnext:
		adda.w	d3,a5
		dbf	d4,.bgmfmloop

		lea	v_sfx_fm_tracks(a6),a5
		moveq	#((v_sfx_fm_tracks_end-v_sfx_fm_tracks)/zTrackSz)-1,d4	; 3 FM tracks (SFX)
; loc_71EC4:
.sfxfmloop:
		btst	#7,zTrackPlaybackControl(a5)	; Is track playing?
		beq.s	.sfxfmnext			; Branch if not
		btst	#2,zTrackPlaybackControl(a5)	; Is track being overridden?
		bne.s	.sfxfmnext			; Branch if yes
		move.b	#$B4,d0				; Command to set AMS/FMS/panning
		move.b	zTrackAMSFMSPan(a5),d1		; Get value from track RAM
		jsr	WriteFMIorII(pc)
; loc_71EDC:
.sfxfmnext:
		adda.w	d3,a5
		dbf	d4,.sfxfmloop

		lea	v_spcsfx_track_ram(a6),a5
		btst	#7,(a5)			; Is track playing? (zTrackPlaybackControl)
		beq.s	.unpausedallfm		; Branch if not
		btst	#2,(a5)			; Is track being overridden? (zTrackPlaybackControl)
		bne.s	.unpausedallfm		; Branch if yes
		move.b	#$B4,d0			; Command to set AMS/FMS/panning
		move.b	zTrackAMSFMSPan(a5),d1	; Get value from track RAM
		jsr	WriteFMIorII(pc)
; loc_71EFE:
.unpausedallfm:
		bra.w	DoStartZ80

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

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


Sound_Play:
		movea.l	(Go_SoundPriorities).l,a0
		lea	v_playsnd1(a6),a1	; load music track number
		_move.b	v_sndprio(a6),d3	; Get priority of currently playing SFX
		moveq	#2,d4			; Number of queues-1 (v_playsnd1, v_playsnd2, v_playnull)
; loc_71F12:
.inputloop:
		move.b	(a1),d0			; move track number to d0
		move.b	d0,d1
		clr.b	(a1)+			; Clear entry
		subi.b	#bgm__First,d0		; Make it into 0-based index
		blo.s	.nextinput		; If negative (i.e., it was $80 or lower), branch
		cmpi.b	#$80,v_playsnd0(a6)	; Is v_playsnd0 a $80 (silence/empty)?
		beq.s	.havesound		; If yes, branch
		move.b	d1,v_playsnd1(a6)	; Put sound into v_playsnd1
		bra.s	.nextinput
; ===========================================================================
; loc_71F2C:
.havesound:
		andi.w	#$7F,d0			; Clear high byte and sign bit
		move.b	(a0,d0.w),d2		; Get sound type
		cmp.b	d3,d2			; Is it a lower priority sound?
		blo.s	.nextinput		; Branch if yes
		move.b	d2,d3			; Store new priority
		move.b	d1,v_playsnd0(a6)	; Queue sound for play
; loc_71F3E:
.nextinput:
		dbf	d4,.inputloop

		tst.b	d3			; We don't want to change sound priority if it is negative
		bmi.s	.locret
		_move.b	d3,v_sndprio(a6)	; Set new sound priority
; locret_71F4A:
.locret:
		rts	
; End of function Sound_Play


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


Sound_ChkValue:
		moveq	#0,d7
		move.b	v_playsnd0(a6),d7
		beq.w	StopSoundAndMusic
		bpl.s	.locret			; If >= 0, return (not a valid sound, bgm or command)
		move.b	#$80,v_playsnd0(a6)	; reset	music flag
		; DANGER! Music ends at $93, yet this checks until $9F; attempting to
		; play sounds $94-$9F will cause a crash! Remove the '+$C' to fix this.
		; See LevSel_NoCheat for more.
		cmpi.b	#bgm__Last+$C,d7	; Is this music ($81-$9F)?
		bls.w	Sound_PlayBGM		; Branch if yes
		cmpi.b	#sfx__First,d7		; Is this after music but before sfx? (redundant check)
		blo.w	.locret			; Return if yes
		cmpi.b	#sfx__Last,d7		; Is this sfx ($A0-$CF)?
		bls.w	Sound_PlaySFX		; Branch if yes
		cmpi.b	#spec__First,d7		; Is this after sfx but before special sfx? (redundant check)
		blo.w	.locret			; Return if yes
		; DANGER! Special SFXes end at $D0, yet this checks until $DF; attempting to
		; play sounds $D1-$DF will cause a crash! Remove the '+$10' and change the 'blo' to a 'bls'
		; and uncomment the two lines below to fix this.
		cmpi.b	#spec__Last+$10,d7	; Is this special sfx ($D0-$DF)?
		blo.w	Sound_PlaySpecial	; Branch if yes
		;cmpi.b	#flg__First,d7		; Is this after special sfx but before $E0?
		;blo.w	.locret			; Return if yes
		cmpi.b	#flg__Last,d7		; Is this $E0-$E4?
		bls.s	Sound_E0toE4		; Branch if yes
; locret_71F8C:
.locret:
		rts	
; ===========================================================================

Sound_E0toE4:
		subi.b	#flg__First,d7
		lsl.w	#2,d7
		jmp	Sound_ExIndex(pc,d7.w)
; ===========================================================================

Sound_ExIndex:
ptr_flgE0:	bra.w	FadeOutMusic		; $E0
ptr_flgE1:	bra.w	PlaySega		; $E1
ptr_flgE2:	bra.w	SpeedUpMusic		; $E2
ptr_flgE3:	bra.w	SlowDownMusic		; $E3
ptr_flgE4:	bra.w	StopSoundAndMusic	; $E4
ptr_flgend
; ===========================================================================
; ---------------------------------------------------------------------------
; Play "Say-gaa" PCM sound
; ---------------------------------------------------------------------------
; Sound_E1:
PlaySega:
		move.b	#$88,(z80_dac_sample).l	; Queue Sega PCM
		startZ80
		move.w	#$11,d1
; loc_71FC0:
.busyloop_outer:
		move.w	#-1,d0
; loc_71FC4:
.busyloop:
		nop	
		dbf	d0,.busyloop

		dbf	d1,.busyloop_outer

		addq.w	#4,sp	; Tamper return value so we don't return to caller
		rts	
; ===========================================================================
; ---------------------------------------------------------------------------
; Play music track $81-$9F
; ---------------------------------------------------------------------------
; Sound_81to9F:
Sound_PlayBGM:
		cmpi.b	#bgm_ExtraLife,d7	; is the "extra life" music to be played?
		bne.s	.bgmnot1up		; if not, branch
		tst.b	f_1up_playing(a6)	; Is a 1-up music playing?
		bne.w	.locdblret		; if yes, branch
		lea	v_music_track_ram(a6),a5
		moveq	#((v_music_track_ram_end-v_music_track_ram)/zTrackSz)-1,d0	; 1 DAC + 6 FM + 3 PSG tracks
; loc_71FE6:
.clearsfxloop:
		bclr	#2,zTrackPlaybackControl(a5) ; Clear 'SFX is overriding' bit
		adda.w	#zTrackSz,a5
		dbf	d0,.clearsfxloop

		lea	v_sfx_track_ram(a6),a5
		moveq	#((v_sfx_track_ram_end-v_sfx_track_ram)/zTrackSz)-1,d0	; 3 FM + 3 PSG tracks (SFX)
; loc_71FF8:
.cleartrackplayloop:
		bclr	#7,zTrackPlaybackControl(a5) ; Clear 'track is playing' bit
		adda.w	#zTrackSz,a5
		dbf	d0,.cleartrackplayloop

		_clr.b	v_sndprio(a6)		; Clear priority
		movea.l	a6,a0
		lea	v_1up_ram_copy(a6),a1
		move.w	#((v_music_track_ram_end-v_startofvariables)/4)-1,d0	; Backup $220 bytes: all variables and music track data
; loc_72012:
.backupramloop:
		move.l	(a0)+,(a1)+
		dbf	d0,.backupramloop

		move.b	#$80,f_1up_playing(a6)
		_clr.b	v_sndprio(a6)		; Clear priority again (?)
		bra.s	.bgm_loadMusic
; ===========================================================================
; loc_72024:
.bgmnot1up:
		clr.b	f_1up_playing(a6)
		clr.b	v_fadein_counter(a6)
; loc_7202C:
.bgm_loadMusic:
		jsr	InitMusicPlayback(pc)
		movea.l	(Go_SpeedUpIndex).l,a4
		subi.b	#bgm__First,d7
		move.b	(a4,d7.w),v_speeduptempo(a6)
		movea.l	(Go_MusicIndex).l,a4
		lsl.w	#2,d7
		movea.l	(a4,d7.w),a4		; a4 now points to (uncompressed) song data
		moveq	#0,d0
		move.w	(a4),d0			; load voice pointer
		add.l	a4,d0			; It is a relative pointer
		move.l	d0,v_voice_ptr(a6)
		move.b	5(a4),d0		; load tempo
		move.b	d0,v_tempo_mod(a6)
		tst.b	f_speedup(a6)
		beq.s	.nospeedshoes
		move.b	v_speeduptempo(a6),d0
; loc_72068:
.nospeedshoes:
		move.b	d0,v_main_tempo(a6)
		move.b	d0,v_main_tempo_timeout(a6)
		moveq	#0,d1
		movea.l	a4,a3
		addq.w	#6,a4			; Point past header
		moveq	#0,d7
		move.b	2(a3),d7		; load number of FM+DAC tracks
		beq.w	.bgm_fmdone		; branch if zero
		subq.b	#1,d7
		move.b	#$C0,d1			; Default AMS+FMS+Panning
		move.b	4(a3),d4		; load tempo dividing timing
		moveq	#zTrackSz,d6
		move.b	#1,d5			; Note duration for first "note"
		lea	v_music_fmdac_tracks(a6),a1
		lea	FMDACInitBytes(pc),a2
; loc_72098:
.bmg_fmloadloop:
		bset	#7,zTrackPlaybackControl(a1)	; Initial playback control: set 'track playing' bit
		move.b	(a2)+,zTrackVoiceControl(a1)	; Voice control bits
		move.b	d4,zTrackTempoDivider(a1)
		move.b	d6,zTrackStackPointer(a1)	; set "gosub" (coord flag F8h) stack init value
		move.b	d1,zTrackAMSFMSPan(a1)		; Set AMS/FMS/Panning
		move.b	d5,zTrackDurationTimeout(a1)	; Set duration of first "note"
		moveq	#0,d0
		move.w	(a4)+,d0			; load DAC/FM pointer
		add.l	a3,d0				; Relative pointer
		move.l	d0,zTrackDataPointer(a1)	; Store track pointer
		move.w	(a4)+,zTrackTranspose(a1)	; load FM channel modifier
		adda.w	d6,a1
		dbf	d7,.bmg_fmloadloop
		cmpi.b	#7,2(a3)	; Are 7 FM tracks defined?
		bne.s	.silencefm6
		moveq	#$2B,d0		; DAC enable/disable register
		moveq	#0,d1		; Disable DAC
		jsr	WriteFMI(pc)
		bra.w	.bgm_fmdone
; ===========================================================================
; loc_720D8:
.silencefm6:
		moveq	#$28,d0		; Key on/off register
		moveq	#6,d1		; Note off on all operators of channel 6
		jsr	WriteFMI(pc)
		move.b	#$42,d0		; TL for operator 1 of FM6
		moveq	#$7F,d1		; Total silence
		jsr	WriteFMII(pc)
		move.b	#$4A,d0		; TL for operator 3 of FM6
		moveq	#$7F,d1		; Total silence
		jsr	WriteFMII(pc)
		move.b	#$46,d0		; TL for operator 2 of FM6
		moveq	#$7F,d1		; Total silence
		jsr	WriteFMII(pc)
		move.b	#$4E,d0		; TL for operator 4 of FM6
		moveq	#$7F,d1		; Total silence
		jsr	WriteFMII(pc)
		move.b	#$B6,d0		; AMS/FMS/panning of FM6
		move.b	#$C0,d1		; Stereo
		jsr	WriteFMII(pc)
; loc_72114:
.bgm_fmdone:
		moveq	#0,d7
		move.b	3(a3),d7	; Load number of PSG tracks
		beq.s	.bgm_psgdone	; branch if zero
		subq.b	#1,d7
		lea	v_music_psg_tracks(a6),a1
		lea	PSGInitBytes(pc),a2
; loc_72126:
.bgm_psgloadloop:
		bset	#7,zTrackPlaybackControl(a1)	; Initial playback control: set 'track playing' bit
		move.b	(a2)+,zTrackVoiceControl(a1)	; Voice control bits
		move.b	d4,zTrackTempoDivider(a1)
		move.b	d6,zTrackStackPointer(a1)	; set "gosub" (coord flag F8h) stack init value
		move.b	d5,zTrackDurationTimeout(a1)	; Set duration of first "note"
		moveq	#0,d0
		move.w	(a4)+,d0			; load PSG channel pointer
		add.l	a3,d0				; Relative pointer
		move.l	d0,zTrackDataPointer(a1)	; Store track pointer
		move.w	(a4)+,zTrackTranspose(a1)	; load PSG modifier
		move.b	(a4)+,d0			; load redundant byte
		move.b	(a4)+,zTrackVoiceIndex(a1)	; Initial PSG tone
		adda.w	d6,a1
		dbf	d7,.bgm_psgloadloop
; loc_72154:
.bgm_psgdone:
		lea	v_sfx_track_ram(a6),a1
		moveq	#((v_sfx_track_ram_end-v_sfx_track_ram)/zTrackSz)-1,d7	; 6 SFX tracks
; loc_7215A:
.sfxstoploop:
		tst.b	zTrackPlaybackControl(a1) ; Is SFX playing?
		bpl.w	.sfxnext		; Branch if not
		moveq	#0,d0
		move.b	zTrackVoiceControl(a1),d0 ; Get voice control bits
		bmi.s	.sfxpsgchannel		; Branch if this is a PSG channel
		subq.b	#2,d0			; SFX can't have FM1 or FM2
		lsl.b	#2,d0			; Convert to index
		bra.s	.gotchannelindex
; ===========================================================================
; loc_7216E:
.sfxpsgchannel:
		lsr.b	#3,d0		; Convert to index
; loc_72170:
.gotchannelindex:
		lea	SFX_BGMChannelRAM(pc),a0
		movea.l	(a0,d0.w),a0
		bset	#2,zTrackPlaybackControl(a0)	; Set 'SFX is overriding' bit
; loc_7217C:
.sfxnext:
		adda.w	d6,a1
		dbf	d7,.sfxstoploop

		tst.w	v_spcsfx_fm4_track+zTrackPlaybackControl(a6)	; Is special SFX being played?
		bpl.s	.checkspecialpsg				; Branch if not
		bset	#2,v_music_fm4_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
; loc_7218E:
.checkspecialpsg:
		tst.w	v_spcsfx_psg3_track+zTrackPlaybackControl(a6)	; Is special SFX being played?
		bpl.s	.sendfmnoteoff					; Branch if not
		bset	#2,v_music_psg3_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
; loc_7219A:
.sendfmnoteoff:
		lea	v_music_fm_tracks(a6),a5
		moveq	#((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d4	; 6 FM tracks
; loc_721A0:
.fmnoteoffloop:
		jsr	FMNoteOff(pc)
		adda.w	d6,a5
		dbf	d4,.fmnoteoffloop		; run all FM tracks
		moveq	#((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d4 ; 3 PSG tracks
; loc_721AC:
.psgnoteoffloop:
		jsr	PSGNoteOff(pc)
		adda.w	d6,a5
		dbf	d4,.psgnoteoffloop		; run all PSG tracks
; loc_721B6:
.locdblret:
		addq.w	#4,sp	; Tamper with return value to not return to caller
		rts	
; ===========================================================================
; byte_721BA:
FMDACInitBytes:	dc.b 6,	0, 1, 2, 4, 5, 6	; first byte is for DAC; then notice the 0, 1, 2 then 4, 5, 6; this is the gap between parts I and II for YM2612 port writes
		even
; byte_721C2:
PSGInitBytes:	dc.b $80, $A0, $C0	; Specifically, these configure writes to the PSG port for each channel
		even
; ===========================================================================
; ---------------------------------------------------------------------------
; Play normal sound effect
; ---------------------------------------------------------------------------
; Sound_A0toCF:
Sound_PlaySFX:
		tst.b	f_1up_playing(a6)	; Is 1-up playing?
		bne.w	.clear_sndprio		; Exit is it is
		tst.b	v_fadeout_counter(a6)	; Is music being faded out?
		bne.w	.clear_sndprio		; Exit if it is
		tst.b	f_fadein_flag(a6)	; Is music being faded in?
		bne.w	.clear_sndprio		; Exit if it is
		cmpi.b	#sfx_Ring,d7		; is ring sound	effect played?
		bne.s	.sfx_notRing		; if not, branch
		tst.b	v_ring_speaker(a6)	; Is the ring sound playing on right speaker?
		bne.s	.gotringspeaker		; Branch if not
		move.b	#sfx_RingLeft,d7	; play ring sound in left speaker
; loc_721EE:
.gotringspeaker:
		bchg	#0,v_ring_speaker(a6)	; change speaker
; Sound_notB5:
.sfx_notRing:
		cmpi.b	#sfx_Push,d7		; is "pushing" sound played?
		bne.s	.sfx_notPush		; if not, branch
		tst.b	f_push_playing(a6)	; Is pushing sound already playing?
		bne.w	.locret			; Return if not
		move.b	#$80,f_push_playing(a6)	; Mark it as playing
; Sound_notA7:
.sfx_notPush:
		movea.l	(Go_SoundIndex).l,a0
		subi.b	#sfx__First,d7		; Make it 0-based
		lsl.w	#2,d7			; Convert sfx ID into index
		movea.l	(a0,d7.w),a3		; SFX data pointer
		movea.l	a3,a1
		moveq	#0,d1
		move.w	(a1)+,d1		; Voice pointer
		add.l	a3,d1			; Relative pointer
		move.b	(a1)+,d5		; Dividing timing
		; DANGER! there is a missing 'moveq	#0,d7' here, without which SFXes whose
		; index entry is above $3F will cause a crash. This is actually the same way that
		; this bug is fixed in Ristar's driver.
		move.b	(a1)+,d7	; Number of tracks (FM + PSG)
		subq.b	#1,d7
		moveq	#zTrackSz,d6
; loc_72228:
.sfx_loadloop:
		moveq	#0,d3
		move.b	1(a1),d3	; Channel assignment bits
		move.b	d3,d4
		bmi.s	.sfxinitpsg	; Branch if PSG
		subq.w	#2,d3		; SFX can only have FM3, FM4 or FM5
		lsl.w	#2,d3
		lea	SFX_BGMChannelRAM(pc),a5
		movea.l	(a5,d3.w),a5
		bset	#2,zTrackPlaybackControl(a5) ; Mark music track as being overridden
		bra.s	.sfxoverridedone
; ===========================================================================
; loc_72244:
.sfxinitpsg:
		lsr.w	#3,d3
		lea	SFX_BGMChannelRAM(pc),a5
		movea.l	(a5,d3.w),a5
		bset	#2,zTrackPlaybackControl(a5) ; Mark music track as being overridden
		cmpi.b	#$C0,d4			; Is this PSG 3?
		bne.s	.sfxoverridedone	; Branch if not
		move.b	d4,d0
		ori.b	#$1F,d0			; Command to silence PSG 3
		move.b	d0,(psg_input).l
		bchg	#5,d0			; Command to silence noise channel
		move.b	d0,(psg_input).l
; loc_7226E:
.sfxoverridedone:
		movea.l	SFX_SFXChannelRAM(pc,d3.w),a5
		movea.l	a5,a2
		moveq	#(zTrackSz/4)-1,d0	; $30 bytes
; loc_72276:
.clearsfxtrackram:
		clr.l	(a2)+
		dbf	d0,.clearsfxtrackram

		move.w	(a1)+,zTrackPlaybackControl(a5)	; Initial playback control bits
		move.b	d5,zTrackTempoDivider(a5)	; Initial voice control bits
		moveq	#0,d0
		move.w	(a1)+,d0			; Track data pointer
		add.l	a3,d0				; Relative pointer
		move.l	d0,zTrackDataPointer(a5)	; Store track pointer
		move.w	(a1)+,zTrackTranspose(a5)	; load FM/PSG channel modifier
		move.b	#1,zTrackDurationTimeout(a5)	; Set duration of first "note"
		move.b	d6,zTrackStackPointer(a5)	; set "gosub" (coord flag F8h) stack init value
		tst.b	d4				; Is this a PSG channel?
		bmi.s	.sfxpsginitdone			; Branch if yes
		move.b	#$C0,zTrackAMSFMSPan(a5)	; AMS/FMS/Panning
		move.l	d1,zTrackVoicePtr(a5)		; Voice pointer
; loc_722A8:
.sfxpsginitdone:
		dbf	d7,.sfx_loadloop

		tst.b	v_sfx_fm4_track+zTrackPlaybackControl(a6)	; Is special SFX being played?
		bpl.s	.doneoverride					; Branch if not
		bset	#2,v_spcsfx_fm4_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
; loc_722B8:
.doneoverride:
		tst.b	v_sfx_psg3_track+zTrackPlaybackControl(a6)	; Is special SFX being played?
		bpl.s	.locret						; Branch if not
		bset	#2,v_spcsfx_psg3_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
; locret_722C4:
.locret:
		rts	
; ===========================================================================
; loc_722C6:
.clear_sndprio:
		_clr.b	v_sndprio(a6)	; Clear priority
		rts	
; ===========================================================================
; ---------------------------------------------------------------------------
; RAM addresses for FM and PSG channel variables used by the SFX
; ---------------------------------------------------------------------------
; dword_722CC: BGMChannelRAM:
SFX_BGMChannelRAM:
		dc.l (v_snddriver_ram+v_music_fm3_track)&$FFFFFF
		dc.l 0
		dc.l (v_snddriver_ram+v_music_fm4_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_music_fm5_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_music_psg1_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_music_psg2_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_music_psg3_track)&$FFFFFF	; Plain PSG3
		dc.l (v_snddriver_ram+v_music_psg3_track)&$FFFFFF	; Noise
; dword_722EC: SFXChannelRAM:
SFX_SFXChannelRAM:
		dc.l (v_snddriver_ram+v_sfx_fm3_track)&$FFFFFF
		dc.l 0
		dc.l (v_snddriver_ram+v_sfx_fm4_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_sfx_fm5_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_sfx_psg1_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_sfx_psg2_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_sfx_psg3_track)&$FFFFFF	; Plain PSG3
		dc.l (v_snddriver_ram+v_sfx_psg3_track)&$FFFFFF	; Noise
; ===========================================================================
; ---------------------------------------------------------------------------
; Play GHZ waterfall sound
; ---------------------------------------------------------------------------
; Sound_D0toDF:
Sound_PlaySpecial:
		tst.b	f_1up_playing(a6)	; Is 1-up playing?
		bne.w	.locret			; Return if so
		tst.b	v_fadeout_counter(a6)	; Is music being faded out?
		bne.w	.locret			; Exit if it is
		tst.b	f_fadein_flag(a6)	; Is music being faded in?
		bne.w	.locret			; Exit if it is
		movea.l	(Go_SpecSoundIndex).l,a0
		subi.b	#spec__First,d7		; Make it 0-based
		lsl.w	#2,d7
		movea.l	(a0,d7.w),a3
		movea.l	a3,a1
		moveq	#0,d0
		move.w	(a1)+,d0			; Voice pointer
		add.l	a3,d0				; Relative pointer
		move.l	d0,v_special_voice_ptr(a6)	; Store voice pointer
		move.b	(a1)+,d5			; Dividing timing
		; DANGER! there is a missing 'moveq	#0,d7' here, without which special SFXes whose
		; index entry is above $3F will cause a crash. This instance was not fixed in Ristar's driver.
		move.b	(a1)+,d7			; Number of tracks (FM + PSG)
		subq.b	#1,d7
		moveq	#zTrackSz,d6
; loc_72348:
.sfxloadloop:
		move.b	1(a1),d4					; Voice control bits
		bmi.s	.sfxoverridepsg					; Branch if PSG
		bset	#2,v_music_fm4_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
		lea	v_spcsfx_fm4_track(a6),a5
		bra.s	.sfxinitpsg
; ===========================================================================
; loc_7235A:
.sfxoverridepsg:
		bset	#2,v_music_psg3_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
		lea	v_spcsfx_psg3_track(a6),a5
; loc_72364:
.sfxinitpsg:
		movea.l	a5,a2
		moveq	#(zTrackSz/4)-1,d0	; $30 bytes
; loc_72368:
.clearsfxtrackram:
		clr.l	(a2)+
		dbf	d0,.clearsfxtrackram

		move.w	(a1)+,zTrackPlaybackControl(a5)	; Initial playback control bits & voice control bits 
		move.b	d5,zTrackTempoDivider(a5)
		moveq	#0,d0
		move.w	(a1)+,d0			; Track data pointer
		add.l	a3,d0				; Relative pointer
		move.l	d0,zTrackDataPointer(a5)	; Store track pointer
		move.w	(a1)+,zTrackTranspose(a5)	; load FM/PSG channel modifier
		move.b	#1,zTrackDurationTimeout(a5)	; Set duration of first "note"
		move.b	d6,zTrackStackPointer(a5)	; set "gosub" (coord flag F8h) stack init value
		tst.b	d4				; Is this a PSG channel?
		bmi.s	.sfxpsginitdone			; Branch if yes
		move.b	#$C0,zTrackAMSFMSPan(a5)	; AMS/FMS/Panning
; loc_72396:
.sfxpsginitdone:
		dbf	d7,.sfxloadloop

		tst.b	v_sfx_fm4_track+zTrackPlaybackControl(a6)	; Is track playing?
		bpl.s	.doneoverride					; Branch if not
		bset	#2,v_spcsfx_fm4_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
; loc_723A6:
.doneoverride:
		tst.b	v_sfx_psg3_track+zTrackPlaybackControl(a6)	; Is track playing?
		bpl.s	.locret						; Branch if not
		bset	#2,v_spcsfx_psg3_track+zTrackPlaybackControl(a6)	; Set 'SFX is overriding' bit
		ori.b	#$1F,d4						; Command to silence channel
		move.b	d4,(psg_input).l
		bchg	#5,d4			; Command to silence noise channel
		move.b	d4,(psg_input).l
; locret_723C6:
.locret:
		rts	
; End of function Sound_ChkValue

; ===========================================================================
; ---------------------------------------------------------------------------
; Unused RAM addresses for FM and PSG channel variables used by the Special SFX
; ---------------------------------------------------------------------------
; The first block would have been used for overriding the music tracks
; as they have a lower priority, just as they are in Sound_PlaySFX
; The third block would be used to set up the Special SFX
; The second block, however, is for the SFX tracks, which have a higher priority
; and would be checked for if they're currently playing
; If they are, then the third block would be used again, this time to mark
; the new tracks as 'currently playing'

; These were actually used in Moonwalker's driver (and other SMPS 68k Type 1a drivers)

; BGMFM4PSG3RAM:
;SpecSFX_BGMChannelRAM:
		dc.l (v_snddriver_ram+v_music_fm4_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_music_psg3_track)&$FFFFFF
; SFXFM4PSG3RAM:
;SpecSFX_SFXChannelRAM:
		dc.l (v_snddriver_ram+v_sfx_fm4_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_sfx_psg3_track)&$FFFFFF
; SpecialSFXFM4PSG3RAM:
;SpecSFX_SpecSFXChannelRAM:
		dc.l (v_snddriver_ram+v_spcsfx_fm4_track)&$FFFFFF
		dc.l (v_snddriver_ram+v_spcsfx_psg3_track)&$FFFFFF

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

; Snd_FadeOut1: Snd_FadeOutSFX: FadeOutSFX:
StopSFX:
		_clr.b	v_sndprio(a6)		; Clear priority
		lea	v_sfx_track_ram(a6),a5
		moveq	#((v_sfx_track_ram_end-v_sfx_track_ram)/zTrackSz)-1,d7	; 3 FM + 3 PSG tracks (SFX)
; loc_723EA:
.trackloop:
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.w	.nexttrack			; Branch if not
		bclr	#7,zTrackPlaybackControl(a5)	; Stop track
		moveq	#0,d3
		move.b	zTrackVoiceControl(a5),d3	; Get voice control bits
		bmi.s	.trackpsg			; Branch if PSG
		jsr	FMNoteOff(pc)
		cmpi.b	#4,d3						; Is this FM4?
		bne.s	.getfmpointer					; Branch if not
		tst.b	v_spcsfx_fm4_track+zTrackPlaybackControl(a6)	; Is special SFX playing?
		bpl.s	.getfmpointer					; Branch if not
		; DANGER! there is a missing 'movea.l	a5,a3' here, without which the
		; code is broken. It is dangerous to do a fade out when a GHZ waterfall
		; is playing its sound!
		lea	v_spcsfx_fm4_track(a6),a5
		movea.l	v_special_voice_ptr(a6),a1	; Get special voice pointer
		bra.s	.gotfmpointer
; ===========================================================================
; loc_72416:
.getfmpointer:
		subq.b	#2,d3		; SFX only has FM3 and up
		lsl.b	#2,d3
		lea	SFX_BGMChannelRAM(pc),a0
		movea.l	a5,a3
		movea.l	(a0,d3.w),a5
		movea.l	v_voice_ptr(a6),a1	; Get music voice pointer
; loc_72428:
.gotfmpointer:
		bclr	#2,zTrackPlaybackControl(a5)	; Clear 'SFX is overriding' bit
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		move.b	zTrackVoiceIndex(a5),d0		; Current voice
		jsr	SetVoice(pc)
		movea.l	a3,a5
		bra.s	.nexttrack
; ===========================================================================
; loc_7243C:
.trackpsg:
		jsr	PSGNoteOff(pc)
		lea	v_spcsfx_psg3_track(a6),a0
		cmpi.b	#$E0,d3			; Is this a noise channel:
		beq.s	.gotpsgpointer		; Branch if yes
		cmpi.b	#$C0,d3			; Is this PSG 3?
		beq.s	.gotpsgpointer		; Branch if yes
		lsr.b	#3,d3
		lea	SFX_BGMChannelRAM(pc),a0
		movea.l	(a0,d3.w),a0
; loc_7245A:
.gotpsgpointer:
		bclr	#2,zTrackPlaybackControl(a0)	; Clear 'SFX is overriding' bit
		bset	#1,zTrackPlaybackControl(a0)	; Set 'track at rest' bit
		cmpi.b	#$E0,zTrackVoiceControl(a0)	; Is this a noise channel?
		bne.s	.nexttrack			; Branch if not
		move.b	zTrackPSGNoise(a0),(psg_input).l ; Set noise type
; loc_72472:
.nexttrack:
		adda.w	#zTrackSz,a5
		dbf	d7,.trackloop

		rts	
; End of function StopSFX


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

; Snd_FadeOut2: FadeOutSFX2: FadeOutSpecialSFX:
StopSpecialSFX:
		lea	v_spcsfx_fm4_track(a6),a5
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.s	.fadedfm			; Branch if not
		bclr	#7,zTrackPlaybackControl(a5)	; Stop track
		btst	#2,zTrackPlaybackControl(a5)	; Is SFX overriding?
		bne.s	.fadedfm			; Branch if not
		jsr	SendFMNoteOff(pc)
		lea	v_music_fm4_track(a6),a5
		bclr	#2,zTrackPlaybackControl(a5)	; Clear 'SFX is overriding' bit
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.s	.fadedfm		; Branch if not
		movea.l	v_voice_ptr(a6),a1	; Voice pointer
		move.b	zTrackVoiceIndex(a5),d0	; Current voice
		jsr	SetVoice(pc)
; loc_724AE:
.fadedfm:
		lea	v_spcsfx_psg3_track(a6),a5
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.s	.fadedpsg			; Branch if not
		bclr	#7,zTrackPlaybackControl(a5)	; Stop track
		btst	#2,zTrackPlaybackControl(a5)	; Is SFX overriding?
		bne.s	.fadedpsg			; Return if not
		jsr	SendPSGNoteOff(pc)
		lea	v_music_psg3_track(a6),a5
		bclr	#2,zTrackPlaybackControl(a5)	; Clear 'SFX is overriding' bit
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.s	.fadedpsg			; Return if not
		cmpi.b	#$E0,zTrackVoiceControl(a5)	; Is this a noise channel?
		bne.s	.fadedpsg			; Return if not
		move.b	zTrackPSGNoise(a5),(psg_input).l ; Set noise type
; locret_724E4:
.fadedpsg:
		rts	
; End of function StopSpecialSFX

; ===========================================================================
; ---------------------------------------------------------------------------
; Fade out music
; ---------------------------------------------------------------------------
; Sound_E0:
FadeOutMusic:
		jsr	StopSFX(pc)
		jsr	StopSpecialSFX(pc)
		move.b	#3,v_fadeout_delay(a6)			; Set fadeout delay to 3
		move.b	#$28,v_fadeout_counter(a6)		; Set fadeout counter
		clr.b	v_music_dac_track+zTrackPlaybackControl(a6)	; Stop DAC track
		clr.b	f_speedup(a6)				; Disable speed shoes tempo
		rts	

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

; sub_72504:
DoFadeOut:
		move.b	v_fadeout_delay(a6),d0	; Has fadeout delay expired?
		beq.s	.continuefade		; Branch if yes
		subq.b	#1,v_fadeout_delay(a6)
		rts	
; ===========================================================================
; loc_72510:
.continuefade:
		subq.b	#1,v_fadeout_counter(a6)	; Update fade counter
		beq.w	StopSoundAndMusic		; Branch if fade is done
		move.b	#3,v_fadeout_delay(a6)		; Reset fade delay
		lea	v_music_fm_tracks(a6),a5
		moveq	#((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7	; 6 FM tracks
; loc_72524:
.fmloop:
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.s	.nextfm				; Branch if not
		addq.b	#1,zTrackVolume(a5)		; Increase volume attenuation
		bpl.s	.sendfmtl			; Branch if still positive
		bclr	#7,zTrackPlaybackControl(a5)	; Stop track
		bra.s	.nextfm
; ===========================================================================
; loc_72534:
.sendfmtl:
		jsr	SendVoiceTL(pc)
; loc_72538:
.nextfm:
		adda.w	#zTrackSz,a5
		dbf	d7,.fmloop

		moveq	#((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7	; 3 PSG tracks
; loc_72542:
.psgloop:
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.s	.nextpsg			; branch if not
		addq.b	#1,zTrackVolume(a5)		; Increase volume attenuation
		cmpi.b	#$10,zTrackVolume(a5)		; Is it greater than $F?
		blo.s	.sendpsgvol			; Branch if not
		bclr	#7,zTrackPlaybackControl(a5)	; Stop track
		bra.s	.nextpsg
; ===========================================================================
; loc_72558:
.sendpsgvol:
		move.b	zTrackVolume(a5),d6	; Store new volume attenuation
		jsr	SetPSGVolume(pc)
; loc_72560:
.nextpsg:
		adda.w	#zTrackSz,a5
		dbf	d7,.psgloop

		rts	
; End of function DoFadeOut


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

; sub_7256A:
FMSilenceAll:
		moveq	#2,d3		; 3 FM channels for each YM2612 parts
		moveq	#$28,d0		; FM key on/off register
; loc_7256E:
.noteoffloop:
		move.b	d3,d1
		jsr	WriteFMI(pc)
		addq.b	#4,d1		; Move to YM2612 part 1
		jsr	WriteFMI(pc)
		dbf	d3,.noteoffloop

		moveq	#$40,d0		; Set TL on FM channels...
		moveq	#$7F,d1		; ... to total attenuation...
		moveq	#2,d4		; ... for all 3 channels...
; loc_72584:
.channelloop:
		moveq	#3,d3		; ... for all operators on each channel...
; loc_72586:
.channeltlloop:
		jsr	WriteFMI(pc)	; ... for part 0...
		jsr	WriteFMII(pc)	; ... and part 1.
		addq.w	#4,d0		; Next TL operator
		dbf	d3,.channeltlloop

		subi.b	#$F,d0		; Move to TL operator 1 of next channel
		dbf	d4,.channelloop

		rts	
; End of function FMSilenceAll

; ===========================================================================
; ---------------------------------------------------------------------------
; Stop music
; ---------------------------------------------------------------------------
; Sound_E4:
StopSoundAndMusic:
		moveq	#$2B,d0		; Enable/disable DAC
		move.b	#$80,d1		; Enable DAC
		jsr	WriteFMI(pc)
		moveq	#$27,d0		; Timers, FM3/FM6 mode
		moveq	#0,d1		; FM3/FM6 normal mode, disable timers
		jsr	WriteFMI(pc)
		movea.l	a6,a0
		; DANGER! This should be clearing all variables and track data, but misses the last $10 bytes of v_spcsfx_psg3_track.
		; Remove the '-$10' to fix this.
		move.w	#((v_spcsfx_track_ram_end-v_startofvariables-$10)/4)-1,d0	; Clear $390 bytes: all variables and most track data
; loc_725B6:
.clearramloop:
		clr.l	(a0)+
		dbf	d0,.clearramloop

		move.b	#$80,v_playsnd0(a6)	; set music to $80 (silence)
		jsr	FMSilenceAll(pc)
		bra.w	PSGSilenceAll

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

; sub_725CA:
InitMusicPlayback:
		movea.l	a6,a0
		; Save several values
		_move.b	v_sndprio(a6),d1
		move.b	f_1up_playing(a6),d2
		move.b	f_speedup(a6),d3
		move.b	v_fadein_counter(a6),d4
		move.w	v_playsnd1(a6),d5
		move.w	#((v_music_track_ram_end-v_startofvariables)/4)-1,d0	; Clear $220 bytes: all variables and music track data
; loc_725E4:
.clearramloop:
		clr.l	(a0)+
		dbf	d0,.clearramloop

		; Restore the values saved above
		_move.b	d1,v_sndprio(a6)
		move.b	d2,f_1up_playing(a6)
		move.b	d3,f_speedup(a6)
		move.b	d4,v_fadein_counter(a6)
		move.w	d5,v_playsnd1(a6)
		move.b	#$80,v_playsnd0(a6)	; set music to $80 (silence)
		; DANGER! This silences ALL channels, even the ones being used
		; by SFX, and not music! @sendfmnoteoff does this already, and
		; doesn't affect SFX channels, either.
		; This should be replaced with an 'rts'.
		jsr	FMSilenceAll(pc)
		bra.w	PSGSilenceAll
		; DANGER! InitMusicPlayback, and Sound_PlayBGM for that matter,
		; don't do a very good job of setting up the music tracks.
		; Tracks that aren't defined in a music file's header don't have
		; their channels defined, meaning @sendfmnoteoff won't silence
		; hardware properly. In combination with removing the above
		; calls to FMSilenceAll/PSGSilenceAll, this will cause hanging
		; notes.
		; To fix this, I suggest using this code, instead of an 'rts':
		;lea	v_music_track_ram+zTrackVoiceControl(a6),a1
		;lea	FMDACInitBytes(pc),a2
		;moveq	#((v_music_fmdac_tracks_end-v_music_fmdac_tracks)/zTrackSz)-1,d1		; 7 DAC/FM tracks
		;bsr.s	@writeloop
		;lea	PSGInitBytes(pc),a2
		;moveq	#((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d1	; 3 PSG tracks

;@writeloop:
		;move.b	(a2)+,(a1)		; Write track's channel byte
		;lea	zTrackSz(a1),a1		; Next track
		;dbf	d1,@writeloop		; Loop for all DAC/FM/PSG tracks

		;rts
	
; End of function InitMusicPlayback


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

; sub_7260C:
TempoWait:
		move.b	v_main_tempo(a6),v_main_tempo_timeout(a6)	; Reset main tempo timeout
		lea	v_music_track_ram+zTrackDurationTimeout(a6),a0	; note timeout
		moveq	#zTrackSz,d0
		moveq	#((v_music_track_ram_end-v_music_track_ram)/zTrackSz)-1,d1		; 1 DAC + 6 FM + 3 PSG tracks
; loc_7261A:
.tempoloop:
		addq.b	#1,(a0)	; Delay note by 1 frame
		adda.w	d0,a0	; Advance to next track
		dbf	d1,.tempoloop

		rts	
; End of function TempoWait

; ===========================================================================
; ---------------------------------------------------------------------------
; Speed	up music
; ---------------------------------------------------------------------------
; Sound_E2:
SpeedUpMusic:
		tst.b	f_1up_playing(a6)
		bne.s	.speedup_1up
		move.b	v_speeduptempo(a6),v_main_tempo(a6)
		move.b	v_speeduptempo(a6),v_main_tempo_timeout(a6)
		move.b	#$80,f_speedup(a6)
		rts	
; ===========================================================================
; loc_7263E:
.speedup_1up:
		move.b	v_1up_ram_copy+v_speeduptempo(a6),v_1up_ram_copy+v_main_tempo(a6)
		move.b	v_1up_ram_copy+v_speeduptempo(a6),v_1up_ram_copy+v_main_tempo_timeout(a6)
		move.b	#$80,v_1up_ram_copy+f_speedup(a6)
		rts	
; ===========================================================================
; ---------------------------------------------------------------------------
; Change music back to normal speed
; ---------------------------------------------------------------------------
; Sound_E3:
SlowDownMusic:
		tst.b	f_1up_playing(a6)
		bne.s	.slowdown_1up
		move.b	v_tempo_mod(a6),v_main_tempo(a6)
		move.b	v_tempo_mod(a6),v_main_tempo_timeout(a6)
		clr.b	f_speedup(a6)
		rts	
; ===========================================================================
; loc_7266A:
.slowdown_1up:
		move.b	v_1up_ram_copy+v_tempo_mod(a6),v_1up_ram_copy+v_main_tempo(a6)
		move.b	v_1up_ram_copy+v_tempo_mod(a6),v_1up_ram_copy+v_main_tempo_timeout(a6)
		clr.b	v_1up_ram_copy+f_speedup(a6)
		rts	

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

; sub_7267C:
DoFadeIn:
		tst.b	v_fadein_delay(a6)	; Has fadein delay expired?
		beq.s	.continuefade		; Branch if yes
		subq.b	#1,v_fadein_delay(a6)
		rts	
; ===========================================================================
; loc_72688:
.continuefade:
		tst.b	v_fadein_counter(a6)	; Is fade done?
		beq.s	.fadedone		; Branch if yes
		subq.b	#1,v_fadein_counter(a6)	; Update fade counter
		move.b	#2,v_fadein_delay(a6)	; Reset fade delay
		lea	v_music_fm_tracks(a6),a5
		moveq	#((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7	; 6 FM tracks
; loc_7269E:
.fmloop:
		tst.b	zTrackPlaybackControl(a5) ; Is track playing?
		bpl.s	.nextfm			; Branch if not
		subq.b	#1,zTrackVolume(a5)	; Reduce volume attenuation
		jsr	SendVoiceTL(pc)
; loc_726AA:
.nextfm:
		adda.w	#zTrackSz,a5
		dbf	d7,.fmloop
		moveq	#((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7		; 3 PSG tracks
; loc_726B4:
.psgloop:
		tst.b	zTrackPlaybackControl(a5) ; Is track playing?
		bpl.s	.nextpsg		; Branch if not
		subq.b	#1,zTrackVolume(a5)	; Reduce volume attenuation
		move.b	zTrackVolume(a5),d6	; Get value
		cmpi.b	#$10,d6			; Is it is < $10?
		blo.s	.sendpsgvol		; Branch if yes
		moveq	#$F,d6			; Limit to $F (maximum attenuation)
; loc_726C8:
.sendpsgvol:
		jsr	SetPSGVolume(pc)
; loc_726CC:
.nextpsg:
		adda.w	#zTrackSz,a5
		dbf	d7,.psgloop
		rts	
; ===========================================================================
; loc_726D6:
.fadedone:
		bclr	#2,v_music_dac_track+zTrackPlaybackControl(a6)	; Clear 'SFX overriding' bit
		clr.b	f_fadein_flag(a6)				; Stop fadein
		rts	
; End of function DoFadeIn

; ===========================================================================
; loc_726E2:
FMNoteOn:
		btst	#1,zTrackPlaybackControl(a5)	; Is track resting?
		bne.s	.locret				; Return if so
		btst	#2,zTrackPlaybackControl(a5)	; Is track being overridden?
		bne.s	.locret				; Return if so
		moveq	#$28,d0				; Note on/off register
		move.b	zTrackVoiceControl(a5),d1	; Get channel bits
		ori.b	#$F0,d1				; Note on on all operators
		bra.w	WriteFMI
; ===========================================================================
; locret_726FC:
.locret:
		rts	

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

; sub_726FE:
FMNoteOff:
		btst	#4,zTrackPlaybackControl(a5)	; Is 'do not attack next note' set?
		bne.s	locret_72714			; Return if yes
		btst	#2,zTrackPlaybackControl(a5)	; Is SFX overriding?
		bne.s	locret_72714			; Return if yes
; loc_7270A:
SendFMNoteOff:
		moveq	#$28,d0				; Note on/off register
		move.b	zTrackVoiceControl(a5),d1	; Note off to this channel
		bra.w	WriteFMI
; ===========================================================================

locret_72714:
		rts	
; End of function FMNoteOff

; ===========================================================================
; loc_72716:
WriteFMIorIIMain:
		btst	#2,zTrackPlaybackControl(a5)	; Is track being overriden by sfx?
		bne.s	.locret				; Return if yes
		bra.w	WriteFMIorII
; ===========================================================================
; locret_72720:
.locret:
		rts	

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

; sub_72722:
WriteFMIorII:
		btst	#2,zTrackVoiceControl(a5)	; Is this bound for part I or II?
		bne.s	WriteFMIIPart			; Branch if for part II
		add.b	zTrackVoiceControl(a5),d0	; Add in voice control bits
; End of function WriteFMIorII


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

; sub_7272E:
WriteFMI:
		move.b	(ym2612_a0).l,d2
		btst	#7,d2		; Is FM busy?
		bne.s	WriteFMI	; Loop if so
		move.b	d0,(ym2612_a0).l
		nop	
		nop	
		nop	
; loc_72746:
.waitloop:
		move.b	(ym2612_a0).l,d2
		btst	#7,d2		; Is FM busy?
		bne.s	.waitloop	; Loop if so

		move.b	d1,(ym2612_d0).l
		rts	
; End of function WriteFMI

; ===========================================================================
; loc_7275A:
WriteFMIIPart:
		move.b	zTrackVoiceControl(a5),d2 ; Get voice control bits
		bclr	#2,d2			; Clear chip toggle
		add.b	d2,d0			; Add in to destination register

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

; sub_72764:
WriteFMII:
		move.b	(ym2612_a0).l,d2
		btst	#7,d2		; Is FM busy?
		bne.s	WriteFMII	; Loop if so
		move.b	d0,(ym2612_a1).l
		nop	
		nop	
		nop	
; loc_7277C:
.waitloop:
		move.b	(ym2612_a0).l,d2
		btst	#7,d2		; Is FM busy?
		bne.s	.waitloop	; Loop if so

		move.b	d1,(ym2612_d1).l
		rts	
; End of function WriteFMII

; ===========================================================================
; ---------------------------------------------------------------------------
; FM Note Values: b-0 to a#8
; ---------------------------------------------------------------------------
; word_72790:
FM_Notes:
	dc.w $025E,$0284,$02AB,$02D3,$02FE,$032D,$035C,$038F,$03C5,$03FF,$043C,$047C
	dc.w $0A5E,$0A84,$0AAB,$0AD3,$0AFE,$0B2D,$0B5C,$0B8F,$0BC5,$0BFF,$0C3C,$0C7C
	dc.w $125E,$1284,$12AB,$12D3,$12FE,$132D,$135C,$138F,$13C5,$13FF,$143C,$147C
	dc.w $1A5E,$1A84,$1AAB,$1AD3,$1AFE,$1B2D,$1B5C,$1B8F,$1BC5,$1BFF,$1C3C,$1C7C
	dc.w $225E,$2284,$22AB,$22D3,$22FE,$232D,$235C,$238F,$23C5,$23FF,$243C,$247C
	dc.w $2A5E,$2A84,$2AAB,$2AD3,$2AFE,$2B2D,$2B5C,$2B8F,$2BC5,$2BFF,$2C3C,$2C7C
	dc.w $325E,$3284,$32AB,$32D3,$32FE,$332D,$335C,$338F,$33C5,$33FF,$343C,$347C
	dc.w $3A5E,$3A84,$3AAB,$3AD3,$3AFE,$3B2D,$3B5C,$3B8F,$3BC5,$3BFF,$3C3C,$3C7C

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

; sub_72850:
PSGUpdateTrack:
		subq.b	#1,zTrackDurationTimeout(a5)	; Update note timeout
		bne.s	.notegoing
		bclr	#4,zTrackPlaybackControl(a5)	; Clear 'do not attack note' bit
		jsr	PSGDoNext(pc)
		jsr	PSGDoNoteOn(pc)
		bra.w	PSGDoVolFX
; ===========================================================================
; loc_72866:
.notegoing:
		jsr	NoteFillUpdate(pc)
		jsr	PSGUpdateVolFX(pc)
		jsr	DoModulation(pc)
		jsr	PSGUpdateFreq(pc)	; It would be better if this were a jmp and the rts was removed
		rts
; End of function PSGUpdateTrack


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

; sub_72878:
PSGDoNext:
		bclr	#1,zTrackPlaybackControl(a5)	; Clear 'track at rest' bit
		movea.l	zTrackDataPointer(a5),a4	; Get track data pointer
; loc_72880:
.noteloop:
		moveq	#0,d5
		move.b	(a4)+,d5	; Get byte from track
		cmpi.b	#$E0,d5		; Is it a coord. flag?
		blo.s	.gotnote	; Branch if not
		jsr	CoordFlag(pc)
		bra.s	.noteloop
; ===========================================================================
; loc_72890:
.gotnote:
		tst.b	d5		; Is it a note?
		bpl.s	.gotduration	; Branch if not
		jsr	PSGSetFreq(pc)
		move.b	(a4)+,d5	; Get another byte
		tst.b	d5		; Is it a duration?
		bpl.s	.gotduration	; Branch if yes
		subq.w	#1,a4		; Put byte back
		bra.w	FinishTrackUpdate
; ===========================================================================
; loc_728A4:
.gotduration:
		jsr	SetDuration(pc)
		bra.w	FinishTrackUpdate
; End of function PSGDoNext


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

; sub_728AC:
PSGSetFreq:
		subi.b	#$81,d5		; Convert to 0-based index
		blo.s	.restpsg	; If $80, put track at rest
		add.b	zTrackTranspose(a5),d5 ; Add in channel transposition
		andi.w	#$7F,d5		; Clear high byte and sign bit
		lsl.w	#1,d5
		lea	PSGFrequencies(pc),a0
		move.w	(a0,d5.w),zTrackFreq(a5)	; Set new frequency
		bra.w	FinishTrackUpdate
; ===========================================================================
; loc_728CA:
.restpsg:
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		move.w	#-1,zTrackFreq(a5)		; Invalidate note frequency
		jsr	FinishTrackUpdate(pc)
		bra.w	PSGNoteOff
; End of function PSGSetFreq


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

; sub_728DC:
PSGDoNoteOn:
		move.w	zTrackFreq(a5),d6	; Get note frequency
		bmi.s	PSGSetRest		; If invalid, branch
; End of function PSGDoNoteOn


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

; sub_728E2:
PSGUpdateFreq:
		move.b	zTrackDetune(a5),d0	; Get detune value
		ext.w	d0
		add.w	d0,d6				; Add to frequency
		btst	#2,zTrackPlaybackControl(a5)	; Is track being overridden?
		bne.s	.locret				; Return if yes
		btst	#1,zTrackPlaybackControl(a5)	; Is track at rest?
		bne.s	.locret				; Return if yes
		move.b	zTrackVoiceControl(a5),d0 ; Get channel bits
		cmpi.b	#$E0,d0		; Is it a noise channel?
		bne.s	.notnoise	; Branch if not
		move.b	#$C0,d0		; Use PSG 3 channel bits
; loc_72904:
.notnoise:
		move.w	d6,d1
		andi.b	#$F,d1		; Low nibble of frequency
		or.b	d1,d0		; Latch tone data to channel
		lsr.w	#4,d6		; Get upper 6 bits of frequency
		andi.b	#$3F,d6		; Send to latched channel
		move.b	d0,(psg_input).l
		move.b	d6,(psg_input).l
; locret_7291E:
.locret:
		rts	
; End of function PSGUpdateFreq

; ===========================================================================
; loc_72920:
PSGSetRest:
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		rts	

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

; sub_72926:
PSGUpdateVolFX:
		tst.b	zTrackVoiceIndex(a5)	; Test PSG tone
		beq.w	locret_7298A		; Return if it is zero
; loc_7292E:
PSGDoVolFX:	; This can actually be made a bit more efficient, see the comments for more
		move.b	zTrackVolume(a5),d6	; Get volume
		moveq	#0,d0
		move.b	zTrackVoiceIndex(a5),d0	; Get PSG tone
		beq.s	SetPSGVolume
		movea.l	(Go_PSGIndex).l,a0
		subq.w	#1,d0
		lsl.w	#2,d0
		movea.l	(a0,d0.w),a0
		move.b	zTrackVolFlutter(a5),d0	; Get flutter index		; move.b	zTrackVolFlutter(a5),d0
		move.b	(a0,d0.w),d0		; Flutter value			; addq.b	#1,zTrackVolFlutter(a5)
		addq.b	#1,zTrackVolFlutter(a5)	; Increment flutter index	; move.b	(a0,d0.w),d0
		btst	#7,d0			; Is flutter value negative?	; <-- makes this line redundant
		beq.s	.gotflutter		; Branch if not			; but you gotta make this one a bpl
		cmpi.b	#$80,d0			; Is it the terminator?		; Since this is the only check, you can take the optimisation a step further:
		beq.s	FlutterDone		; If so, branch			; Change the previous beq (bpl) to a bmi and make it branch to FlutterDone to make these last two lines redundant
; loc_72960:
.gotflutter:
		add.w	d0,d6		; Add flutter to volume
		cmpi.b	#$10,d6		; Is volume $10 or higher?
		blo.s	SetPSGVolume	; Branch if not
		moveq	#$F,d6		; Limit to silence and fall through
; End of function PSGUpdateVolFX


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

; sub_7296A:
SetPSGVolume:
		btst	#1,zTrackPlaybackControl(a5)	; Is track at rest?
		bne.s	locret_7298A			; Return if so
		btst	#2,zTrackPlaybackControl(a5)	; Is SFX overriding?
		bne.s	locret_7298A			; Return if so
		btst	#4,zTrackPlaybackControl(a5)	; Is track set to not attack next note?
		bne.s	PSGCheckNoteFill		; Branch if yes
; loc_7297C:
PSGSendVolume:
		or.b	zTrackVoiceControl(a5),d6 ; Add in track selector bits
		addi.b	#$10,d6			; Mark it as a volume command
		move.b	d6,(psg_input).l

locret_7298A:
		rts	
; ===========================================================================
; loc_7298C:
PSGCheckNoteFill:
		tst.b	zTrackNoteFillMaster(a5)	; Is note fill on?
		beq.s	PSGSendVolume			; Branch if not
		tst.b	zTrackNoteFillTimeout(a5)	; Has note fill timeout expired?
		bne.s	PSGSendVolume			; Branch if not
		rts	
; End of function SetPSGVolume

; ===========================================================================
; loc_7299A:
FlutterDone:
		subq.b	#1,zTrackVolFlutter(a5)	; Decrement flutter index
		rts	

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

; sub_729A0:
PSGNoteOff:
		btst	#2,zTrackPlaybackControl(a5)	; Is SFX overriding?
		bne.s	locret_729B4			; Return if so
; loc_729A6:
SendPSGNoteOff:
		move.b	zTrackVoiceControl(a5),d0	; PSG channel to change
		ori.b	#$1F,d0				; Maximum volume attenuation
		move.b	d0,(psg_input).l
		; DANGER! If InitMusicPlayback doesn't silence all channels, there's the
		; risk of music accidentally playing noise because it can't detect if
		; the PSG4/noise channel needs muting on track initialisation.
		; S&K's driver fixes it by doing this:
		;cmpi.b	#$DF,d0				; Are stopping PSG3?
		;bne.s	locret_729B4
		;move.b	#$FF,(psg_input).l		; If so, stop noise channel while we're at it

locret_729B4:
		rts	
; End of function PSGNoteOff


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

; sub_729B6:
PSGSilenceAll:
		lea	(psg_input).l,a0
		move.b	#$9F,(a0)	; Silence PSG 1
		move.b	#$BF,(a0)	; Silence PSG 2
		move.b	#$DF,(a0)	; Silence PSG 3
		move.b	#$FF,(a0)	; Silence noise channel
		rts	
; End of function PSGSilenceAll

; ===========================================================================
; word_729CE:
PSGFrequencies:
		dc.w $356, $326, $2F9, $2CE, $2A5, $280, $25C, $23A
		dc.w $21A, $1FB, $1DF, $1C4, $1AB, $193, $17D, $167
		dc.w $153, $140, $12E, $11D, $10D,  $FE,  $EF,  $E2
		dc.w  $D6,  $C9,  $BE,  $B4,  $A9,  $A0,  $97,  $8F
		dc.w  $87,  $7F,  $78,  $71,  $6B,  $65,  $5F,  $5A
		dc.w  $55,  $50,  $4B,  $47,  $43,  $40,  $3C,  $39
		dc.w  $36,  $33,  $30,  $2D,  $2B,  $28,  $26,  $24
		dc.w  $22,  $20,  $1F,  $1D,  $1B,  $1A,  $18,  $17
		dc.w  $16,  $15,  $13,  $12,  $11,    0

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

; sub_72A5A:
CoordFlag:
		subi.w	#$E0,d5
		lsl.w	#2,d5
		jmp	coordflagLookup(pc,d5.w)
; End of function CoordFlag

; ===========================================================================
; loc_72A64:
coordflagLookup:
		bra.w	cfPanningAMSFMS		; $E0
; ===========================================================================
		bra.w	cfDetune		; $E1
; ===========================================================================
		bra.w	cfSetCommunication	; $E2
; ===========================================================================
		bra.w	cfJumpReturn		; $E3
; ===========================================================================
		bra.w	cfFadeInToPrevious	; $E4
; ===========================================================================
		bra.w	cfSetTempoDivider	; $E5
; ===========================================================================
		bra.w	cfChangeFMVolume	; $E6
; ===========================================================================
		bra.w	cfPreventAttack		; $E7
; ===========================================================================
		bra.w	cfNoteFill		; $E8
; ===========================================================================
		bra.w	cfChangeTransposition	; $E9
; ===========================================================================
		bra.w	cfSetTempo		; $EA
; ===========================================================================
		bra.w	cfSetTempoMod		; $EB
; ===========================================================================
		bra.w	cfChangePSGVolume	; $EC
; ===========================================================================
		bra.w	cfClearPush		; $ED
; ===========================================================================
		bra.w	cfStopSpecialFM4	; $EE
; ===========================================================================
		bra.w	cfSetVoice		; $EF
; ===========================================================================
		bra.w	cfModulation		; $F0
; ===========================================================================
		bra.w	cfEnableModulation	; $F1
; ===========================================================================
		bra.w	cfStopTrack		; $F2
; ===========================================================================
		bra.w	cfSetPSGNoise		; $F3
; ===========================================================================
		bra.w	cfDisableModulation	; $F4
; ===========================================================================
		bra.w	cfSetPSGTone		; $F5
; ===========================================================================
		bra.w	cfJumpTo		; $F6
; ===========================================================================
		bra.w	cfRepeatAtPos		; $F7
; ===========================================================================
		bra.w	cfJumpToGosub		; $F8
; ===========================================================================
		bra.w	cfOpF9			; $F9
; ===========================================================================
; loc_72ACC:
cfPanningAMSFMS:
		move.b	(a4)+,d1		; New AMS/FMS/panning value
		tst.b	zTrackVoiceControl(a5)	; Is this a PSG track?
		bmi.s	locret_72AEA		; Return if yes
		move.b	zTrackAMSFMSPan(a5),d0	; Get current AMS/FMS/panning
		andi.b	#$37,d0			; Retain bits 0-2, 3-4 if set
		or.b	d0,d1			; Mask in new value
		move.b	d1,zTrackAMSFMSPan(a5)	; Store value
		move.b	#$B4,d0			; Command to set AMS/FMS/panning
		bra.w	WriteFMIorIIMain
; ===========================================================================

locret_72AEA:
		rts	
; ===========================================================================
; loc_72AEC: cfAlterNotes:
cfDetune:
		move.b	(a4)+,zTrackDetune(a5)	; Set detune value
		rts	
; ===========================================================================
; loc_72AF2: cfUnknown1:
cfSetCommunication:
		move.b	(a4)+,v_communication_byte(a6)	; Set otherwise unused communication byte to parameter
		rts	
; ===========================================================================
; loc_72AF8:
cfJumpReturn:
		moveq	#0,d0
		move.b	zTrackStackPointer(a5),d0 ; Track stack pointer
		movea.l	(a5,d0.w),a4		; Set track return address
		move.l	#0,(a5,d0.w)		; Set 'popped' value to zero
		addq.w	#2,a4			; Skip jump target address from gosub flag
		addq.b	#4,d0			; Actually 'pop' value
		move.b	d0,zTrackStackPointer(a5) ; Set new stack pointer
		rts	
; ===========================================================================
; loc_72B14:
cfFadeInToPrevious:
		movea.l	a6,a0
		lea	v_1up_ram_copy(a6),a1
		move.w	#((v_music_track_ram_end-v_startofvariables)/4)-1,d0	; $220 bytes to restore: all variables and music track data
; loc_72B1E:
.restoreramloop:
		move.l	(a1)+,(a0)+
		dbf	d0,.restoreramloop

		bset	#2,v_music_dac_track+zTrackPlaybackControl(a6)	; Set 'SFX overriding' bit
		movea.l	a5,a3
		move.b	#$28,d6
		sub.b	v_fadein_counter(a6),d6			; If fade already in progress, this adjusts track volume accordingly
		moveq	#((v_music_fm_tracks_end-v_music_fm_tracks)/zTrackSz)-1,d7	; 6 FM tracks
		lea	v_music_fm_tracks(a6),a5
; loc_72B3A:
.fmloop:
		btst	#7,zTrackPlaybackControl(a5)	; Is track playing?
		beq.s	.nextfm				; Branch if not
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		add.b	d6,zTrackVolume(a5)		; Apply current volume fade-in
		btst	#2,zTrackPlaybackControl(a5)	; Is SFX overriding?
		bne.s	.nextfm				; Branch if yes
		moveq	#0,d0
		move.b	zTrackVoiceIndex(a5),d0	; Get voice
		movea.l	v_voice_ptr(a6),a1	; Voice pointer
		jsr	SetVoice(pc)
; loc_72B5C:
.nextfm:
		adda.w	#zTrackSz,a5
		dbf	d7,.fmloop

		moveq	#((v_music_psg_tracks_end-v_music_psg_tracks)/zTrackSz)-1,d7	; 3 PSG tracks
; loc_72B66:
.psgloop:
		btst	#7,zTrackPlaybackControl(a5)	; Is track playing?
		beq.s	.nextpsg			; Branch if not
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		jsr	PSGNoteOff(pc)
		add.b	d6,zTrackVolume(a5)	; Apply current volume fade-in
; loc_72B78:
.nextpsg:
		adda.w	#zTrackSz,a5
		dbf	d7,.psgloop
		
		movea.l	a3,a5
		move.b	#$80,f_fadein_flag(a6)		; Trigger fade-in
		move.b	#$28,v_fadein_counter(a6)	; Fade-in delay
		clr.b	f_1up_playing(a6)
		startZ80
		addq.w	#8,sp		; Tamper return value so we don't return to caller
		rts	
; ===========================================================================
; loc_72B9E:
cfSetTempoDivider:
		move.b	(a4)+,zTrackTempoDivider(a5)	; Set tempo divider on current track
		rts	
; ===========================================================================
; loc_72BA4: cfSetVolume:
cfChangeFMVolume:
		move.b	(a4)+,d0		; Get parameter
		add.b	d0,zTrackVolume(a5)	; Add to current volume
		bra.w	SendVoiceTL
; ===========================================================================
; loc_72BAE:
cfPreventAttack:
		bset	#4,zTrackPlaybackControl(a5)	; Set 'do not attack next note' bit
		rts	
; ===========================================================================
; loc_72BB4:
cfNoteFill:
		move.b	(a4),zTrackNoteFillTimeout(a5)	; Note fill timeout
		move.b	(a4)+,zTrackNoteFillMaster(a5)	; Note fill master
		rts	
; ===========================================================================
; loc_72BBE: cfAddKey:
cfChangeTransposition:
		move.b	(a4)+,d0		; Get parameter
		add.b	d0,zTrackTranspose(a5)	; Add to transpose value
		rts	
; ===========================================================================
; loc_72BC6:
cfSetTempo:
		move.b	(a4),v_main_tempo(a6)		; Set main tempo
		move.b	(a4)+,v_main_tempo_timeout(a6)	; And reset timeout (!)
		rts	
; ===========================================================================
; loc_72BD0:
cfSetTempoMod:
		lea	v_music_track_ram(a6),a0
		move.b	(a4)+,d0			; Get new tempo divider
		moveq	#zTrackSz,d1
		moveq	#((v_music_track_ram_end-v_music_track_ram)/zTrackSz)-1,d2	; 1 DAC + 6 FM + 3 PSG tracks
; loc_72BDA:
.trackloop:
		move.b	d0,zTrackTempoDivider(a0)	; Set track's tempo divider
		adda.w	d1,a0
		dbf	d2,.trackloop

		rts	
; ===========================================================================
; loc_72BE6: cfChangeVolume:
cfChangePSGVolume:
		move.b	(a4)+,d0		; Get volume change
		add.b	d0,zTrackVolume(a5)	; Apply it
		rts	
; ===========================================================================
; loc_72BEE:
cfClearPush:
		clr.b	f_push_playing(a6)	; Allow push sound to be played once more
		rts	
; ===========================================================================
; loc_72BF4:
cfStopSpecialFM4:
		bclr	#7,zTrackPlaybackControl(a5)	; Stop track
		bclr	#4,zTrackPlaybackControl(a5)	; Clear 'do not attack next note' bit
		jsr	FMNoteOff(pc)
		tst.b	v_sfx_fm4_track(a6)		; Is SFX using FM4?
		bmi.s	.locexit			; Branch if yes
		movea.l	a5,a3
		lea	v_music_fm4_track(a6),a5
		movea.l	v_voice_ptr(a6),a1		; Voice pointer
		bclr	#2,zTrackPlaybackControl(a5)	; Clear 'SFX is overriding' bit
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		move.b	zTrackVoiceIndex(a5),d0		; Current voice
		jsr	SetVoice(pc)
		movea.l	a3,a5
; loc_72C22:
.locexit:
		addq.w	#8,sp		; Tamper with return value so we don't return to caller
		rts	
; ===========================================================================
; loc_72C26:
cfSetVoice:
		moveq	#0,d0
		move.b	(a4)+,d0		; Get new voice
		move.b	d0,zTrackVoiceIndex(a5)	; Store it
		btst	#2,zTrackPlaybackControl(a5) ; Is SFX overriding this track?
		bne.w	locret_72CAA		; Return if yes
		movea.l	v_voice_ptr(a6),a1	; Music voice pointer
		tst.b	f_voice_selector(a6)	; Are we updating a music track?
		beq.s	SetVoice		; If yes, branch
		movea.l	zTrackVoicePtr(a5),a1	; SFX track voice pointer
		tst.b	f_voice_selector(a6)	; Are we updating a SFX track?
		bmi.s	SetVoice		; If yes, branch
		movea.l	v_special_voice_ptr(a6),a1 ; Special SFX voice pointer

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

; sub_72C4E:
SetVoice:
		subq.w	#1,d0
		bmi.s	.havevoiceptr
		move.w	#25,d1
; loc_72C56:
.voicemultiply:
		adda.w	d1,a1
		dbf	d0,.voicemultiply
; loc_72C5C:
.havevoiceptr:
		move.b	(a1)+,d1		; feedback/algorithm
		move.b	d1,zTrackFeedbackAlgo(a5) ; Save it to track RAM
		move.b	d1,d4
		move.b	#$B0,d0			; Command to write feedback/algorithm
		jsr	WriteFMIorII(pc)
		lea	FMInstrumentOperatorTable(pc),a2
		moveq	#(FMInstrumentOperatorTable_End-FMInstrumentOperatorTable)-1,d3		; Don't want to send TL yet
; loc_72C72:
.sendvoiceloop:
		move.b	(a2)+,d0
		move.b	(a1)+,d1
		jsr	WriteFMIorII(pc)
		dbf	d3,.sendvoiceloop

		moveq	#3,d5
		andi.w	#7,d4			; Get algorithm
		move.b	FMSlotMask(pc,d4.w),d4	; Get slot mask for algorithm
		move.b	zTrackVolume(a5),d3	; Track volume attenuation
; loc_72C8C:
.sendtlloop:
		move.b	(a2)+,d0
		move.b	(a1)+,d1
		lsr.b	#1,d4		; Is bit set for this operator in the mask?
		bcc.s	.sendtl		; Branch if not
		add.b	d3,d1		; Include additional attenuation
; loc_72C96:
.sendtl:
		jsr	WriteFMIorII(pc)
		dbf	d5,.sendtlloop
		
		move.b	#$B4,d0			; Register for AMS/FMS/Panning
		move.b	zTrackAMSFMSPan(a5),d1	; Value to send
		jsr	WriteFMIorII(pc) 	; (It would be better if this were a jmp)

locret_72CAA:
		rts	
; End of function SetVoice

; ===========================================================================
; byte_72CAC:
FMSlotMask:	dc.b 8,	8, 8, 8, $A, $E, $E, $F

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

; sub_72CB4:
SendVoiceTL:
		btst	#2,zTrackPlaybackControl(a5)	; Is SFX overriding?
		bne.s	.locret				; Return if so
		moveq	#0,d0
		move.b	zTrackVoiceIndex(a5),d0	; Current voice
		movea.l	v_voice_ptr(a6),a1	; Voice pointer
		tst.b	f_voice_selector(a6)
		beq.s	.gotvoiceptr
		; DANGER! This uploads the wrong voice! It should have been a5 instead
		; of a6!
		movea.l	zTrackVoicePtr(a6),a1
		tst.b	f_voice_selector(a6)
		bmi.s	.gotvoiceptr
		movea.l	v_special_voice_ptr(a6),a1
; loc_72CD8:
.gotvoiceptr:
		subq.w	#1,d0
		bmi.s	.gotvoice
		move.w	#25,d1
; loc_72CE0:
.voicemultiply:
		adda.w	d1,a1
		dbf	d0,.voicemultiply
; loc_72CE6:
.gotvoice:
		adda.w	#21,a1				; Want TL
		lea	FMInstrumentTLTable(pc),a2
		move.b	zTrackFeedbackAlgo(a5),d0	; Get feedback/algorithm
		andi.w	#7,d0				; Want only algorithm
		move.b	FMSlotMask(pc,d0.w),d4		; Get slot mask
		move.b	zTrackVolume(a5),d3		; Get track volume attenuation
		bmi.s	.locret				; If negative, stop
		moveq	#(FMInstrumentTLTable_End-FMInstrumentTLTable)-1,d5
; loc_72D02:
.sendtlloop:
		move.b	(a2)+,d0
		move.b	(a1)+,d1
		lsr.b	#1,d4		; Is bit set for this operator in the mask?
		bcc.s	.senttl		; Branch if not
		add.b	d3,d1		; Include additional attenuation
		blo.s	.senttl		; Branch on overflow
		jsr	WriteFMIorII(pc)
; loc_72D12:
.senttl:
		dbf	d5,.sendtlloop
; locret_72D16:
.locret:
		rts	
; End of function SendVoiceTL

; ===========================================================================
; byte_72D18:
FMInstrumentOperatorTable:
		dc.b  $30		; Detune/multiple operator 1
		dc.b  $38		; Detune/multiple operator 3
		dc.b  $34		; Detune/multiple operator 2
		dc.b  $3C		; Detune/multiple operator 4
		dc.b  $50		; Rate scalling/attack rate operator 1
		dc.b  $58		; Rate scalling/attack rate operator 3
		dc.b  $54		; Rate scalling/attack rate operator 2
		dc.b  $5C		; Rate scalling/attack rate operator 4
		dc.b  $60		; Amplitude modulation/first decay rate operator 1
		dc.b  $68		; Amplitude modulation/first decay rate operator 3
		dc.b  $64		; Amplitude modulation/first decay rate operator 2
		dc.b  $6C		; Amplitude modulation/first decay rate operator 4
		dc.b  $70		; Secondary decay rate operator 1
		dc.b  $78		; Secondary decay rate operator 3
		dc.b  $74		; Secondary decay rate operator 2
		dc.b  $7C		; Secondary decay rate operator 4
		dc.b  $80		; Secondary amplitude/release rate operator 1
		dc.b  $88		; Secondary amplitude/release rate operator 3
		dc.b  $84		; Secondary amplitude/release rate operator 2
		dc.b  $8C		; Secondary amplitude/release rate operator 4
FMInstrumentOperatorTable_End
; byte_72D2C:
FMInstrumentTLTable:
		dc.b  $40		; Total level operator 1
		dc.b  $48		; Total level operator 3
		dc.b  $44		; Total level operator 2
		dc.b  $4C		; Total level operator 4
FMInstrumentTLTable_End
; ===========================================================================
; loc_72D30:
cfModulation:
		bset	#3,zTrackPlaybackControl(a5)	; Turn on modulation
		move.l	a4,zTrackModulationPtr(a5)	; Save pointer to modulation data
		move.b	(a4)+,zTrackModulationWait(a5)	; Modulation delay
		move.b	(a4)+,zTrackModulationSpeed(a5)	; Modulation speed
		move.b	(a4)+,zTrackModulationDelta(a5)	; Modulation delta
		move.b	(a4)+,d0			; Modulation steps...
		lsr.b	#1,d0				; ... divided by 2...
		move.b	d0,zTrackModulationSteps(a5)	; ... before being stored
		clr.w	zTrackModulationVal(a5)		; Total accumulated modulation frequency change
		rts	
; ===========================================================================
; loc_72D52:
cfEnableModulation:
		bset	#3,zTrackPlaybackControl(a5)	; Turn on modulation
		rts	
; ===========================================================================
; loc_72D58:
cfStopTrack:
		bclr	#7,zTrackPlaybackControl(a5)	; Stop track
		bclr	#4,zTrackPlaybackControl(a5)	; Clear 'do not attack next note' bit
		tst.b	zTrackVoiceControl(a5)		; Is this a PSG track?
		bmi.s	.stoppsg			; Branch if yes
		tst.b	f_updating_dac(a6)		; Is this the DAC we are updating?
		bmi.w	.locexit			; Exit if yes
		jsr	FMNoteOff(pc)
		bra.s	.stoppedchannel
; ===========================================================================
; loc_72D74:
.stoppsg:
		jsr	PSGNoteOff(pc)
; loc_72D78:
.stoppedchannel:
		tst.b	f_voice_selector(a6)	; Are we updating SFX?
		bpl.w	.locexit		; Exit if not
		_clr.b	v_sndprio(a6)		; Clear priority
		moveq	#0,d0
		move.b	zTrackVoiceControl(a5),d0 ; Get voice control bits
		bmi.s	.getpsgptr		; Branch if PSG
		lea	SFX_BGMChannelRAM(pc),a0
		movea.l	a5,a3
		cmpi.b	#4,d0			; Is this FM4?
		bne.s	.getpointer		; Branch if not
		tst.b	v_spcsfx_fm4_track+zTrackPlaybackControl(a6)	; Is special SFX playing?
		bpl.s	.getpointer		; Branch if not
		lea	v_spcsfx_fm4_track(a6),a5
		movea.l	v_special_voice_ptr(a6),a1	; Get voice pointer
		bra.s	.gotpointer
; ===========================================================================
; loc_72DA8:
.getpointer:
		subq.b	#2,d0		; SFX can only use FM3 and up
		lsl.b	#2,d0
		movea.l	(a0,d0.w),a5
		tst.b	zTrackPlaybackControl(a5)	; Is track playing?
		bpl.s	.novoiceupd			; Branch if not
		movea.l	v_voice_ptr(a6),a1		; Get voice pointer
; loc_72DB8:
.gotpointer:
		bclr	#2,zTrackPlaybackControl(a5)	; Clear 'SFX overriding' bit
		bset	#1,zTrackPlaybackControl(a5)	; Set 'track at rest' bit
		move.b	zTrackVoiceIndex(a5),d0		; Current voice
		jsr	SetVoice(pc)
; loc_72DC8:
.novoiceupd:
		movea.l	a3,a5
		bra.s	.locexit
; ===========================================================================
; loc_72DCC:
.getpsgptr:
		lea	v_spcsfx_psg3_track(a6),a0
		tst.b	(a0)		; Is track playing?
		bpl.s	.getchannelptr	; Branch if not
		cmpi.b	#$E0,d0		; Is it the noise channel?
		beq.s	.gotchannelptr	; Branch if yes
		cmpi.b	#$C0,d0		; Is it PSG 3?
		beq.s	.gotchannelptr	; Branch if yes
; loc_72DE0:
.getchannelptr:
		lea	SFX_BGMChannelRAM(pc),a0
		lsr.b	#3,d0
		movea.l	(a0,d0.w),a0
; loc_72DEA:
.gotchannelptr:
		bclr	#2,zTrackPlaybackControl(a0)	; Clear 'SFX overriding' bit
		bset	#1,zTrackPlaybackControl(a0)	; Set 'track at rest' bit
		cmpi.b	#$E0,zTrackVoiceControl(a0)	; Is this a noise pointer?
		bne.s	.locexit			; Branch if not
		move.b	zTrackPSGNoise(a0),(psg_input).l ; Set noise tone
; loc_72E02:
.locexit:
		addq.w	#8,sp		; Tamper with return value so we don't go back to caller
		rts	
; ===========================================================================
; loc_72E06:
cfSetPSGNoise:
		move.b	#$E0,zTrackVoiceControl(a5)	; Turn channel into noise channel
		move.b	(a4)+,zTrackPSGNoise(a5)	; Save noise tone
		btst	#2,zTrackPlaybackControl(a5)	; Is track being overridden?
		bne.s	.locret				; Return if yes
		move.b	-1(a4),(psg_input).l		; Set tone
; locret_72E1E:
.locret:
		rts	
; ===========================================================================
; loc_72E20:
cfDisableModulation:
		bclr	#3,zTrackPlaybackControl(a5)	; Disable modulation
		rts	
; ===========================================================================
; loc_72E26:
cfSetPSGTone:
		move.b	(a4)+,zTrackVoiceIndex(a5)	; Set current PSG tone
		rts	
; ===========================================================================
; loc_72E2C:
cfJumpTo:
		move.b	(a4)+,d0	; High byte of offset
		lsl.w	#8,d0		; Shift it into place
		move.b	(a4)+,d0	; Low byte of offset
		adda.w	d0,a4		; Add to current position
		subq.w	#1,a4		; Put back one byte
		rts	
; ===========================================================================
; loc_72E38:
cfRepeatAtPos:
		moveq	#0,d0
		move.b	(a4)+,d0			; Loop index
		move.b	(a4)+,d1			; Repeat count
		tst.b	zTrackLoopCounters(a5,d0.w)	; Has this loop already started?
		bne.s	.loopexists			; Branch if yes
		move.b	d1,zTrackLoopCounters(a5,d0.w)	; Initialize repeat count
; loc_72E48:
.loopexists:
		subq.b	#1,zTrackLoopCounters(a5,d0.w)	; Decrease loop's repeat count
		bne.s	cfJumpTo			; If nonzero, branch to target
		addq.w	#2,a4				; Skip target address
		rts	
; ===========================================================================
; loc_72E52:
cfJumpToGosub:
		moveq	#0,d0
		move.b	zTrackStackPointer(a5),d0	; Current stack pointer
		subq.b	#4,d0				; Add space for another target
		move.l	a4,(a5,d0.w)			; Put in current address (*before* target for jump!)
		move.b	d0,zTrackStackPointer(a5)	; Store new stack pointer
		bra.s	cfJumpTo
; ===========================================================================
; loc_72E64:
cfOpF9:
		move.b	#$88,d0		; D1L/RR of Operator 3
		move.b	#$F,d1		; Loaded with fixed value (max RR, 1TL)
		jsr	WriteFMI(pc)
		move.b	#$8C,d0		; D1L/RR of Operator 4
		move.b	#$F,d1		; Loaded with fixed value (max RR, 1TL)
		bra.w	WriteFMI
; ===========================================================================

and replace it completely with:

		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
		zPtrSpec   $1300
		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
		zPtrSpec	Z80DefaultBankSwitch
		dc.b	$CD
		zPtrSpec	Z80BankSwitch0
		dc.b	$18,$03
Z80DefaultBankSwitch:
		dc.b	$CD
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch		
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch
		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
		zPtrSpec   Z80BankSwitch		
		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
		zPtrSpec   Z80BankSwitch		
		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
		zPtrSpec   Z80BankSwitch	
		dc.b	$00,$00,$00,$00,$00,$00,$00,$00,$00
		dc.b	$21
		z68kPtr   SegaSnd
		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:
		zPtrSpec	MusicPointers
		zPtrSpec	UniversalVoiceBank
		zPtrSpec	MusicPointers
		zPtrSpec	SndPointers
		zPtrSpec	PSGNoisePointers
		zPtrSpec	PSGTonePointers
		dc.w	$3300

;credit goes to Varion Icaria for finding this index
PSGNoisePointers:
		zPtrSpec	PSGN_0
		zPtrSpec	PSGN_1
		zPtrSpec	PSGN_2
		zPtrSpec	PSGN_3
		zPtrSpec	PSGN_4
		zPtrSpec	PSGN_5
		zPtrSpec	PSGN_6
		zPtrSpec	PSGN_7

PSGN_1: incbin sound/PSGN1.bin
PSGN_0: incbin sound/PSGN0.bin
PSGN_2: incbin sound/PSGN2.bin
PSGN_3: incbin sound/PSGN3.bin
PSGN_4: incbin sound/PSGN4.bin
PSGN_5: incbin sound/PSGN5.bin
PSGN_6: incbin sound/PSGN6.bin
PSGN_7: incbin sound/PSGN7.bin

;credit goes to Varion Icaria for finding this index
PSGTonePointers:
		zPtrSpec	PSGT_00
		zPtrSpec	PSGT_01
		zPtrSpec	PSGT_02
		zPtrSpec	PSGT_03
		zPtrSpec	PSGT_04
		zPtrSpec	PSGT_05
		zPtrSpec	PSGT_06
		zPtrSpec	PSGT_07
		zPtrSpec	PSGT_08
		zPtrSpec	PSGT_09
		zPtrSpec	PSGT_0A
		zPtrSpec	PSGT_0B
		zPtrSpec	PSGT_0C
		zPtrSpec	PSGT_0D
		zPtrSpec	PSGT_0E
		zPtrSpec	PSGT_0F
		zPtrSpec	PSGT_10
		zPtrSpec	PSGT_11
		zPtrSpec	PSGT_12
		zPtrSpec	PSGT_13
		zPtrSpec	PSGT_14
		zPtrSpec	PSGT_15
		zPtrSpec	PSGT_16
		zPtrSpec	PSGT_17
		zPtrSpec	PSGT_18
		zPtrSpec	PSGT_19
		zPtrSpec	PSGT_1A
		zPtrSpec	PSGT_1B
		zPtrSpec	PSGT_1C
		zPtrSpec	PSGT_1D
		zPtrSpec	PSGT_1E
		zPtrSpec	PSGT_1F
		zPtrSpec	PSGT_20
		zPtrSpec	PSGT_21
		zPtrSpec	PSGT_22
		zPtrSpec	PSGT_23
		zPtrSpec	PSGT_24
		zPtrSpec	PSGT_25
		zPtrSpec	PSGT_26

PSGT_00: incbin sound/PSGT00.bin
PSGT_01: incbin sound/PSGT01.bin
PSGT_02: incbin sound/PSGT02.bin
PSGT_03: incbin sound/PSGT03.bin
PSGT_04: incbin sound/PSGT04.bin
PSGT_05: incbin sound/PSGT05.bin
PSGT_06: incbin sound/PSGT06.bin
PSGT_07: incbin sound/PSGT07.bin
PSGT_08: incbin sound/PSGT08.bin
PSGT_09: incbin sound/PSGT09.bin
PSGT_0A: incbin sound/PSGT0A.bin
PSGT_0B: incbin sound/PSGT0B.bin
PSGT_0C: incbin sound/PSGT0C.bin
PSGT_0D: incbin sound/PSGT0D.bin
PSGT_0E: incbin sound/PSGT0E.bin
PSGT_0F: incbin sound/PSGT0F.bin
PSGT_10: incbin sound/PSGT10.bin
PSGT_11: incbin sound/PSGT11.bin
PSGT_12: incbin sound/PSGT12.bin
PSGT_13: incbin sound/PSGT13.bin
PSGT_14: incbin sound/PSGT14.bin
PSGT_15: incbin sound/PSGT15.bin
PSGT_16: incbin sound/PSGT16.bin
PSGT_17: incbin sound/PSGT17.bin
PSGT_18: incbin sound/PSGT18.bin
PSGT_19: incbin sound/PSGT19.bin
PSGT_1A: incbin sound/PSGT1A.bin
PSGT_1B: incbin sound/PSGT1B.bin
PSGT_1C: incbin sound/PSGT1C.bin
PSGT_1D: incbin sound/PSGT1D.bin
PSGT_1E: incbin sound/PSGT1E.bin
PSGT_1F: incbin sound/PSGT1F.bin
PSGT_20: incbin sound/PSGT20.bin
PSGT_21: incbin sound/PSGT21.bin
PSGT_22: incbin sound/PSGT22.bin
PSGT_23: incbin sound/PSGT23.bin
PSGT_24: incbin sound/PSGT24.bin
PSGT_25: incbin sound/PSGT25.bin
PSGT_26: incbin sound/PSGT26.bin

MusicPointers:	
		z68kPtr	Angel_Island_1_Snd
		z68kPtr	Angel_Island_2_Snd
		z68kPtr	Hydrocity_1_Snd
		z68kPtr	Hydrocity_2_Snd
		z68kPtr	Marble_Garden_1_Snd
		z68kPtr	Marble_Garden_2_Snd
		z68kPtr	Carnival_Night_1_Snd
		z68kPtr	Carnival_Night_2_Snd
		z68kPtr	Flying_Battery_1_Snd
		z68kPtr	Flying_Battery_2_Snd
		z68kPtr	Icecap_1_Snd
		z68kPtr	Icecap_2_Snd
		z68kPtr	Launch_Base_1_Snd
		z68kPtr	Launch_Base_2_Snd
		z68kPtr	Mushroom_Hill_1_Snd
		z68kPtr	Mushroom_Hill_2_Snd
		z68kPtr	Sandopolis_1_Snd
		z68kPtr	Sandopolis_2_Snd
		z68kPtr	Lava_Reef_1_Snd
		z68kPtr	Lava_Reef_2_Snd
		z68kPtr	Sky_Sanctuary_Snd
		z68kPtr	Death_Egg_1_Snd
		z68kPtr	Death_Egg_2_Snd
		z68kPtr	Mini_Boss_SK_Snd
		z68kPtr	Boss_Snd
		z68kPtr	The_Doomsday_Snd
		z68kPtr	Glowing_Spheres_Bonus_Stage_snd
		z68kPtr	Special_Stage_Snd
		z68kPtr	Slot_Machine_Bonus_Stage_snd
		z68kPtr	Gum_Ball_Machine_Bonus_Stage_snd
		z68kPtr	Knuckles_Theme_Snd
		z68kPtr	Azure_Lake_Snd
		z68kPtr	Balloon_Park_Snd
		z68kPtr	Desert_Palace_Snd
		z68kPtr	Chrome_Gadget_Snd
		z68kPtr	Endless_Mine_Snd
		z68kPtr	Title_Screen_Snd
		z68kPtr	Credits_Snd
		z68kPtr	Time_Game_Over_Snd
		z68kPtr	Continue_Sound
		z68kPtr	Level_Results_Snd
		z68kPtr	Extra_Life_Snd
		z68kPtr	Emerald_Snd
		z68kPtr	Invincibility_Snd
		z68kPtr	Competition_Menu_Snd
		z68kPtr	Mini_Boss_Snd
		z68kPtr	Menu_Snd
		z68kPtr	Final_Boss_Snd
		z68kPtr	Underwater_Timming_Snd
		z68kPtr	Presented_by_SEGA_Snd

SndPointers:
		z68kPtr	Sfx_34_Snd
		z68kPtr	Sfx_35_Snd
		z68kPtr	Sfx_36_Snd
		z68kPtr	Sfx_37_Snd
		z68kPtr	Sfx_38_Snd
		z68kPtr	Sfx_39_Snd
		z68kPtr	Sfx_3A_Snd
		z68kPtr	Sfx_3B_Snd
		z68kPtr	Sfx_3C_Snd
		z68kPtr	Sfx_3D_Snd
		z68kPtr	Sfx_3E_Snd
		z68kPtr	Sfx_3F_Snd
		z68kPtr	Sfx_40_Snd
		z68kPtr	Sfx_41_Snd
		z68kPtr	Sfx_42_Snd
		z68kPtr	Sfx_43_Snd
		z68kPtr	Sfx_44_Snd
		z68kPtr	Sfx_45_Snd
		z68kPtr	Sfx_46_Snd
		z68kPtr	Sfx_47_Snd
		z68kPtr	Sfx_48_Snd
		z68kPtr	Sfx_49_Snd
		z68kPtr	Sfx_4A_Snd
		z68kPtr	Sfx_4B_Snd
		z68kPtr	Sfx_4C_Snd
		z68kPtr	Sfx_4D_Snd
		z68kPtr	Sfx_4E_Snd
		z68kPtr	Sfx_4F_Snd
		z68kPtr	Sfx_50_Snd
		z68kPtr	Sfx_51_Snd
		z68kPtr	Sfx_52_Snd
		z68kPtr	Sfx_53_Snd
		z68kPtr	Sfx_54_Snd
		z68kPtr	Sfx_55_Snd
		z68kPtr	Sfx_56_Snd
		z68kPtr	Sfx_57_Snd
		z68kPtr	Sfx_58_Snd
		z68kPtr	Sfx_59_Snd
		z68kPtr	Sfx_5A_Snd
		z68kPtr	Sfx_5B_Snd
		z68kPtr	Sfx_5C_Snd
		z68kPtr	Sfx_5D_Snd
		z68kPtr	Sfx_5E_Snd
		z68kPtr	Sfx_5F_Snd
		z68kPtr	Sfx_60_Snd
		z68kPtr	Sfx_61_Snd
		z68kPtr	Sfx_62_Snd
		z68kPtr	Sfx_63_Snd
		z68kPtr	Sfx_64_Snd
		z68kPtr	Sfx_65_Snd
		z68kPtr	Sfx_66_Snd
		z68kPtr	Sfx_67_Snd
		z68kPtr	Sfx_68_Snd
		z68kPtr	Sfx_69_Snd
		z68kPtr	Sfx_6A_Snd
		z68kPtr	Sfx_6B_Snd
		z68kPtr	Sfx_6C_Snd
		z68kPtr	Sfx_6D_Snd
		z68kPtr	Sfx_6E_Snd
		z68kPtr	Sfx_6F_Snd
		z68kPtr	Sfx_70_Snd
		z68kPtr	Sfx_71_Snd
		z68kPtr	Sfx_72_Snd
		z68kPtr	Sfx_73_Snd
		z68kPtr	Sfx_74_Snd
		z68kPtr	Sfx_75_Snd
		z68kPtr	Sfx_76_Snd
		z68kPtr	Sfx_77_Snd
		z68kPtr	Sfx_78_Snd
		z68kPtr	Sfx_79_Snd
		z68kPtr	Sfx_7A_Snd
		z68kPtr	Sfx_7B_Snd
		z68kPtr	Sfx_7C_Snd
		z68kPtr	Sfx_7D_Snd
		z68kPtr	Sfx_7E_Snd
		z68kPtr	Sfx_7F_Snd
		z68kPtr	Sfx_80_Snd
		z68kPtr	Sfx_81_Snd
		z68kPtr	Sfx_82_Snd
		z68kPtr	Sfx_83_Snd
		z68kPtr	Sfx_84_Snd
		z68kPtr	Sfx_85_Snd
		z68kPtr	Sfx_86_Snd
		z68kPtr	Sfx_87_Snd
		z68kPtr	Sfx_88_Snd
		z68kPtr	Sfx_89_Snd
		z68kPtr	Sfx_8A_Snd
		z68kPtr	Sfx_8B_Snd
		z68kPtr	Sfx_8C_Snd
		z68kPtr	Sfx_8D_Snd
		z68kPtr	Sfx_8E_Snd
		z68kPtr	Sfx_8F_Snd
		z68kPtr	Sfx_90_Snd
		z68kPtr	Sfx_91_Snd
		z68kPtr	Sfx_92_Snd
		z68kPtr	Sfx_93_Snd
		z68kPtr	Sfx_94_Snd
		z68kPtr	Sfx_95_Snd
		z68kPtr	Sfx_96_Snd
		z68kPtr	Sfx_97_Snd
		z68kPtr	Sfx_98_Snd
		z68kPtr	Sfx_99_Snd
		z68kPtr	Sfx_9A_Snd
		z68kPtr	Sfx_9B_Snd
		z68kPtr	Sfx_9C_Snd
		z68kPtr	Sfx_9D_Snd
		z68kPtr	Sfx_9E_Snd
		z68kPtr	Sfx_9F_Snd
		z68kPtr	Sfx_A0_Snd
		z68kPtr	Sfx_A1_Snd
		z68kPtr	Sfx_A2_Snd
		z68kPtr	Sfx_A3_Snd
		z68kPtr	Sfx_A4_Snd
		z68kPtr	Sfx_A5_Snd
		z68kPtr	Sfx_A6_Snd
		z68kPtr	Sfx_A7_Snd
		z68kPtr	Sfx_A8_Snd
		z68kPtr	Sfx_A9_Snd
		z68kPtr	Sfx_AA_Snd
		z68kPtr	Sfx_AB_Snd
		z68kPtr	Sfx_AC_Snd
		z68kPtr	Sfx_AD_Snd
		z68kPtr	Sfx_AE_Snd
		z68kPtr	Sfx_AF_Snd
		z68kPtr	Sfx_B0_Snd
		z68kPtr	Sfx_B1_Snd
		z68kPtr	Sfx_B2_Snd
		z68kPtr	Sfx_B3_Snd
		z68kPtr	Sfx_B4_Snd
		z68kPtr	Sfx_B5_Snd
		z68kPtr	Sfx_B6_Snd
		z68kPtr	Sfx_B7_Snd
		z68kPtr	Sfx_B8_Snd
		z68kPtr	Sfx_B9_Snd
		z68kPtr	Sfx_BA_Snd
		z68kPtr	Sfx_BB_Snd
		z68kPtr	Sfx_BC_Snd
		z68kPtr	Sfx_BD_Snd
		z68kPtr	Sfx_BE_Snd
		z68kPtr	Sfx_BF_Snd
		z68kPtr	Sfx_C0_Snd
		z68kPtr	Sfx_C1_Snd
		z68kPtr	Sfx_C2_Snd
		z68kPtr	Sfx_C3_Snd
		z68kPtr	Sfx_C4_Snd
		z68kPtr	Sfx_C5_Snd
		z68kPtr	Sfx_C6_Snd
		z68kPtr	Sfx_C7_Snd
		z68kPtr	Sfx_C8_Snd
		z68kPtr	Sfx_C9_Snd
		z68kPtr	Sfx_CA_Snd
		z68kPtr	Sfx_CB_Snd
		z68kPtr	Sfx_CC_Snd
		z68kPtr	Sfx_CD_Snd
		z68kPtr	Sfx_CE_Snd
		z68kPtr	Sfx_CF_Snd
		z68kPtr	Sfx_D0_Snd
		z68kPtr	Sfx_D1_Snd
		z68kPtr	Sfx_D2_Snd
		z68kPtr	Sfx_D3_Snd
		z68kPtr	Sfx_D4_Snd
		z68kPtr	Sfx_D5_Snd
		z68kPtr	Sfx_D6_Snd
		z68kPtr	Sfx_D7_Snd
		z68kPtr	Sfx_D8_Snd
		z68kPtr	Sfx_D9_Snd
		z68kPtr	Sfx_DA_Snd
		z68kPtr	Sfx_DB_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
		z68kPtr	Sfx_DC_Snd
DriverPointersEnd:

UniversalVoiceBank:
		incbin	"sound/uvb.bin"
UniversalVoiceBankEnd:
		align	$8000

DacBank0:
		incbin	"sound/dac_0.bin"

		align	$8000
DacBank1:
		incbin	"sound/dac_1.bin"
		align	$8000

DacBank2:
		incbin	"sound/dac_2.bin"
		align	$8000

Bank0:
		incbin	"sound/filler.bin"
Mini_Boss_Snd:
		incbin	"sound/miniboss.snd"
Final_Boss_Snd:
		incbin	"sound/f_boss.snd"
		align	$8000

Bank1:
Angel_Island_1_Snd:
		incbin	"sound/aiz1.snd"
Angel_Island_2_Snd:
		incbin	"sound/aiz2.snd"
Hydrocity_1_Snd:
		incbin	"sound/hcz1.snd"
Hydrocity_2_Snd:
		incbin	"sound/hcz2.snd"
Marble_Garden_1_Snd:
		incbin	"sound/mgz1.snd"
Marble_Garden_2_Snd:
		incbin	"sound/mgz2.snd"
Carnival_Night_2_Snd:
		incbin	"sound/cnz2.snd"
Carnival_Night_1_Snd:
		incbin	"sound/cnz1.snd"
Flying_Battery_1_Snd:
		incbin	"sound/fbz1.snd"
Flying_Battery_2_Snd:
		incbin	"sound/fbz2.snd"
The_Doomsday_Snd:
		incbin	"sound/tdz.snd"
		align	$8000

Bank2:
Icecap_2_Snd:
		incbin	"sound/iz2.snd"
Icecap_1_Snd:
		incbin	"sound/iz1.snd"
Launch_Base_2_Snd:
		incbin	"sound/lbz2.snd"
Launch_Base_1_Snd:
		incbin	"sound/lbz1.snd"
Mushroom_Hill_1_Snd:
		incbin	"sound/mhz1.snd"
Mushroom_Hill_2_Snd:
		incbin	"sound/mhz2.snd"
Sandopolis_1_Snd:
		incbin	"sound/sz1.snd"
Sandopolis_2_Snd:
		incbin	"sound/sz2.snd"
Lava_Reef_1_Snd:
		incbin	"sound/lrz1.snd"
Lava_Reef_2_Snd:
		incbin	"sound/lrz2.snd"
Sky_Sanctuary_Snd:
		incbin	"sound/scz.snd"
Death_Egg_1_Snd:
		incbin	"sound/dez1.snd"
Death_Egg_2_Snd:
		incbin	"sound/dez2.snd"
Mini_Boss_SK_Snd:
		incbin	"sound/mb_sk.snd"
Boss_Snd:
		incbin	"sound/boss.snd"
Glowing_Spheres_Bonus_Stage_snd:
		incbin	"sound/gs_bs.snd"
Special_Stage_Snd:
		incbin	"sound/ss.snd"
Level_Results_Snd:
		incbin	"sound/lr.snd"
Menu_Snd:		
		incbin	"sound/menu.snd"
		align	$8000

Bank3:
Slot_Machine_Bonus_Stage_snd:
		incbin	"sound/sm_bs.snd"
Gum_Ball_Machine_Bonus_Stage_snd:
		incbin	"sound/gbm_bs.snd"
Knuckles_Theme_Snd:
		incbin	"sound/kte.snd"
Azure_Lake_Snd:
		incbin	"sound/alz.snd"
Balloon_Park_Snd:
		incbin	"sound/bpz.snd"
Desert_Palace_Snd:
		incbin	"sound/dpz.snd"
Chrome_Gadget_Snd:
		incbin	"sound/cgz.snd"
Endless_Mine_Snd:
		incbin	"sound/emz.snd"
Title_Screen_Snd:
		incbin	"sound/ts.snd"
Credits_Snd:		
		incbin	"sound/credits.snd"
Time_Game_Over_Snd:
		incbin	"sound/tgovr.snd"
Continue_Snd:
		incbin	"sound/continue.snd"
Extra_Life_Snd:
		incbin	"sound/1up.snd"
Emerald_Snd:
		incbin	"sound/emerald.snd"
Invincibility_Snd:
		incbin	"sound/invcblty.snd"
Competition_Menu_Snd:
		incbin	"sound/2p_menu.snd"	
Underwater_Timming_Snd:
		incbin	"sound/panic.snd"
Presented_by_SEGA_Snd:
		incbin	"sound/p_sega.snd"
		align	$8000

SndBank:
SegaPCMBank:
SegaSnd:
		incbin	"sound/sega.snd"
Sfx_34_Snd:
		incbin	"sound/sfx_34.snd"
Sfx_35_Snd:
		incbin	"sound/sfx_35.snd"
Sfx_36_Snd:
		incbin	"sound/sfx_36.snd"
Sfx_37_Snd:
		incbin	"sound/sfx_37.snd"
Sfx_38_Snd:
		incbin	"sound/sfx_38.snd"
Sfx_39_Snd:
		incbin	"sound/sfx_39.snd"
Sfx_3A_Snd:
		incbin	"sound/sfx_3A.snd"
Sfx_3B_Snd:
		incbin	"sound/sfx_3B.snd"
Sfx_3C_Snd:
		incbin	"sound/sfx_3C.snd"
Sfx_3D_Snd:
		incbin	"sound/sfx_3D.snd"
Sfx_3E_Snd:
		incbin	"sound/sfx_3E.snd"
Sfx_3F_Snd:
		incbin	"sound/sfx_3F.snd"
Sfx_40_Snd:
		incbin	"sound/sfx_40.snd"
Sfx_41_Snd:
		incbin	"sound/sfx_41.snd"
Sfx_42_Snd:
		incbin	"sound/sfx_42.snd"
Sfx_43_Snd:
		incbin	"sound/sfx_43.snd"
Sfx_44_Snd:
		incbin	"sound/sfx_44.snd"
Sfx_45_Snd:
		incbin	"sound/sfx_45.snd"
Sfx_46_Snd:
		incbin	"sound/sfx_46.snd"
Sfx_47_Snd:
		incbin	"sound/sfx_47.snd"
Sfx_48_Snd:
		incbin	"sound/sfx_48.snd"
Sfx_49_Snd:
		incbin	"sound/sfx_49.snd"
Sfx_4A_Snd:
		incbin	"sound/sfx_4A.snd"
Sfx_4B_Snd:
		incbin	"sound/sfx_4B.snd"
Sfx_4C_Snd:
		incbin	"sound/sfx_4C.snd"
Sfx_4D_Snd:
		incbin	"sound/sfx_4D.snd"
Sfx_4E_Snd:
		incbin	"sound/sfx_4E.snd"
Sfx_4F_Snd:
		incbin	"sound/sfx_4F.snd"
Sfx_50_Snd:
		incbin	"sound/sfx_50.snd"
Sfx_51_Snd:
		incbin	"sound/sfx_51.snd"
Sfx_52_Snd:
		incbin	"sound/sfx_52.snd"
Sfx_53_Snd:
		incbin	"sound/sfx_53.snd"
Sfx_54_Snd:
		incbin	"sound/sfx_54.snd"
Sfx_55_Snd:
		incbin	"sound/sfx_55.snd"
Sfx_56_Snd:
		incbin	"sound/sfx_56.snd"
Sfx_57_Snd:
		incbin	"sound/sfx_57.snd"
Sfx_58_Snd:
		incbin	"sound/sfx_58.snd"
Sfx_59_Snd:
		incbin	"sound/sfx_59.snd"
Sfx_5A_Snd:
		incbin	"sound/sfx_5A.snd"
Sfx_5B_Snd:
		incbin	"sound/sfx_5B.snd"
Sfx_5C_Snd:
		incbin	"sound/sfx_5C.snd"
Sfx_5D_Snd:
		incbin	"sound/sfx_5D.snd"
Sfx_5E_Snd:
		incbin	"sound/sfx_5E.snd"
Sfx_5F_Snd:
		incbin	"sound/sfx_5F.snd"
Sfx_60_Snd:
		incbin	"sound/sfx_60.snd"
Sfx_61_Snd:
		incbin	"sound/sfx_61.snd"
Sfx_62_Snd:
		incbin	"sound/sfx_62.snd"
Sfx_63_Snd:
		incbin	"sound/sfx_63.snd"
Sfx_64_Snd:
		incbin	"sound/sfx_64.snd"
Sfx_65_Snd:
		incbin	"sound/sfx_65.snd"
Sfx_66_Snd:
		incbin	"sound/sfx_66.snd"
Sfx_67_Snd:
		incbin	"sound/sfx_67.snd"
Sfx_68_Snd:
		incbin	"sound/sfx_68.snd"
Sfx_69_Snd:
		incbin	"sound/sfx_69.snd"
Sfx_6A_Snd:
		incbin	"sound/sfx_6A.snd"
Sfx_6B_Snd:
		incbin	"sound/sfx_6B.snd"
Sfx_6C_Snd:
		incbin	"sound/sfx_6C.snd"
Sfx_6D_Snd:
		incbin	"sound/sfx_6D.snd"
Sfx_6E_Snd:
		incbin	"sound/sfx_6E.snd"
Sfx_6F_Snd:
		incbin	"sound/sfx_6F.snd"
Sfx_70_Snd:
		incbin	"sound/sfx_70.snd"
Sfx_71_Snd:
		incbin	"sound/sfx_71.snd"
Sfx_72_Snd:
		incbin	"sound/sfx_72.snd"
Sfx_73_Snd:
		incbin	"sound/sfx_73.snd"
Sfx_74_Snd:
		incbin	"sound/sfx_74.snd"
Sfx_75_Snd:
		incbin	"sound/sfx_75.snd"
Sfx_76_Snd:
		incbin	"sound/sfx_76.snd"
Sfx_77_Snd:
		incbin	"sound/sfx_77.snd"
Sfx_78_Snd:
		incbin	"sound/sfx_78.snd"
Sfx_79_Snd:
		incbin	"sound/sfx_79.snd"
Sfx_7A_Snd:
		incbin	"sound/sfx_7A.snd"
Sfx_7B_Snd:
		incbin	"sound/sfx_7B.snd"
Sfx_7C_Snd:
		incbin	"sound/sfx_7C.snd"
Sfx_7D_Snd:
		incbin	"sound/sfx_7D.snd"
Sfx_7E_Snd:
		incbin	"sound/sfx_7E.snd"
Sfx_7F_Snd:
		incbin	"sound/sfx_7F.snd"
Sfx_80_Snd:
		incbin	"sound/sfx_80.snd"
Sfx_81_Snd:
		incbin	"sound/sfx_81.snd"
Sfx_82_Snd:
		incbin	"sound/sfx_82.snd"
Sfx_83_Snd:
		incbin	"sound/sfx_83.snd"
Sfx_84_Snd:
		incbin	"sound/sfx_84.snd"
Sfx_85_Snd:
		incbin	"sound/sfx_85.snd"
Sfx_86_Snd:
		incbin	"sound/sfx_86.snd"
Sfx_87_Snd:
		incbin	"sound/sfx_87.snd"
Sfx_88_Snd:
		incbin	"sound/sfx_88.snd"
Sfx_89_Snd:
		incbin	"sound/sfx_89.snd"
Sfx_8A_Snd:
		incbin	"sound/sfx_8A.snd"
Sfx_8B_Snd:
		incbin	"sound/sfx_8B.snd"
Sfx_8C_Snd:
		incbin	"sound/sfx_8C.snd"
Sfx_8D_Snd:
		incbin	"sound/sfx_8D.snd"
Sfx_8E_Snd:
		incbin	"sound/sfx_8E.snd"
Sfx_8F_Snd:
		incbin	"sound/sfx_8F.snd"
Sfx_90_Snd:
		incbin	"sound/sfx_90.snd"
Sfx_91_Snd:
		incbin	"sound/sfx_91.snd"
Sfx_92_Snd:
		incbin	"sound/sfx_92.snd"
Sfx_93_Snd:
		incbin	"sound/sfx_93.snd"
Sfx_94_Snd:
		incbin	"sound/sfx_94.snd"
Sfx_95_Snd:
		incbin	"sound/sfx_95.snd"
Sfx_96_Snd:
		incbin	"sound/sfx_96.snd"
Sfx_97_Snd:
		incbin	"sound/sfx_97.snd"
Sfx_98_Snd:
		incbin	"sound/sfx_98.snd"
Sfx_99_Snd:
		incbin	"sound/sfx_99.snd"
Sfx_9A_Snd:
		incbin	"sound/sfx_9A.snd"
Sfx_9B_Snd:
		incbin	"sound/sfx_9B.snd"
Sfx_9C_Snd:
		incbin	"sound/sfx_9C.snd"
Sfx_9D_Snd:
		incbin	"sound/sfx_9D.snd"
Sfx_9E_Snd:
		incbin	"sound/sfx_9E.snd"
Sfx_9F_Snd:
		incbin	"sound/sfx_9F.snd"
Sfx_A0_Snd:
		incbin	"sound/sfx_A0.snd"
Sfx_A1_Snd:
		incbin	"sound/sfx_A1.snd"
Sfx_A2_Snd:
		incbin	"sound/sfx_A2.snd"
Sfx_A3_Snd:
		incbin	"sound/sfx_A3.snd"
Sfx_A4_Snd:
		incbin	"sound/sfx_A4.snd"
Sfx_A5_Snd:
		incbin	"sound/sfx_A5.snd"
Sfx_A6_Snd:
		incbin	"sound/sfx_A6.snd"
Sfx_A7_Snd:
		incbin	"sound/sfx_A7.snd"
Sfx_A8_Snd:
		incbin	"sound/sfx_A8.snd"
Sfx_A9_Snd:
		incbin	"sound/sfx_A9.snd"
Sfx_AA_Snd:
		incbin	"sound/sfx_AA.snd"
Sfx_AB_Snd:
		incbin	"sound/sfx_AB.snd"
Sfx_AC_Snd:
		incbin	"sound/sfx_AC.snd"
Sfx_AD_Snd:
		incbin	"sound/sfx_AD.snd"
Sfx_AE_Snd:
		incbin	"sound/sfx_AE.snd"
Sfx_AF_Snd:
		incbin	"sound/sfx_AF.snd"
Sfx_B0_Snd:
		incbin	"sound/sfx_B0.snd"
Sfx_B1_Snd:
		incbin	"sound/sfx_B1.snd"
Sfx_B2_Snd:
		incbin	"sound/sfx_B2.snd"
Sfx_B3_Snd:
		incbin	"sound/sfx_B3.snd"
Sfx_B4_Snd:
		incbin	"sound/sfx_B4.snd"
Sfx_B5_Snd:
		incbin	"sound/sfx_B5.snd"
Sfx_B6_Snd:
		incbin	"sound/sfx_B6.snd"
Sfx_B7_Snd:
		incbin	"sound/sfx_B7.snd"
Sfx_B8_Snd:
		incbin	"sound/sfx_B8.snd"
Sfx_B9_Snd:
		incbin	"sound/sfx_B9.snd"
Sfx_BA_Snd:
		incbin	"sound/sfx_BA.snd"
Sfx_BB_Snd:
		incbin	"sound/sfx_BB.snd"
Sfx_BC_Snd:
		incbin	"sound/sfx_BC.snd"
Sfx_BD_Snd:
		incbin	"sound/sfx_BD.snd"
Sfx_BE_Snd:
		incbin	"sound/sfx_BE.snd"
Sfx_BF_Snd:
		incbin	"sound/sfx_BF.snd"
Sfx_C0_Snd:
		incbin	"sound/sfx_C0.snd"
Sfx_C1_Snd:
		incbin	"sound/sfx_C1.snd"
Sfx_C2_Snd:
		incbin	"sound/sfx_C2.snd"
Sfx_C3_Snd:
		incbin	"sound/sfx_C3.snd"
Sfx_C4_Snd:
		incbin	"sound/sfx_C4.snd"
Sfx_C5_Snd:
		incbin	"sound/sfx_C5.snd"
Sfx_C6_Snd:
		incbin	"sound/sfx_C6.snd"
Sfx_C7_Snd:
		incbin	"sound/sfx_C7.snd"
Sfx_C8_Snd:
		incbin	"sound/sfx_C8.snd"
Sfx_C9_Snd:
		incbin	"sound/sfx_C9.snd"
Sfx_CA_Snd:
		incbin	"sound/sfx_CA.snd"
Sfx_CB_Snd:
		incbin	"sound/sfx_CB.snd"
Sfx_CC_Snd:
		incbin	"sound/sfx_CC.snd"
Sfx_CD_Snd:
		incbin	"sound/sfx_CD.snd"
Sfx_CE_Snd:
		incbin	"sound/sfx_CE.snd"
Sfx_CF_Snd:
		incbin	"sound/sfx_CF.snd"
Sfx_D0_Snd:
		incbin	"sound/sfx_D0.snd"
Sfx_D1_Snd:
		incbin	"sound/sfx_D1.snd"
Sfx_D2_Snd:
		incbin	"sound/sfx_D2.snd"
Sfx_D3_Snd:
		incbin	"sound/sfx_D3.snd"
Sfx_D4_Snd:
		incbin	"sound/sfx_D4.snd"
Sfx_D5_Snd:
		incbin	"sound/sfx_D5.snd"
Sfx_D6_Snd:
		incbin	"sound/sfx_D6.snd"
Sfx_D7_Snd:
		incbin	"sound/sfx_D7.snd"
Sfx_D8_Snd:
		incbin	"sound/sfx_D8.snd"
Sfx_D9_Snd:
		incbin	"sound/sfx_D9.snd"
Sfx_DA_Snd:
		incbin	"sound/sfx_DA.snd"
Sfx_DB_Snd:
		incbin	"sound/sfx_DB.snd"
Sfx_DC_Snd:
		incbin	"sound/sfx_DC.snd"

then delete this:

Music81:	binclude	"sound/music/Mus81 - GHZ.bin"
		even
Music82:	binclude	"sound/music/Mus82 - LZ.bin"
		even
Music83:	binclude	"sound/music/Mus83 - MZ.bin"
		even
Music84:	binclude	"sound/music/Mus84 - SLZ.bin"
		even
Music85:	binclude	"sound/music/Mus85 - SYZ.bin"
		even
Music86:	binclude	"sound/music/Mus86 - SBZ.bin"
		even
Music87:	binclude	"sound/music/Mus87 - Invincibility.bin"
		even
Music88:	binclude	"sound/music/Mus88 - Extra Life.bin"
		even
Music89:	binclude	"sound/music/Mus89 - Special Stage.bin"
		even
Music8A:	binclude	"sound/music/Mus8A - Title Screen.bin"
		even
Music8B:	binclude	"sound/music/Mus8B - Ending.bin"
		even
Music8C:	binclude	"sound/music/Mus8C - Boss.bin"
		even
Music8D:	binclude	"sound/music/Mus8D - FZ.bin"
		even
Music8E:	binclude	"sound/music/Mus8E - Sonic Got Through.bin"
		even
Music8F:	binclude	"sound/music/Mus8F - Game Over.bin"
		even
Music90:	binclude	"sound/music/Mus90 - Continue Screen.bin"
		even
Music91:	binclude	"sound/music/Mus91 - Credits.bin"
		even
Music92:	binclude	"sound/music/Mus92 - Drowning.bin"
		even
Music93:	binclude	"sound/music/Mus93 - Get Emerald.bin"
		even
; ---------------------------------------------------------------------------
; Sound	effect pointers
; ---------------------------------------------------------------------------
SoundIndex:
ptr_sndA0:	dc.l SoundA0
ptr_sndA1:	dc.l SoundA1
ptr_sndA2:	dc.l SoundA2
ptr_sndA3:	dc.l SoundA3
ptr_sndA4:	dc.l SoundA4
ptr_sndA5:	dc.l SoundA5
ptr_sndA6:	dc.l SoundA6
ptr_sndA7:	dc.l SoundA7
ptr_sndA8:	dc.l SoundA8
ptr_sndA9:	dc.l SoundA9
ptr_sndAA:	dc.l SoundAA
ptr_sndAB:	dc.l SoundAB
ptr_sndAC:	dc.l SoundAC
ptr_sndAD:	dc.l SoundAD
ptr_sndAE:	dc.l SoundAE
ptr_sndAF:	dc.l SoundAF
ptr_sndB0:	dc.l SoundB0
ptr_sndB1:	dc.l SoundB1
ptr_sndB2:	dc.l SoundB2
ptr_sndB3:	dc.l SoundB3
ptr_sndB4:	dc.l SoundB4
ptr_sndB5:	dc.l SoundB5
ptr_sndB6:	dc.l SoundB6
ptr_sndB7:	dc.l SoundB7
ptr_sndB8:	dc.l SoundB8
ptr_sndB9:	dc.l SoundB9
ptr_sndBA:	dc.l SoundBA
ptr_sndBB:	dc.l SoundBB
ptr_sndBC:	dc.l SoundBC
ptr_sndBD:	dc.l SoundBD
ptr_sndBE:	dc.l SoundBE
ptr_sndBF:	dc.l SoundBF
ptr_sndC0:	dc.l SoundC0
ptr_sndC1:	dc.l SoundC1
ptr_sndC2:	dc.l SoundC2
ptr_sndC3:	dc.l SoundC3
ptr_sndC4:	dc.l SoundC4
ptr_sndC5:	dc.l SoundC5
ptr_sndC6:	dc.l SoundC6
ptr_sndC7:	dc.l SoundC7
ptr_sndC8:	dc.l SoundC8
ptr_sndC9:	dc.l SoundC9
ptr_sndCA:	dc.l SoundCA
ptr_sndCB:	dc.l SoundCB
ptr_sndCC:	dc.l SoundCC
ptr_sndCD:	dc.l SoundCD
ptr_sndCE:	dc.l SoundCE
ptr_sndCF:	dc.l SoundCF
ptr_sndend
; ---------------------------------------------------------------------------
; Special sound effect pointers
; ---------------------------------------------------------------------------
SpecSoundIndex:
ptr_sndD0:	dc.l SoundD0
ptr_specend
SoundA0:	binclude	"sound/sfx/SndA0 - Jump.bin"
		even
SoundA1:	binclude	"sound/sfx/SndA1 - Lamppost.bin"
		even
SoundA2:	binclude	"sound/sfx/SndA2.bin"
		even
SoundA3:	binclude	"sound/sfx/SndA3 - Death.bin"
		even
SoundA4:	binclude	"sound/sfx/SndA4 - Skid.bin"
		even
SoundA5:	binclude	"sound/sfx/SndA5.bin"
		even
SoundA6:	binclude	"sound/sfx/SndA6 - Hit Spikes.bin"
		even
SoundA7:	binclude	"sound/sfx/SndA7 - Push Block.bin"
		even
SoundA8:	binclude	"sound/sfx/SndA8 - SS Goal.bin"
		even
SoundA9:	binclude	"sound/sfx/SndA9 - SS Item.bin"
		even
SoundAA:	binclude	"sound/sfx/SndAA - Splash.bin"
		even
SoundAB:	binclude	"sound/sfx/SndAB.bin"
		even
SoundAC:	binclude	"sound/sfx/SndAC - Hit Boss.bin"
		even
SoundAD:	binclude	"sound/sfx/SndAD - Get Bubble.bin"
		even
SoundAE:	binclude	"sound/sfx/SndAE - Fireball.bin"
		even
SoundAF:	binclude	"sound/sfx/SndAF - Shield.bin"
		even
SoundB0:	binclude	"sound/sfx/SndB0 - Saw.bin"
		even
SoundB1:	binclude	"sound/sfx/SndB1 - Electric.bin"
		even
SoundB2:	binclude	"sound/sfx/SndB2 - Drown Death.bin"
		even
SoundB3:	binclude	"sound/sfx/SndB3 - Flamethrower.bin"
		even
SoundB4:	binclude	"sound/sfx/SndB4 - Bumper.bin"
		even
SoundB5:	binclude	"sound/sfx/SndB5 - Ring.bin"
		even
SoundB6:	binclude	"sound/sfx/SndB6 - Spikes Move.bin"
		even
SoundB7:	binclude	"sound/sfx/SndB7 - Rumbling.bin"
		even
SoundB8:	binclude	"sound/sfx/SndB8.bin"
		even
SoundB9:	binclude	"sound/sfx/SndB9 - Collapse.bin"
		even
SoundBA:	binclude	"sound/sfx/SndBA - SS Glass.bin"
		even
SoundBB:	binclude	"sound/sfx/SndBB - Door.bin"
		even
SoundBC:	binclude	"sound/sfx/SndBC - Teleport.bin"
		even
SoundBD:	binclude	"sound/sfx/SndBD - ChainStomp.bin"
		even
SoundBE:	binclude	"sound/sfx/SndBE - Roll.bin"
		even
SoundBF:	binclude	"sound/sfx/SndBF - Get Continue.bin"
		even
SoundC0:	binclude	"sound/sfx/SndC0 - Basaran Flap.bin"
		even
SoundC1:	binclude	"sound/sfx/SndC1 - Break Item.bin"
		even
SoundC2:	binclude	"sound/sfx/SndC2 - Drown Warning.bin"
		even
SoundC3:	binclude	"sound/sfx/SndC3 - Giant Ring.bin"
		even
SoundC4:	binclude	"sound/sfx/SndC4 - Bomb.bin"
		even
SoundC5:	binclude	"sound/sfx/SndC5 - Cash Register.bin"
		even
SoundC6:	binclude	"sound/sfx/SndC6 - Ring Loss.bin"
		even
SoundC7:	binclude	"sound/sfx/SndC7 - Chain Rising.bin"
		even
SoundC8:	binclude	"sound/sfx/SndC8 - Burning.bin"
		even
SoundC9:	binclude	"sound/sfx/SndC9 - Hidden Bonus.bin"
		even
SoundCA:	binclude	"sound/sfx/SndCA - Enter SS.bin"
		even
SoundCB:	binclude	"sound/sfx/SndCB - Wall Smash.bin"
		even
SoundCC:	binclude	"sound/sfx/SndCC - Spring.bin"
		even
SoundCD:	binclude	"sound/sfx/SndCD - Switch.bin"
		even
SoundCE:	binclude	"sound/sfx/SndCE - Ring Left Speaker.bin"
		even
SoundCF:	binclude	"sound/sfx/SndCF - Signpost.bin"
		even
SoundD0:	binclude	"sound/sfx/SndD0 - Waterfall.bin"
		even

		cnop ($8000-Size_of_SegaPCM),$8000
SegaPCM:	binclude	"sound/dac/segapcm.bin"
SegaPCM_End
		even

		if SegaPCM_End-SegaPCM>$8000
			fatal "Sega sound must fit within $8000 bytes, but you have a $\{SegaPCM_End-SegaPCM} byte Sega sound."
		endif
		if SegaPCM_End-SegaPCM>Size_of_SegaPCM
			fatal "Size_of_SegaPCM = $\{Size_of_SegaPCM}, but you have a $\{SegaPCM_End-SegaPCM} byte Sega sound."
		endif

the old compressed pcm driver remains until I am sure it is safe to remove.

Driver data files

Then unpack this into the sound folder, and 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)

Summary: /* Replacing 68k driver with new Z80 driver */

This is a minor edit  Watch this page

Please note that all contributions to Sonic Retro may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here. You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Sonic Retro:Copyrights for details). Do not submit copyrighted work without permission!

Save changes Show preview Show changes Cancel | Editing help (opens in new window) Privacy policy | About Sonic Retro | Disclaimers | A Backwards Compatible production=What comes next= More recently, User:Alriightyman has ported Flamewingś sonic & knuckles driver mod to sonic 2 in this post: [1] So I will make a part 2 where we upgrade the sonic 3 driver we installed to that one and have it use sonic 1 samples, music, and sound effects.

notice to admins

Please to not add back the sound fixes I am taking down if you are an admin though because, they will soon be obsolete when part 2 is finished, though moving this to say it is part 1 then editing this notice to reflect the change is fine.

I hope you make good use of this driver and make many great hacks.

Credits

I give credit where it is due:

  • User:Esrael for the original port of the Sonic 3 Driver to Sonic 2 Beta, which I fixed up.
  • User:Tornado for the original guide on SSRG
  • User:Selbi for posting info on most of, but not all the sound test values which I had to finish.
SCHG How-To Guide: Sonic the Hedgehog (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix the SEGA Sound | Display the Press Start Button Text | Fix the Level Select Menu | Fix the Hidden Points Bug | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix the Walk-Jump Bug | Correct Drowning Bugs | Fix the Death Boundary Bug | Fix the Camera Follow Bug | Fix Song Restoration Bugs | Fix the HUD Blinking | Fix the Level Select Graphics Bug | Fix a remember sprite related bug
Changing Design Choices
Change Spike Behavior | Collide with Water After Being Hurt | Fix Special Stage Jumping Physics | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Remove the Speed Cap | Port the REV01 Background Effects | Port Sonic 2's Level Art Loader | Retain Rings Between Acts | Add Sonic 2 (Simon Wai Prototype) Level Select | Improve ObjectMove Subroutines | Port Sonic 2 Level Select
Adding Features
Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor | Add Super Sonic | Add the Air Roll
Sound Features
Expand the Sound Index | Play Different Songs Per Act | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Change The SEGA Sound
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Make Ending Load Alternate Art | Add a New Zone | Set Up the Goggle Monitor | Add New Moves | Add a Dynamic Collision System | Dynamic Special Stage Walls System | Extend Sprite Mappings and Art Limit | Enigma Credits | Use Dynamic Palettes
Miscellaneous
Convert the Hivebrain 2005 Disassembly to ASM68K
Split Disassembly Guides
Set Up a Split Disassembly | Basic Level Editing | Basic Art Editing | Basic ASM Editing (Spin Dash)