Announcement

Collapse
No announcement yet.

Learning 6502 Assembly

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

  • Learning 6502 Assembly

    I'm trying to create gamegenie codes for the NES.
    I followed this tutorial.
    http://www.angelfire.com/games2/code...gerGGcodes.txt

    Now I'm trying to create an infinite health code for willow for some more practice.
    Infinite Energy 00007B FF

    I believe I got the code right, but it's hard to tell at this point
    F459 99 EA (XTSNPKOO)
    It says EA can be used to see if it does anything. It made my game reset when I get hit. So I assume the beginning is right. If so, how do I figure out what to change that EA to?
    Anyone got some advice.

  • #2
    EA is a NOP instruction - a single NOP is not going to be much use for cheats as you will need 2 or 3 NOPs for pretty much all cheats. Apart from needing more codes, NOPs are a bad idea as they can seriously bugger up branches in certain conditions

    In this instance you will probably need to change the 99 (STA ADDR,Y) to B9 ( LDA ADDR,Y)

    So the code should be F459?99:B9 (OLSNPKOO)
    Last edited by Pugsy; 02-02-2010, 07:30:44 PM.
    Pugsy's MAME Cheat Page : http://mamecheat.co.uk

    Comment


    • #3
      The code works.
      How did you figure out it was B9?

      It's ok if it bugs it up, it lets me know I have the rest of it working right.

      Comment


      • #4
        Found another tutorial
        http://desnet.kodewerx.org/doc/fceud_tutor1.txt
        and a reference
        http://www.obelisk.demon.co.uk/6502/reference.html

        Unfortunately that tutorial's method is not matching up with my next test.
        (boy and his blob)I'm trying to have the boy jump really high or low.
        In the Metroid tutorial they did it by searching the change of the Y position.
        So I did some searching and found out the boy's Y position address.
        0054 - Ypos

        So I entered that into the debugger and got this.
        b721: 85 54 STA 54

        In the tutorial it looked at the lines above but the methods do not match.
        So did I do everything right so far? Is searching a Y value not always the answer?

        Please do not give me the actual code, I'll never learn like that. Unless if you want to tell me exactly how you got it.

        edit: After I stepped on the trampoline, I hit run and got a different code.
        a76b: 95 54 STA $54,X @0054
        So is either correct?
        Last edited by Retrocheats; 02-03-2010, 10:54:36 AM.

        Comment


        • #5
          Originally posted by KingOfHeart View Post
          The code works.
          How did you figure out it was B9?
          Simple infinite like codes can always be achieved by replacing a Store, Decrement or Increment opcode with the equivalent Load opcodes.

          Look at this table:
          http://www.masswerk.at/6502/6502_instruction_set.html

          So say the address you have a CE at the address ZZZZ, looking it up in the table you can see that CE = "DEC abs" so to stop that happening you need to change it to "LDA abs" and if you look at the table you will see that AD = "LDA abs".
          Alternatively if you have 8D at the address ZZZZ, so 8D = "STA abs" and so "LDA abs" (AD) will work for that too.
          Last edited by Pugsy; 02-03-2010, 01:06:08 PM. Reason: Not reading everything properly
          Pugsy's MAME Cheat Page : http://mamecheat.co.uk

          Comment


          • #6
            Without looking at the game I can't say for sure what the problem is, but if you are trying to make a higher jump code you need to find the Y position during the jump rather than the Y position of the boy on the screen - the two are normally mutually exclusive.
            Pugsy's MAME Cheat Page : http://mamecheat.co.uk

            Comment


            • #7
              What's the best way to find this value?
              For finding the Y value I usually do a search and check to see if the value has deceased/increased.
              Now you say I can't get the boy's Y, because that's most likely the address I'll get in this case.

              Comment


              • #8
                Well the best way is to start the jump, pause the game/emulator quickly so that the jump height is still low and you are going upwards. Unpause and repause quickly so that the height has increased continue the search and repeat to you find the address/location.

                Personally for such cheats I know that the height will have changed by the next frame so in MESS (my console emulator of choice) I merely have to type 'gv' to goto the next frame and continue the searches that way as pausing and unpausing is not very scientific and takes longer to find the address.
                Pugsy's MAME Cheat Page : http://mamecheat.co.uk

                Comment


                • #9
                  That pausing method worked because I got a new value. When I set the value to 255 the boy jumped really high. Now I just need to get it to a gamegenie code.

                  007b
                  This gives me two outputs.
                  1. b785: 85 7B STA 7B (as soon as the boy is ready to jump)
                  2. b743: C6 7B DEC $7B @007b = $06

                  Now if I understand right. The first one stores the value. Which most likely sets the max height.
                  The second one I'm not 100% sure. It looks like it's telling it to decrease the value but why doesn't this run the whole time.

                  So what's the next step.

                  Comment


                  • #10
                    I'm guessing here but I'd look at the lda previous to b785 sta $7b. If you change the value that is lda'd then there's a decent chance the jump height will be altered too.
                    The DEC $7B bit I'd guess is either the decrement that is used to go upwards or downwards during the jump.
                    Last edited by Pugsy; 02-03-2010, 06:31:12 PM.
                    Pugsy's MAME Cheat Page : http://mamecheat.co.uk

                    Comment


                    • #11
                      I'll get back to this code soon.

                      http://thegshi.org/?s=v2&sys=5&gid=3515

                      Can you help me create some level codes for this game?
                      This time give me the answer but tell me how you got this code.

                      edit: Hmm, don't even know what to do for values.
                      00006D 18
                      18 is for level 6-3.
                      I used the debugger and got this info when it switched from level 1-1 to 1-2.
                      e8ab: 86 6d STX $6D
                      Last edited by Retrocheats; 02-05-2010, 08:55:39 PM.

                      Comment


                      • #12
                        So can anyone help me with this. At least tell me what I should be looking for

                        Comment


                        • #13
                          No one can help?
                          How many tutorials are on 6502?
                          I feel like I'm lost in a maze in the dark, and I don't have a map to show me the way out.

                          Comment


                          • #14
                            Originally posted by KingOfHeart View Post
                            No one can help?
                            How many tutorials are on 6502?
                            I feel like I'm lost in a maze in the dark, and I don't have a map to show me the way out.
                            For the record, it takes time/effort to post replies and an occasional thanks in follow-up posts shows people are not just wasting their time.

                            There are several guides/books/tutorials you can find with google, here are two that look like they may help in obtaining some basic understanding

                            assembly primer:-
                            http://www.atariarchives.org/mlb/


                            6502 book (ignore the bits on sweet-16)
                            http://www.scribd.com/doc/2429815/Us...-by-Randy-Hyde
                            Pugsy's MAME Cheat Page : http://mamecheat.co.uk

                            Comment


                            • #15
                              This may help too:

                              http://www.llx.com/~nparker/a2/opcodes.html
                              I only hack games that I like >:I
                              And I ONLY use assembly O_o XD

                              Comment

                              Working...
                              X