This tutorial will assume you already know / have the following:
-FCEUX - NES Emulator
-How to search for codes (prior usage of Cheat Engine will come in handy)
-Basic knowledge of 6502 Assembly (it's rather easy. )
1. Start off by playing the game and coming up to the first enemy. Make sure he doesn't hit you just yet.
2. Pause the game (always through FCEUX, NOT the game itself!)
3. Open up RAM Search and search for Equal to Value 0.
4. Let him punch you and as soon as he does and you see your character flinch, pause the game.
5. Open up RAM Search and search for Equal to Value = 1 or Equal to Changes = 1 (will produce more results and therefore take longer to narrow results).
Note: The value will also change when he isn't punching you.
6. Repeat steps 3 - 5 according to the value (not punching = 0, punching = 1)
7. After repeating those steps some times, you will have a narrowed down results list.
8. You should soon have 1 - 2 values. Unpause the game and analyse the results. If any values seem off, like ones that are changing randomly or really fast, eliminate those, because you should know that a punch is a quick movement and a boolean (on / off, yes / no, true / false or as the computer sees it: 0 / 1) and therefore, should only be changing once every so often, but specifically when you get hit, not randomly or really fast without stopping.
9. If you did it right, you should have just one value left.
10. Time to use the debugger! Open it up and add a new breakpoint. Input the address you got (should be $04BF) and checkoff Write. Play the game and as soon as the value changes, the debugger should pop up with an arrow where the 6502 ASM is. This indicates that the address $04BF is linked to this ASM code.
This code, in layman's terms, is telling the game to STore Accumulator X from address $04B8 into address $04BF with value #$00 (Hex). Then LoaD Accumulator (put the values into function) with the value that was stored. Basically, telling the game's enemy it has the ability to punch. We want to tell it that it doesn't have that ability. So, we need to tell it to do the opposite.
This is what you need to take a look at:
DAED = ASM Address
9D = Store Accumulator X Absolute
In order to do the opposite, we need to know the opposite of 9D, which is BD (LoaD Accumulator X Absolute). Here you can find the 6502 Instruction Set Opposites HERE.
Open up the Game Genie Encoder / Decoder. Paste the address DAED, compare value 9D and value BD. Then click Add to Cheat List.
Enemies Run Back When They Get Too Close [Hucklow]
SUVSSXSO
I should've called the code Enemies Don't Punch, just to shorten it up, lol
There you go! You (hopefully) learned how to make this code. This can prolly be applied to different games with possibly a bit of tweaking and maybe different effects. What are you waiting?! Go ahead and apply what you now know to other games!
-FCEUX - NES Emulator
-How to search for codes (prior usage of Cheat Engine will come in handy)
-Basic knowledge of 6502 Assembly (it's rather easy. )
1. Start off by playing the game and coming up to the first enemy. Make sure he doesn't hit you just yet.
2. Pause the game (always through FCEUX, NOT the game itself!)
3. Open up RAM Search and search for Equal to Value 0.
4. Let him punch you and as soon as he does and you see your character flinch, pause the game.
5. Open up RAM Search and search for Equal to Value = 1 or Equal to Changes = 1 (will produce more results and therefore take longer to narrow results).
Note: The value will also change when he isn't punching you.
6. Repeat steps 3 - 5 according to the value (not punching = 0, punching = 1)
7. After repeating those steps some times, you will have a narrowed down results list.
8. You should soon have 1 - 2 values. Unpause the game and analyse the results. If any values seem off, like ones that are changing randomly or really fast, eliminate those, because you should know that a punch is a quick movement and a boolean (on / off, yes / no, true / false or as the computer sees it: 0 / 1) and therefore, should only be changing once every so often, but specifically when you get hit, not randomly or really fast without stopping.
9. If you did it right, you should have just one value left.
10. Time to use the debugger! Open it up and add a new breakpoint. Input the address you got (should be $04BF) and checkoff Write. Play the game and as soon as the value changes, the debugger should pop up with an arrow where the 6502 ASM is. This indicates that the address $04BF is linked to this ASM code.
- Code:
>07:DAED:9D B8 04 STA $04B8,X @ $04BF = #$00
07:DAF0:A9 00 LDA #$00
07:DAF2:9D C8 04 STA $04C8,X @ $04CF = #$51
07:DAF5:9D D8 04 STA $04D8,X @ $04DF = #$00
This code, in layman's terms, is telling the game to STore Accumulator X from address $04B8 into address $04BF with value #$00 (Hex). Then LoaD Accumulator (put the values into function) with the value that was stored. Basically, telling the game's enemy it has the ability to punch. We want to tell it that it doesn't have that ability. So, we need to tell it to do the opposite.
This is what you need to take a look at:
DAED = ASM Address
9D = Store Accumulator X Absolute
In order to do the opposite, we need to know the opposite of 9D, which is BD (LoaD Accumulator X Absolute). Here you can find the 6502 Instruction Set Opposites HERE.
Open up the Game Genie Encoder / Decoder. Paste the address DAED, compare value 9D and value BD. Then click Add to Cheat List.
Enemies Run Back When They Get Too Close [Hucklow]
SUVSSXSO
I should've called the code Enemies Don't Punch, just to shorten it up, lol
There you go! You (hopefully) learned how to make this code. This can prolly be applied to different games with possibly a bit of tweaking and maybe different effects. What are you waiting?! Go ahead and apply what you now know to other games!