Originally posted by Hybrid
View Post
Code:
$AC70:C6 34 DEC $0034 = #$02
- $AC70 - This is the address
- C6 34 - Then you have the instruction in machine code. This particular instruction requires two bytes, the instruction itself (C6) and the address to manipulate (34).
- DEC $0034 - Then you have the translation of the instruction in assembly. C6, which in assembly is DEC or decrease, decreases the value in the defined address by 1. $0034 is the address whose value it's going to decrease. Simply, DECrease the value in address $0034.
- = #$02 Finally, you have the new value after the instruction. As you might have figured out, $ denotes an address and #$ denotes a value. This is a nice feature of the debugger to help out a little with the interpretation.
A lot of GG codes reverse storing instructions. So when you see LDA, which is LoaD into register A (the accumulator), it is pulling a value from memory. And when you see STA, or STore register A into memory, it is taking what is in A and putting it into the address specified. What I mean by reversing storing, is that you change the STA to an LDA.
So when dealing with lives or energy, generally a game pulls a value from memory, decreases it or something and stores it back. When you change the store to another load, the new value is never written and the old value stays the same. It's important when making codes to not interfere with any other aspect of the game, so loading the value again instead of writing it is usually safe.
When you make a game genie code, you are manipulating the game's code to do what you want. You can become a great code maker by using a reference for the 6502's instruction set. Then you can start to see what the game is doing, and change it to your liking to make great codes.
Leave a comment: