Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Learning 6502 Assembly

  1. #1
    Join Date
    Feb 2010
    Posts
    21

    Question 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. #2
    Join Date
    Oct 2005
    Location
    Cymru
    Posts
    205

    Default

    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 at 06:30:44 PM.
    Pugsy's MAME Cheat Page : http://mamecheat.co.uk

  3. #3
    Join Date
    Feb 2010
    Posts
    21

    Default

    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.

  4. #4
    Join Date
    Feb 2010
    Posts
    21

    Default

    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 KingOfHeart; 02-03-2010 at 09:54:36 AM.

  5. #5
    Join Date
    Oct 2005
    Location
    Cymru
    Posts
    205

    Default

    Quote 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 at 12:06:08 PM. Reason: Not reading everything properly
    Pugsy's MAME Cheat Page : http://mamecheat.co.uk

  6. #6
    Join Date
    Oct 2005
    Location
    Cymru
    Posts
    205

    Default

    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

  7. #7
    Join Date
    Feb 2010
    Posts
    21

    Default

    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.

  8. #8
    Join Date
    Oct 2005
    Location
    Cymru
    Posts
    205

    Default

    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

  9. #9
    Join Date
    Feb 2010
    Posts
    21

    Default

    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.

  10. #10
    Join Date
    Oct 2005
    Location
    Cymru
    Posts
    205

    Default

    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 at 05:31:12 PM.
    Pugsy's MAME Cheat Page : http://mamecheat.co.uk

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dreamcast assembly hacks
    By ADnova in forum School of Hacking
    Replies: 5
    Last Post: 04-25-2011, 09:13:52 AM
  2. Need some M68k assembly help
    By Tony Hedstrom in forum Last Generation & Retro Hacking
    Replies: 8
    Last Post: 11-01-2010, 11:36:46 PM
  3. Anyone out there proficient in ARM9 assembly?
    By dragonboy269 in forum School of Hacking
    Replies: 2
    Last Post: 01-27-2009, 06:42:11 PM
  4. MOS 6502 Instruction Set
    By VisitntX in forum School of Hacking
    Replies: 2
    Last Post: 09-18-2007, 10:18:18 AM
  5. A conference on gaming in relation to learning...
    By Lazy Bastard in forum The Lounge
    Replies: 0
    Last Post: 06-10-2005, 01:48:30 AM
Collapse this box.

Visitors found this page by searching for:

6502 assembly tutorial

6502 assembly example

6502 mame

site:gamehacking.org mess mame

learning 6502 assembly hacking

mame debugger nop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •