How to set up the Goggle monitor, to work with it

Discussion in 'Tutorials Archive' started by Selbi, Feb 19, 2009.

Thread Status:
Not open for further replies.
  1. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    How to set up the Goggle monitor, to work with it


    Mirror: http://sonicsanctuary.digibase.ca/index.php?showtopic=182


    Did you know, that there are 2 unused monitors in Sonic 1? The 'S' and 'Goggle' monitors. You can destroy them, but nothing will happen. In the Split is under "Obj2E_ChkS:" the code for the S monitor. But there is no code for the Goggle monitor! If you want to work with it, add a special code. In this guide I will show you how to do this. It's pretty self explanatory, but if you have any questions ask away in this topic!


    Here we go:


    Quick guide


    I know there are many people who just want to rip off the code without learning. For those people I took the time to make a simple copy/paste guide:


    Search for Obj2E_ChkS and replace everything from there with this:



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    nop


    Obj2E_ChkGoggles:


    cmpi.b #8,d0 ; does monitor contain Goggles?


    bne.s Obj2E_ChkEnd ; if not, branch to ChkEnd


    nop



    That was everything.


    If you are too dumb to add this, then fuck off, because you weren't reading the real guide.


    Extended guide


    This version tells you very well explained how to do this. It's not more than what you can see in the quick version, but with the extended guide you can learn something, so this one is recommended.


    1: First off, open "sonic1.asm" and go to the Routine for the monitor contents (Obj2E). Scroll down until you see this:



    .
    .


    .


    Obj2E_RingSound:


    move.w #$B5,d0


    jmp (PlaySound).l ; play ring sound


    ; ===========================================================================


    Obj2E_ChkS:


    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkEnd


    nop


    Obj2E_ChkEnd:


    rts ; 'S' and Goggles monitors do nothing


    ; ===========================================================================


    Obj2E_Delete: ; XREF: Obj2E_Index


    subq.w #1,$1E(a0)


    bmi.w DeleteObject


    rts



    2: As you can see, there is no Goggle Code. But there is code that checks if the monitor contains 'S'. However, you can open SonED2 and add a new monitor. Scroll through the different monitors, and you will see, in Obj2E are the monitors in the same order as in SonED 2. The Goggle monitor is the last monitor in this list. This means: You have to add your new code under the code for the S.


    3: Before Obj2E_ChkEnd add a new label, for example "Obj2E_ChkGoggles:":



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkEnd


    nop


    Obj2E_ChkGoggles:


    Obj2E_ChkEnd:


    rts ; 'S' and Goggles monitors do nothing



    4: In ChkS is a code to branch to ChkEnd. Scroll up and you will see, there is in every monitor a code like this, but instead of branching to ChkEnd, they are branching to the next monitor code. So do the same with the S code. Change "bne.s Obj2E_ChkEnd" to "bne.s Obj2E_ChkGoggles":



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    nop


    Obj2E_ChkGoggles:


    Obj2E_ChkEnd:


    rts ; 'S' and Goggles monitors do nothing



    5: Okay, we've set a few things up, but we are not done yet. Maybe you've noticed, there are 2 lines in each monitor at the beginning (a 'cmpi.b' code and a 'bne.s' code). This is a check, to look, which monitor was destroyed. So copy any of these 2 lines to your "Obj2E_ChkGoggles:" label. I'm using the lines of ChkS:



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    nop


    Obj2E_ChkGoggles:


    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    Obj2E_ChkEnd:


    rts ; 'S' and Goggles monitors do nothing



    6: As you can see, this can't work, because they are checking for the same things! Look up again. Every monitor has a higher number in the cmpi command. The number in S was 7. So what is the next number? 8 of course! So change the 7 to 8 in your Goggle code:



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    nop


    Obj2E_ChkGoggles:


    cmpi.b #8,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    Obj2E_ChkEnd:


    rts ; 'S' and Goggles monitors do nothing



    7: We are nearly done. The last thing we have to do is to change the bne command in your Goggle code to ChkEnd. Like this:



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    nop


    Obj2E_ChkGoggles:


    cmpi.b #8,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkEnd ; if not, branch to Goggle code


    Obj2E_ChkEnd:


    rts ; 'S' and Goggles monitors do nothing



    8: Now we are done, and you can insert coding in your Goggle monitor. But if you don't wanna add code for now, you have to add a "nop" under the bne.s command. Also, you should change the comments, because they are really misleading. Here is my code:



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    bne.s Obj2E_ChkGoggles ; if not, branch to Goggle code


    nop


    Obj2E_ChkGoggles:


    cmpi.b #8,d0 ; does monitor contain Goggles?


    bne.s Obj2E_ChkEnd ; if not, branch to ChkEnd


    nop


    Obj2E_ChkEnd:


    rts



    And now your code should be perfect.


    ------------------------------------------------------------------------------------------


    Example Code


    Although our code is perfect, the Goggle monitor is still doing nothing when you destroy it. So let's add a simple code, to give you infinite air in LZ!


    Go to the Goggle code and add a line, which is moving $1 to a adress:



    move.b #1,($FFFFFFFB).w ; move 1 to the goggle check



    It should look like this:



    .
    .


    .


    nop


    Obj2E_ChkGoggles:


    cmpi.b #8,d0 ; does monitor contain Goggles?


    bne.s Obj2E_ChkEnd ; if not, branch to ChkEnd


    move.b #1,($FFFFFFFB).w ; move 1 to the goggle check


    Obj2E_ChkEnd:


    .


    .


    .



    Next go to to "Obj0A_ReduceAir:" and add these 2 lines right after the label:



    cmpi.b #1,($FFFFFFFB).w ; was a goggle monitor broken?
    beq Obj0A_GoMakeItem ; if yes, branch



    It should look like this:



    Obj0A_ReduceAir:
    cmpi.b #1,($FFFFFFFB).w ; was a goggle monitor broken?


    beq Obj0A_GoMakeItem ; if yes, branch


    .


    .


    .



    This is not a perfect code, because you will always have infinite time underwater, once destroyed the monitor, but it works!


    ------------------------------------------------------------------------------------------


    I hope this was a good guide, with good explaining. Of course it was not perfect, but much better than my other guides (for me). If there is something, you can't understand, reply to this (as I said on the top)!


    Credits:


    Me (Selbi) for everything (coding, guide)


    Thanks to:


    SonicVaan, we talked about this monitor, which inspirted me to this guide =P


    Irixion, for posting it on Sonic Sanctuary and fixing spelling mistakes :cow:


    Version:


    v1.1.4.1.4 ("Goggle", not "Google" xD, some fixes, example guide, spelling corrections (thanks to Irixion))
     
    Last edited by a moderator: Aug 12, 2009
  2. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,570
    Hey, I tried your Google monitor and it couldn't find anything. It kept on giving an illegal instuction with "COULDN'T FIND ANYTHING".


    No wonder, there's no code. It just displays a Goggles monitor.


    Also for lulz:


    [​IMG]
     
    Last edited by a moderator: Feb 19, 2009
  3. SonicVaan

    SonicVaan I'm a cyberpunk with a taste for guns Member

    Joined:
    Sep 12, 2008
    Messages:
    456
    Location:
    Germany, Cologne
    Haha! Google? I first thought you mean a website monitor. You sure mean "goggle".


    And yeah, I'll try this code. :cow:
     
  4. Malevolence

    Malevolence Well-Known Member Member

    Joined:
    Jul 29, 2008
    Messages:
    97
    No offense, but do you realize Google is a search engine and goggle is the eye-wear? Also, out of curiosity, do you plan to show how to add the code to display the correct animations for sonic/have an infinite amount of air underwater?
     
    Last edited by a moderator: Feb 19, 2009
  5. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Ok, first off: OMG xD! Well, I thought Goggle is the wrong word and the Search engine is just named after the things for the eyes! However, fixed it. Second thing, oh, I've forgotten to add a nop... also fixed. And the last thing: I guess there is a simple code to give sonic unlimited time underwater. As for the animations, where are they stored? I know there are some goggles, but where is a file with them?


    EDIT: Infinte air underwater is easy. Here is what you have to do:


    Go to the Goggle code and add a line, which is moving a #1 to a adress:



    Obj2E_ChkGoggles:
    cmpi.b #8,d0 ; does monitor contain Goggles?


    bne.s Obj2E_ChkEnd ; if not, branch to ChkEnd


    -> move.b #1,($FFFFFFFB).w ; move 1 to the goggle check



    Next go to to "Obj0A_ReduceAir:" and add these 2 lines right after the label:



    cmpi.b #1,($FFFFFFFB).w ; was a goggle monitor broken?
    beq Obj0A_GoMakeItem ; if yes, branch



    This is not a perfect code, because you will always have infinite time underwater, once you've destroyed it, but it works!
     
    Last edited by a moderator: Feb 20, 2009
  6. c1owd

    c1owd Previously 'CarrascoZX0' Member

    Joined:
    Dec 13, 2008
    Messages:
    364
    Nice guide Selbi! Too bad you already did it for me... xD
     
  7. shadowbeasts

    shadowbeasts I'm Legend Member

    Joined:
    Jan 5, 2009
    Messages:
    286
    Location:
    Good 'ol USA.
    It works but does anyone know why It gives me debug mode? I think it's because I used level select but I didn't do the debug code.
     
  8. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Debug mode is stored in the RAM adress $FFFFFFFA. If you added the special infinite air code, there are maybe some problems with the adress $FFFFFFFB. Not many differences. But I didn't get this error. Maybe you added a few codes, to enable the Debug Mode... however, you can try it on a clean split to test it. If there is no problem, but still in your hacking split, PM me to fix it.
     
  9. Ollie

    Ollie Well-Known Member Member

    Joined:
    Feb 7, 2009
    Messages:
    119
    Location:
    Stoke-On-Trent, England, UK
    I have a few questions since I haven't tested this guide. I'm interested what it actually does, is it the equivalent to a Bubble or does it just allow you to breathe underwater for as long as you want?


    Also, how about trying to add the unused goggles art?
     
  10. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Before you ask questions like that, read the entire topic! ;) It's just a guide to set up the goggle monitor code. There is no code for that, so I created a very well explained guide to add this (for newbies of course). As for the air, do you mean this? If yes, once destroyed a monitor, you will always have infinite air (also in other Acts). It's just an example, not the super killer code! ;)
     
    Last edited by a moderator: Feb 21, 2009
  11. Ollie

    Ollie Well-Known Member Member

    Joined:
    Feb 7, 2009
    Messages:
    119
    Location:
    Stoke-On-Trent, England, UK
    Ah sorry, I was just quickly browsing through and didn't quite understand what it actually did, since there are many ways which you could make the goggles monitor, I've seen people just wanting it to act like an air bubble, etc. That's all.
     
  12. bareirito

    bareirito Well-Known Member Member

    Joined:
    Nov 17, 2008
    Messages:
    87
    Location:
    Argentina
    Thanks for the tutorial it helped me so much.
     
  13. shadowbeasts

    shadowbeasts I'm Legend Member

    Joined:
    Jan 5, 2009
    Messages:
    286
    Location:
    Good 'ol USA.
    I finally got around to testing with a clean split but I still get the same problem I even tried disabling debug so I'll PM you the clean ASM with the goggle code added and my hacking ASM because I get debug in both. Just found out you can't be PMed
     
    Last edited by a moderator: Mar 8, 2009
  14. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    Well duh, he's banned. He can't do anything, really.
     
  15. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Actually Selbi was unbanned earlier today
     
  16. Qjimbo

    Qjimbo Well-Known Member Member

    Joined:
    Feb 27, 2008
    Messages:
    850
    Location:
    Vancouver, BC
    Just now actually, when DalekSam made the post he was still banned.
     
  17. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Yes, I'm unbanned! :)


    Split please. I'm talking to shadowbeasts in PM.
     
  18. shadowbeasts

    shadowbeasts I'm Legend Member

    Joined:
    Jan 5, 2009
    Messages:
    286
    Location:
    Good 'ol USA.
    PMed.
     
    Last edited by a moderator: Mar 10, 2009
  19. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Your problem is very simple. I don't know why, but the problem is the adress $FFFFFFFB. So, just redo the simple code, but replace the $FFFFFFFB with another UNUSED adress (like $FFFFFFE9). This should work without enabling Debug.
     
  20. shadowbeasts

    shadowbeasts I'm Legend Member

    Joined:
    Jan 5, 2009
    Messages:
    286
    Location:
    Good 'ol USA.
    Yep that fixed it. Thanks
     
Thread Status:
Not open for further replies.