Interesting finding in S3, and S3C & S&K protos

Discussion in 'Discussion & Q&A' started by Natsumi, Oct 30, 2016.

  1. Natsumi

    Natsumi Markey's Member

    Joined:
    Oct 7, 2011
    Messages:
    505
    Location:
    Otter's lap
    With tip-off from Jorge, and some help researching, we found a very interesting piece of code inside Sonic 3, and further found there is a lot more to this code than meets the eye in the S3C and S&K protos. This piece of code would activate as the user trap $F, and it would call all kinds of weird routines and codes. We were excited as we thought this may have been used as a debugger and would give some great insight into things, but it turns out a lot of the code is not useful in any way. However, given the nature of it, it is still rather interesting to speculate and see what it could have been used for. As it stands, we really do not know. We have some idea of what code is called and what it does (except some that just leave whatever at dregs or point to data). However, the puzzle pieces really do not fit well. Some codes can be used for obtaining rings, score, changing level or playing music, but the other do some of the most mundane things. I have compiled a list of routines known so far in Sonic 3C 418 beta. Jorge also kindly made a ROM that allows you to call these routines by pressing A while debug mode is active. It will take ring count as the routine number (will multiply by 4), and starting from $FF0000, longword moves data to d0-d5/a0-a5, allowing you to modify the register values for testing. I was able to successfully go to ICZ1 by using this ROM. So far, this is all we know or understand about this. It seems plausible this is used for debugging purpose, but how, why, or when is still unknown to us.

    Any input, speculation and research would be appreciated.
     
    Last edited: Oct 30, 2016
    Calvin, Pacguy, ProjectFM and 6 others like this.
  2. MarkeyJester

    MarkeyJester It takes only one mistake. Member

    Joined:
    Jun 27, 2009
    Messages:
    2,511
    Location:
    Miss Fox's heart~
    Very, very, exciting~ Nice find!

    I haven't looked at it thoroughly (and don't really intend to), but after a quick glimpse, could it not simply be an editor of sorts? There's a lot of object control here, as well as other controls like loading flicky art (i.e. PLC control), if I were to make an in-game editor of sorts, I would like control over being able to load appropriate art and such depending on the area of a zone.

    Speculation of course, but it's what you asked for d=
     
    Pacguy likes this.
  3. Varion Icaria

    Varion Icaria Well-Known Member Member

    Joined:
    Apr 26, 2012
    Messages:
    73
    From what I am gathering, Is that entire thing like a routine index system of Longword pointers? If so I have a theory that the 'NextRoutine' Function wasn't placed in to later development which is when the longword pointer is placed in $34(aX), I would assume what it would do is use some sort of callback to trigger the desired routine as per needed since the routine list you compiled has all the routines in almost same order from the Object Routine code area in the final SK rom, Seeing that though is interesting, Could you get a pastebin of the entire code from the Beta up?