Actions

SCHG How-to

Difference between revisions of "SCHG How-to:Port Flamewing's Sonic 3 & Knuckles Sound Driver"

From Sonic Retro

m (text size changed)
(part 3 added, links added)
Line 9: Line 9:
 
First you need the following:
 
First you need the following:
 
*An ASM68K version of Hivebrain's disasm of Sonic 1. You can use the original version: {{file|Sonic 1 (Split and Text by Hivebrain) (ASM68K).zip|Sonic 1 (Split and Text by Hivebrain) (ASM68K)}} or you can use a modified version, such as [[Project Sonic 1: Two-Eight]] (by [[User:MarkeyJester|MarkeyJester]])
 
*An ASM68K version of Hivebrain's disasm of Sonic 1. You can use the original version: {{file|Sonic 1 (Split and Text by Hivebrain) (ASM68K).zip|Sonic 1 (Split and Text by Hivebrain) (ASM68K)}} or you can use a modified version, such as [[Project Sonic 1: Two-Eight]] (by [[User:MarkeyJester|MarkeyJester]])
*Flamewing's Sonic 3 and Knuckles sound driver:  
+
*Flamewing's Sonic 3 and Knuckles sound driver: [https://drive.google.com/file/d/0B652vbap-rpeYTBucFA1aDVtWTQ/view You can get this right here].
 +
*Flamewing's smps2asm Music and SFX Pack: [https://drive.google.com/file/d/0B652vbap-rpeTF81bUlEcnRtN2c/view?usp=sharing You can get this right here]
 +
*A utitily to extract .7 files. I'd Recommend 7Zip.
  
 
==Step 2: Removing the Sonic 1 Sound Driver==
 
==Step 2: Removing the Sonic 1 Sound Driver==
 +
 +
 
==Step 3: Inserting the Sonic 3K Sound Driver==
 
==Step 3: Inserting the Sonic 3K Sound Driver==
 +
After you have removed the Sonic 1 Sound Driver, Locate the SoundDriverLoad Routine.
 +
The routine will look like this:
 +
<syntaxhighlight lang="asm">
 +
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
 +
</syntaxhighlight>
 +
 +
Now, replace this routine with this:
 +
<syntaxhighlight lang="asm">
 +
SoundDriverLoad:            ; XREF: GameClrRAM; TitleScreen
 +
LoadZ80drv:
 +
nop
 +
stopZ80a
 +
resetZ80
 +
lea (RomEndLoc).l,a0
 +
move.l (a0),d0
 +
addq.l #1,d0
 +
movea.l d0,a0
 +
lea ($A00000).l,a1
 +
jsr  KosDec
 +
; lea (DriverResetData).l,a0
 +
; lea ($A01C8A).l,a1 ; z80 ram start of variables (A01C00 in older version)
 +
; move.w #DriverResetDataEnd-DriverResetData,d0
 +
 +
;DriverResetDataLoadLoop:
 +
; move.b (a0)+,(a1)+
 +
; dbf d0,DriverResetDataLoadLoop
 +
btst #0,($C00005).l ; check video mode
 +
sne ($A01C02).l          ; set PAL mode flag
 +
 +
resetZ80a
 +
nop
 +
nop
 +
nop
 +
nop
 +
resetZ80
 +
startZ80
 +
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:
 +
</syntaxhighlight>
 +
 
==Step 4: Modifying Build.bat==
 
==Step 4: Modifying Build.bat==
 
==Step 5: Changing SFX==
 
==Step 5: Changing SFX==

Revision as of 15:04, 12 May 2020

(Original guide by KZG4)

Many people have been using the older Sonic 3 and Knuckles sound driver port made by User:Kram1024 many years ago. I decided to try and port over Flamewing's improved Sonic 3 and Knuckles sound driver so people that intend to port over a Z80 based sound driver will be able to use a newer one.

Note

This guide is meant for a fresh install. I have not made this in order for the user to copy this over a disasm with Port Sonic 3 Sound Driver Part 1 applied onto it. I have not tested it so I have no idea if adding this guide over it will work.

Step 1: Resources

First you need the following:

Step 2: Removing the Sonic 1 Sound Driver

Step 3: Inserting the Sonic 3K Sound Driver

After you have removed the Sonic 1 Sound Driver, Locate the SoundDriverLoad Routine. The routine will look like this:

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

Now, replace this routine with this:

SoundDriverLoad:            ; XREF: GameClrRAM; TitleScreen
LoadZ80drv:
		nop
		stopZ80a
		resetZ80
		lea		(RomEndLoc).l,a0
		move.l	(a0),d0
		addq.l	#1,d0
		movea.l	d0,a0
		lea	($A00000).l,a1
		jsr   KosDec
; 		lea	(DriverResetData).l,a0
;		lea	($A01C8A).l,a1									; z80 ram start of variables (A01C00 in older version)
;		move.w	#DriverResetDataEnd-DriverResetData,d0
 
;DriverResetDataLoadLoop:
;		move.b	(a0)+,(a1)+
;		dbf	d0,DriverResetDataLoadLoop
	btst	#0,($C00005).l	; check video mode
		sne		($A01C02).l          					; set PAL mode flag 

		resetZ80a
		nop
		nop	
		nop	
		nop	
		resetZ80
		startZ80
		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:

Step 4: Modifying Build.bat

Step 5: Changing SFX

Step 6: Fixing Music

Known Issues

Some of the Known Issues with this guide are:

  • Pushing SFX is broken
  • Point SFX is broken
  • tba

Conclusion