Tuesday, May 30, 2017

Why does breaking a bunch of S monitors destroy the game?

Because S monitors are just a debug feature.

If you use debug mode to place a lot of Super monitors in one place, and then destroy them all at the same time, things go south pretty quick.


So what exactly is going on? When Sonic turns into Hyper Sonic, the game loads up an extra object to handle the large stars that start flying around him. This object is always loaded to the same RAM address, so there's no chance there'll ever be too many stars flying around.

However, here's the first thing the object does when it's loaded:
Obj_HyperSonic_Stars:
    lea (ArtKosM_HyperSonicStars).l,a1
    move.w  #$F380,d2
    jsr     (Queue_Kos_Module).l
    ...
If that looks familiar, that's because it's a PLC request. This is what the object is saying: "Hey, I know you're busy right now, but as soon as you have some time, I need you to decompress this art file to this address in VRAM. I'll go ahead and add this to your queue so you won't forget."

Every time you pop open a Super monitor, the object starts over, and adds another request to the queue. And another. And another. Until the queue runs over and spills into other bits of RAM, corrupting the game into a hard crash.

This bug never manifests itself during normal play because usually, you can't turn Hyper if you're already Hyper. They could have added an extra check for the sake of debug mode, but they didn't.

Because S monitors are just a debug feature.

5 comments:

  1. Does this also work with Tails and Knuckles?

    In fact, how come Knuckles doesn't shockwave when using an S monitor.

    ReplyDelete
    Replies
    1. It works with Tails, I tried with S3RI, but I don't know about S3&K regular. Also, I'm the same SONIC123CDMANIA+&K(B&ATSA) that made the May 11, 2023 comment.

      Delete
  2. Debug is rather buggy all over, as it happens, though I suspect it's because they expect most people who will use it will mostly act sensibly while using it, and adding all the error correction and constraints to debug mode is likely to waste ROM space, which was always at a premium even in the 16-bit era.

    ReplyDelete
  3. Already, this explaination sounds like a "Dilbert" comic strip; Pointy haired boss keeps piling on assignments to Dilbert, Wally, Alice, etc., expecting them to get it all done.
    "Hey, I know you're busy right now, but as soon as you have some time, I need you to decompress this art file to this address in VRAM. I'll go ahead and add this to your queue so you won't forget."
    Suddenly -
    Dilbert - "Losing conscienceness...,blacking out..." [THUD]
    boss - "Why are there so many lazy people around here?"

    ReplyDelete
  4. SONIC123CDMANIA+&K(B&ATSA)May 11, 2023 at 4:58 PM

    I tried this many times with S3C prototypes, S3&K, & Sonic Delta. I found many varying results.

    1. Crash.
    2. S&K game. It is possible to go back to S3&K.
    3. All emeralds obtained. Don't know how it happened. Has something to do with mashing A, B, & C.
    4. Invalid Sound Test Number. Only in Sonic Delta.

    ReplyDelete