(Original guide by FraGag)
In Sonic 1, spike damage behavior differs from any other Sonic game: when Sonic touches spikes, the game doesn't check if Sonic is invulnerable (he is invulnerable when he flashes). So, if Sonic hits spikes and falls back on spikes again, he dies immediately instead of being temporarily invulnerable.
However, in Sonic 2, this behavior was altered; instead of hurting Sonic regardless of invulnerability status, the game would allow the flashing invulnerability to protect Sonic from further spike damage. This change in behavior is very easy to apply to Sonic 1.
In Hivebrain's Sonic 1 disassembly (andlabs - ASM68K), find the label Obj36_Hurt. Object 36 is the spikes, and Obj36_Hurt checks if Sonic should be hurt or not by the spikes according to his state. This is the original code:
Obj36_Hurt: ; XREF: Obj36_SideWays; Obj36_Upright tst.b ($FFFFFE2D).w ; is Sonic invincible? bne.s Obj36_Display ; if yes, branch move.l a0,-(sp) ...
This code checks if Sonic is invincible (he is invincible when he destroys an invincibility monitor), but not if he is invulnerable. There are only two instructions to add to the code (indicated by +'s in the comments, which you may of course remove):
Obj36_Hurt: ; XREF: Obj36_SideWays; Obj36_Upright tst.b ($FFFFFE2D).w ; is Sonic invincible? bne.s Obj36_Display ; if yes, branch tst.w ($FFFFD030).w ; +++ is Sonic invulnerable? bne.s Obj36_Display ; +++ if yes, branch move.l a0,-(sp) ...
At $FFFFD030 is stored the time left for Sonic's temporary invulnerability. It is set to 120 (2 seconds) as soon as Sonic gets hit, but starts decreasing only when Sonic touches the ground (or another set of spikes!), so even if Sonic falls directly on spikes, he will be invulnerable to them, which is the desired effect.
The svn version of the disassembly splits the objects' code in separate files. The code for the spikes object is located in _incObj\36 Spikes.asm. Locate this:
Spik_Hurt: ; XREF: Spik_SideWays; Spik_Upright tst.b (v_invinc).w ; is Sonic invincible? bne.s Spik_Display ; if yes, branch move.l a0,-(sp)
and replace it with this:
Spik_Hurt: ; XREF: Spik_SideWays; Spik_Upright tst.b (v_invinc).w ; is Sonic invincible? bne.s Spik_Display ; if yes, branch tst.w (v_player+$30).w ; +++ is Sonic invulnerable? bne.s Spik_Display ; +++ if yes, branch move.l a0,-(sp)
|SCHG How-To Guide: Sonic the Hedgehog (16-bit)|
|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|
|Changing Design Choices|
|Change Spike Behavior | 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|
|Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor|
|Expand Music Index From $94 to $9F | Extend Music Slots | Play Different Songs Per Act | Expand Music Index to Start at $00 | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver|
|Extending the Game|
|Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ 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|
|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)|