Announcement

Collapse
No announcement yet.

The Legend of Zelda 6502 debugger help needed (NES)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • The Legend of Zelda 6502 debugger help needed (NES)

    Hello. I'm having trouble trying to make a Game Genie code with a 6502 debugger. I can make some codes with it without issue, my problem is with 'starting item' codes.

    Here's a PAR code to begin with a regular arrow: 0659 01

    Using the debugger, I got this:

    748B:99 57 06 STA $0657,Y @ $0659 = #$00

    748B is the address, but I don't know the compare (99?) & data value (?). The only other thing I understand from this is #$00 to tell me I don't have an arrow (and I'd get 01 if I already had it so I know the address is correct).

    Please note that I don't know assembly language, my minimal success with it comes from a few examples over a few documents with trial and error. I will not make extensive use of this to want to take the time to learn assembly. Thanks in advance.
    Last edited by Jingle Bells; 07-16-2013, 04:53:30 PM.

  • #2
    What are you trying to do, or what are you asking for help with? There's not really a question in your post.

    99 57 06 is most likely the machine language/binary that "STA $0657, Y" represents. I don't know 6502 assembly really, but going by what I remember of chips that are close to it, I'd say Y is an index register, and that op code is telling the machine to STore register A at the location indicated by register Y + $0657. So if you look at Y in the register listing, I think it should have a value of 2, unless there's something odd about how the 6502 does indexed mode (or I'm completely off-base about the instruction). The "@ $0659 = #$00" is probably just the debugger helping you out by telling you what the result of the operation will be. It looks like you've traced down the initialization routine, assuming you got this right after starting a new game or the game initializes like this when it loads to the menu every time.

    Edit: If you're trying to make a Game Genie code by overwriting the ROM (PAR can do RAM, but the Game Genie can't, right?), you'd need to get 1 on register A somehow. It's probably cleared to zero somewhere above, but I doubt you can just set it to 1 without unintended consequences. It's possible that another register, say B, is set to 1 for things that should be enabled initially, but you'll have to look. If it is, you can just change the instruction to STB or whatever the heck it is on the 6502.
    Last edited by Pyriel; 07-16-2013, 10:03:34 PM.

    Comment


    • #3
      Here's an example: link

      I'm asking for the compare & data values for the regular arrow, a Game Genie encoder program will do the rest. As for possible unintended consequences, I will know where in the ROM to undo some of the byte changes when I have the Game Genie code.
      Last edited by Jingle Bells; 07-17-2013, 02:04:21 AM.

      Comment


      • #4
        You still haven't really said what you're looking to do clearly. It seems like you're looking for someone to do the work of converting a PAR code for you, so you don't have to learn assembly. You'd probably get there faster by posting a code request. I can't really answer your question without seeing more of the disassembly, and I'm not exactly inclined to find the ROM, the emulator and all that. If somebody already has that handy, you might get lucky and they'll see the thread.

        Your weak link is that 99 is the STA op code. It inherently uses Y as an index register, judging by the really cruddy op code listing I found on that site. So the remaining bytes are just the 0657 offset. I assume you need a code to store 1 there instead, so you either need to change the op code 99, which I guess would be your compare, to a register that has 1 on it, or you need to find an LDA above that and force it to load 1. If the stars align, the LDA will immediately precede your STA, and it will be 7489:A2 00 LDA $01 (based on the poorly detailed listing again). In which case you'd have Address:7489, Compare:00, Data:01.

        The compare and data values aren't anything abstract. It's just whatever is in ROM at the location you need to change. I don't see how you could "know where in ROM to undo some of the byte changes when [you] have the Game Genie code." If the game does:

        LDA $00
        STA $0657, Y ; arrow
        STA $0658, Y ; bombs
        STA $0659, Y ; candle

        And so on, changing that LDA will be a "have all items code", and undoing byte changes, whatever that might mean, won't help.
        Last edited by Pyriel; 07-17-2013, 10:46:27 AM.

        Comment


        • #5
          As I've seen in NES games before, there are routines that will zero a large part of RAM when starting a new game. So, to change the value that's being written, would mean changing the value of a bunch of other addresses, too. That was Pyriel's point, I believe.

          Since the NES GG will only let you alter 3 addresses, the only real solution is to find an instruction that stores a value at that address exclusively... and chances are, there isn't one. You could also look for an instruction that writes a particular value to a different address, and change it to $659, but then that might screw something else up.

          When I get home from work, if I have some time, I may look into this for you.
          Please put all complaints in writing and submit them here.

          Above link not working? Try here.

          Comment


          • #6
            That would be great rimsky82, if you have the time.


            Originally posted by Pyriel View Post
            The compare and data values aren't anything abstract. It's just whatever is in ROM at the location you need to change. I don't see how you could "know where in ROM to undo some of the byte changes when [you] have the Game Genie code." If the game does:

            LDA $00
            STA $0657, Y ; arrow
            STA $0658, Y ; bombs
            STA $0659, Y ; candle

            And so on, changing that LDA will be a "have all items code", and undoing byte changes, whatever that might mean, won't help.
            I see. What I find is that STA $0657 stays the same, it's the digits after Y that are different for every item.

            I wasn't sure if I was providing enough debugging info or not, here's the rest of it (and sorry if anything needs to be shown above the address):

            Comment


            • #7
              I don't really see what I would need in the screenshot, but from what you're saying about the Y register incrementing each time, I'm guessing they didn't unroll the loop, and this is a routine that zeroes a large (or perhaps just the items, but that's still too big) segment of memory. Chances are you won't really be able to alter it to do what you want.

              Comment


              • #8
                Like rimsky said there is no way to change it unless you might set a break on read and open your menu and hopefully there is a break that checks if the item is there or not and alter to make it be there.
                Spoiler Alert! Click to view...

                THE BAD GUY!!!!!!

                Comment

                Working...
                X