11 March 2016 - Forum Rules

Main Menu

Basic ASM edits in Sonic 1

Started by MopeDude-CD, June 05, 2017, 09:50:11 AM

Previous topic - Next topic


Another tutorial?
Yes, I am doing another tutorial. This is going to be a series, as suggested by a friend.

But I don't know any ASM!
Well, you may want to refer to MarkeyJester's ASM guide. This guide is easy to follow, and I learned some basic ASM with this. If you already know ASM, you may want to read this as a reference.  :thumbsup:

And this guide is for?
Small tweaks in Sonic 1 to make your hack stand out.

The actual guide
Special Stage rotation speed:
Did you ever want the Special Stage to rotate slower, faster, or not even rotate at all? Well, you're in luck! How?

Go to the label SS_ClrNemRam. You will see this:
move.l d0,(a1)+
dbf d1,SS_ClrNemRam ; clear Nemesis buffer

clr.b ($FFFFF64E).w
clr.w ($FFFFFE02).w
moveq #$A,d0
bsr.w PalLoad1 ; load special stage pallet
jsr SS_Load
move.l #0,($FFFFF700).w
move.l #0,($FFFFF704).w
move.b #9,($FFFFD000).w ; load special stage Sonic object
bsr.w PalCycle_SS
clr.w ($FFFFF780).w ; set stage angle to "upright"
move.w #$40,($FFFFF782).w ; set stage rotation speed
move.w #$89,d0
bsr.w PlaySound ; play special stage BG music
move.w #0,($FFFFF790).w
lea (Demo_Index).l,a1
moveq #6,d0
lsl.w #2,d0
movea.l (a1,d0.w),a1
move.b 1(a1),($FFFFF792).w
subq.b #1,($FFFFF792).w
clr.w ($FFFFFE20).w
clr.b ($FFFFFE1B).w
move.w #0,($FFFFFE08).w
move.w #1800,($FFFFF614).w
tst.b ($FFFFFFE2).w ; has debug cheat been entered?
beq.s SS_NoDebug ; if not, branch
btst #6,($FFFFF604).w ; is A button pressed?
beq.s SS_NoDebug ; if not, branch
move.b #1,($FFFFFFFA).w ; enable debug mode

When you see this code, replace 40 (In hexadecimal) with your preferred rotation speed. (Lower number is slower, higher number is faster.)
This Code
move.w #$40,($FFFFF782).w ; set stage rotation speed

Speed Shoes? Not fast enough!
The name says it all!
Go to the label Obj2E_ChkShoes, and you will see this:

cmpi.b #3,d0 ; does monitor contain speed shoes?
bne.s Obj2E_ChkShield
move.b #1,($FFFFFE2E).w ; speed up the BG music
move.w #$4B0,($FFFFD034).w ; time limit for the power-up
move.w #$C00,($FFFFF760).w ; change Sonic's top speed
move.w #$18,($FFFFF762).w
move.w #$80,($FFFFF764).w
move.w #$E2,d0
jmp (PlaySound).l ; Speed up the music

Now, we can do so many things here! We can change the time limit for the powerup, make Sonic go faster, or just annoy the player by slowing it down. Now we can call them "Slow Shoes"! Just change the numbers, and enjoy!


While I am happy to see something cover how to apply it I find the bigger problem for most is finding the thing in the first place. That said if you are dealing with a reasonably well commented and understood game that could be less of an issue.
Not to mention in this case I would probably reduce this to a hex edit and teach people to leave the magic bits alone and just touch the speed values (assuming you are staying within parameters), though again if your goal is to teach people the final stages of tool use then so it goes.


Fortunately, the sonic games are well documented and have multiple disassemblies to work with.