Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding REV02 ROM option

  • Loading branch information...
commit d2db0e23d6cd455c3e13879362ccfd36fea7c241 1 parent 7c4aca4
@Clownacy Clownacy authored
View
19 chkbitperfect.rev02.bat
@@ -0,0 +1,19 @@
+@ECHO OFF
+
+REM // build the ROM
+call build %1
+
+REM // run fc against a Sonic 2 Rev 02 ROM, extracted from Sonic Compilation
+echo -------------------------------------------------------------
+IF EXIST s2built.bin ( fc /b s2built.bin s2rev02.bin
+) ELSE echo s2built.bin does not exist, probably due to an assembly error
+
+REM // clean up after us
+IF EXIST s2.p del s2.p
+IF EXIST s2.h del s2.h
+IF EXIST s2built.bin del s2built.bin
+IF EXIST s2built.prev.bin del s2built.prev.bin
+IF EXIST s2.log ( IF "%1"=="-pe" del s2.log )
+
+REM // if someone ran this from Windows Explorer, prevent the window from disappearing immediately
+pause
View
BIN  mappings/sprite/Rings (REV02).bin
Binary file not shown
View
BIN  mappings/sprite/obj3B (REV02).bin
Binary file not shown
View
BIN  mappings/sprite/obj4A (REV02).bin
Binary file not shown
View
BIN  mappings/sprite/obj4B (REV02).bin
Binary file not shown
View
BIN  mappings/sprite/obj52_b (REV02).bin
Binary file not shown
View
BIN  mappings/sprite/obj54 (REV02).bin
Binary file not shown
View
BIN  mappings/sprite/obj5C (REV02).bin
Binary file not shown
View
6,062 s2.asm
3,414 additions, 2,648 deletions not shown
View
28 s2.constants.asm
@@ -1109,7 +1109,7 @@ Dynamic_Resize_Routine: ds.b 1
ds.b 2 ; $FFFFEEE0-$FFFFEEE1
Camera_BG_X_offset: ds.w 1 ; Used to control background scrolling in X in WFZ ending and HTZ screen shake
Camera_BG_Y_offset: ds.w 1 ; Used to control background scrolling in Y in WFZ ending and HTZ screen shake
-HTZ_Terrain_Delay: ds.w 1 ; During HTZ screen shake, this is a delay between rising and sinking terrain during which there is no shaking
+HTZ_Terrain_Delay: ds.w 1 ; During HTZ screen shake, this is a delay between rising and sinking terrain during which there is no shaking
HTZ_Terrain_Direction: ds.b 1 ; During HTZ screen shake, 0 if terrain/lava is rising, 1 if lowering
ds.b 3 ; $FFFFEEE9-$FFFFEEEB ; seems unused
Vscroll_Factor_P2_HInt: ds.l 1
@@ -1207,7 +1207,7 @@ Ending_PalCycle_flag: ds.b 1
SegaScr_VInt_Subrout:
Ending_VInt_Subrout:
-WFZ_BG_Y_Speed: ds.w 1
+WFZ_BG_Y_Speed: ds.w 1
ds.w 1 ; $FFFFF664-$FFFFF665 ; seems unused
PalCycle_Timer2: ds.w 1
PalCycle_Timer3: ds.w 1
@@ -1528,6 +1528,9 @@ SlotMachine_Slot2Rout: ds.b 1
SlotMachine_Slot3Pos: ds.w 1
SlotMachine_Slot3Speed: ds.b 1
SlotMachine_Slot3Rout: ds.b 1
+
+ if gameRevision<2
+ ; These are only here in REV00 and REV01
ds.b $10 ; $FFFFFF60-$FFFFFF6F ; seems unused
Player_mode: ds.w 1 ; 0 = Sonic and Tails, 1 = Sonic, 2 = Tails
@@ -1535,6 +1538,8 @@ Player_option: ds.w 1 ; 0 = Sonic and Tails, 1 = Sonic, 2 = Tails
Two_player_items: ds.w 1
ds.b $A ; $FFFFFF76-$FFFFFF7F ; seems unused
+ endif
+
LevSel_HoldTimer: ds.w 1
Level_select_zone: ds.w 1
Sound_test_sound: ds.w 1
@@ -1551,7 +1556,18 @@ Level_Music: ds.w 1
Bonus_Countdown_3: ds.w 1
ds.b 4 ; $FFFFFF94-$FFFFFF97 ; seems unused
Game_Over_2P: ds.w 1
+
+ if gameRevision<2
+ ; Unused in REV00/REV01
ds.b 6 ; $FFFFFF9A-$FFFFFF9F ; seems unused
+ else
+ ; Used by these relocated variables in REV02
+Player_mode: ds.w 1 ; 0 = Sonic and Tails, 1 = Sonic, 2 = Tails
+Player_option: ds.w 1 ; 0 = Sonic and Tails, 1 = Sonic, 2 = Tails
+
+Two_player_items: ds.w 1
+ endif
+
SS2p_RingBuffer: ds.w 6
ds.b 4 ; $FFFFFFAC-$FFFFFFAF ; seems unused
Got_Emerald: ds.b 1
@@ -1593,6 +1609,14 @@ Ending_demo_number: ds.w 1 ; zone for the ending demos (2 bytes, unused)
Graphics_Flags: ds.w 1 ; misc. bitfield
Debug_mode_flag: ds.w 1 ; (2 bytes)
Checksum_fourcc: ds.l 1 ; (4 bytes)
+
+ if gameRevision=2
+ ; Might have been used by Sonic Compilation
+ ds.b 4 ; unused
+unk_FFE4: ds.l 1 ; has 'SEGA' written to it
+ ds.b $18 ; unused
+ endif
+
RAM_End
if * > 0 ; Don't declare more space than the RAM can contain!
View
63 s2.macrosetup.asm
@@ -202,3 +202,66 @@ _tst macro
endm
endif
+
+ ; in REV02, almost all possible add/sub optimizations were made.
+ ; this toggle allows you to have them in any revision
+ if addsubOptimize
+ ; if addsubOptimize, optimize these
+addi_ macro
+ !addq.ATTRIBUTE ALLARGS
+ endm
+subi_ macro
+ !subq.ATTRIBUTE ALLARGS
+ endm
+adda_ macro
+ !addq.ATTRIBUTE ALLARGS
+ endm
+
+ else
+
+ ; otherwise, leave them unoptimized
+addi_ macro
+ !addi.ATTRIBUTE ALLARGS
+ endm
+subi_ macro
+ !subi.ATTRIBUTE ALLARGS
+ endm
+adda_ macro
+ !adda.ATTRIBUTE ALLARGS
+ endm
+
+ endif
+
+; depending on if relativeLea is set or not, this will create a pc-relative lea or an absolute long lea.
+lea_ macro address,reg
+ if relativeLea
+ !lea address(pc),reg
+ else
+ !lea (address).l,reg
+ endif
+ endm
+
+ ; this even will only exist in REV02 (unnecessary)
+rev02even macro
+ if gameRevision=2
+ even
+ endif
+ endm
+
+ ; depending on if removeJmpTos is set or not, these macros will create a jump directly
+ ; to the destination, or create a branch to a JmpTo
+jsrto macro direct, indirect
+ if removeJmpTos
+ !jsr direct ; jump directly to address
+ else
+ !bsr.w indirect ; otherwise, branch to an indirect JmpTo
+ endif
+ endm
+
+jmpto macro direct, indirect
+ if removeJmpTos
+ !jmp direct ; jump directly to address
+ else
+ !bra.w indirect ; otherwise, branch to an indirect JmpTo
+ endif
+ endm
View
BIN  s2rev02.bin
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.