Streamlined init code for Sonic the Hedgehog 1, 2, and 3 & Knuckles made by OrionNavattan (under BSD Zero Clause).
The code targets SonicRetro's disassemblies, S1 Hivebrain 2022, and Sonic 2 OrnNv.
These are intended as drop-in replacements for the standard ICDBLK_4 library, and the game-specific init code that immediately follows. Compared to the original, these are streamlined, eliminating all redundancy (particularly on cold boot) and in-lining the VDP and joypad init, Z80 code load, and the checksum check (which is easy to remove!)
- Replace everything from
EntryPointtoMainGameLoopwith the contents ofStreamlined Sonic 1 Init AS.asm. - Find GM_Title and delete the
bsr.w SoundDriverLoadsix lines into that routine. - Delete
CheckSumError,VDPSetupGame,JoypadInit, andSoundDriverLoad, as all of their functionality is incorporated into the new init code.
- Replace the
Mega Drive Setup.asminclude and all code fromGameProgramtoMainGameLoopwith the contents ofStreamlined Sonic 1 Init HB 2022.asm. - Delete the same instruction and subroutines, except that
SoundDriverLoadis namedDacDriverLoadinstead.
- Replace everything from
EntryPointtoMainGameLoopwith the contents ofStreamlined Sonic 2 Init AS.asm. - Delete
CheckSumError,VDPSetupGame,JoypadInit,SoundDriverLoad, andDecompressSoundDriverup to theSaxDec_Looplabel, as all of their functionality is incorporated into the new init code. (If you fail to do this, you will get a duplicate label/multiply defined error for movewZ80CompSize.
- Essentially the same as Sonic 2 AS, except the file you need is
Streamlined Sonic 2 Init Orion.asm.
- Replace everything from
EntryPointup toTest_CountryCode(if you want to keep it) with the contents ofStreamlined Sonic 3K Init AS.asm, uncommenting the Sonic 3 specific portion - (if you're keeping region locking) Replace the branch from
Test_Checksumafter line 1 ofloc_330toGameLoop - Delete the entirety of
Test_Checksum, and
lea ($FF0000).l,a6
moveq #0,d7
move.w #$3F7F,d6
loc_716:
move.l d7,(a6)+
dbf d6,loc_716
1 line after Test_Checksum_Done
- Delete
Init_VDP,SndDrvInit,Init_Controllersand remove their branches.
- Replace everything from
EntryPointup toTest_LockOnwith the contents ofStreamlined Sonic 3K Init AS.asm - Delete
Test_Checksum, the branches to it, and remove the first 15 lines ofTest_LockOn - Delete
Init_VDP,SndDrvInit,Init_Controllersand their branches inBlueSpheresStartupandSonicAndKnucklesStartup.