Hey so here's a tut on disassembling IPS and BIN files to ASM code.
First in the documents download HEX2ASM.
Also download Translhextion.
.BIN file disassembling:
First open the .bin file you want to disassemble in Translhextion.
Before we start here's some things you need to know. Things you're loading to or jumping to or whatever will appear in reverse order in translhextion.
If I had LDA $1234
Since LDA $xxxx is "AD" according to hex2asm, then...
LDA #$1234 (What you see in you .asm file)
Is the exact same as the hex numbers
db $AD,$34,$12
That's a small example on how you would go about translating things.
For example let's say our translated .bin file looks like this...
Code_000000: LDA $1F30
Code_000004: STA $50
Code_000006: LDX #$50
Code_000008: LDY #$60
Code_000010: STZ $1234,x
Code_000013: RTL
Code_000014: LDY $01
Code_000016: TYA
The .bin file would look like this...
AD 30 1F
85 50
A2 50
A0 60
9E 34 12
6B
A4 01
98
So how do we translate it? You only need to look at this numbers in the .bin file and translate them through hex2asm. But it's more likely to be set up like this or something similar.
AD 30 1F 85 50
A2 50 A0 60 9E
34 12 6B A4 01
98
I would start with the first byte (obviously) and see what that hex number really is. In this case, it's an LDA $xxxx. So now in notepad I'd type down
LDA $
And since I know it's going to be a 4 digit number that's being loaded I see 30 and 1F as $1F30 backwards so I type down.
LDA $1F30
And you basically repeat this till all of the ASM is disassembled.
Edit: To explain this further and why numbers are "stored backwards" like this:
These numbers are in little endian format. Meaning the least significant byte is stored/written first.
If you don't know what "most significant" means, it means left-most. It can be used to describe bits and other things too. It's often abbreviated as the MSB. The least significant byte would be on the left.
So with $1F30, the MSB is 0x1F and the LSB is 0x30.
And in little endian, the LSB is first so it would be translated as
30 1F
If you have more than two bytes, such as JSL $123456, it will appear in the .bin like this:
22 56 34 12
22 would be the hex translation of a JSL.
Now to disassemble an IPS patch it's very similar.
Open it up in Translhextion.
First of all, an IPS is formatted differently from BIN files. Here's how it goes...
First 5 bytes: The word "PATCH" written in hex values.
Next 3 bytes: A 3 byte PC address, which you will need to convert to an SNES Lorom offset.
Next 2 bytes: The size of change. (For example, 0025 bytes or 745F bytes.)
Next bytes: Let's say the last two bytes indicated 0005 changed bytes. Then the next 5 bytes are all ASM code that you would disassemble just like a BIN file.
Next bytes: So after those 5 bytes there was still more bytes? That means the cycle restarts. You're at another 3 byte PC address that you need to convert to an SNES Lorom offset, another 2 bytes of the size of change, and xxxx bytes for the ASM code.
EOF: When you see the 3 bytes "45 4F 46" And notice an EOF, that means End of File (and isn't written in the ASM code you're translating.) and you're done.
Also note, when you find the SNES Lorom offset from the PC address, in notepad you just type in...
ORG $ (SNES address here)
Here's a little diagram someone made for me.
Hex code seen in Translhextion:
50 41 54 43 48 : 00 02 50 : 00 01 :
01 : 00 02 52 : 00 01 : AD :
45 4F 46
Translation:
P A T C H : [PC 000250] : [0001 BYTES OF CODE CHANGED] :
[THE CODE] : [PC 000252] : [0001 BYTES OF CODE] : [THE CODE] :
E O F
Or...
50 41 54 43 48 : P A T C H
00 02 50 : [PC 000250] ; Translate this to an SNES address and put an org $ infront of it.
00 01 : [0001 BYTES OF CODE CHANGED]
01 : [THE CODE]
00 02 52 : [PC 000252] ; Translate this to an SNES address and put an org $ infront of it.
00 01 : [0001 BYTES OF CODE CHANGED]
AD : [THE CODE]
45 4F 46 : E O F
So that's an example of a disassembled .ips patch that makes simple hex edits.
How to use DisPel
DisPel is a 65c816 Assembly Disassembler
All you have to do is put this in a .bat file and double click it.
dispel -o OUTPUTFILENAME.asm ROMNAME.smc
@pause
To specify what area in SNES lorom offset hex,
-r 108000-109000
108000 is the start and 109000 is the end in this case.
I own a community of TF2 servers!
ASMT - A new revolutionary ASM system, aka 65c816 ASseMbly Thing
SMWCP - SMW Central Presents a Product- tion long name
frog
http://esolangs.org/wiki/MarioLANG
First in the documents download HEX2ASM.
Also download Translhextion.
.BIN file disassembling:
First open the .bin file you want to disassemble in Translhextion.
Before we start here's some things you need to know. Things you're loading to or jumping to or whatever will appear in reverse order in translhextion.
If I had LDA $1234
Since LDA $xxxx is "AD" according to hex2asm, then...
LDA #$1234 (What you see in you .asm file)
Is the exact same as the hex numbers
db $AD,$34,$12
That's a small example on how you would go about translating things.
For example let's say our translated .bin file looks like this...
Code_000000: LDA $1F30
Code_000004: STA $50
Code_000006: LDX #$50
Code_000008: LDY #$60
Code_000010: STZ $1234,x
Code_000013: RTL
Code_000014: LDY $01
Code_000016: TYA
The .bin file would look like this...
AD 30 1F
85 50
A2 50
A0 60
9E 34 12
6B
A4 01
98
So how do we translate it? You only need to look at this numbers in the .bin file and translate them through hex2asm. But it's more likely to be set up like this or something similar.
AD 30 1F 85 50
A2 50 A0 60 9E
34 12 6B A4 01
98
I would start with the first byte (obviously) and see what that hex number really is. In this case, it's an LDA $xxxx. So now in notepad I'd type down
LDA $
And since I know it's going to be a 4 digit number that's being loaded I see 30 and 1F as $1F30 backwards so I type down.
LDA $1F30
And you basically repeat this till all of the ASM is disassembled.
Edit: To explain this further and why numbers are "stored backwards" like this:
These numbers are in little endian format. Meaning the least significant byte is stored/written first.
If you don't know what "most significant" means, it means left-most. It can be used to describe bits and other things too. It's often abbreviated as the MSB. The least significant byte would be on the left.
So with $1F30, the MSB is 0x1F and the LSB is 0x30.
And in little endian, the LSB is first so it would be translated as
30 1F
If you have more than two bytes, such as JSL $123456, it will appear in the .bin like this:
22 56 34 12
22 would be the hex translation of a JSL.
Now to disassemble an IPS patch it's very similar.
Open it up in Translhextion.
First of all, an IPS is formatted differently from BIN files. Here's how it goes...
First 5 bytes: The word "PATCH" written in hex values.
Next 3 bytes: A 3 byte PC address, which you will need to convert to an SNES Lorom offset.
Next 2 bytes: The size of change. (For example, 0025 bytes or 745F bytes.)
Next bytes: Let's say the last two bytes indicated 0005 changed bytes. Then the next 5 bytes are all ASM code that you would disassemble just like a BIN file.
Next bytes: So after those 5 bytes there was still more bytes? That means the cycle restarts. You're at another 3 byte PC address that you need to convert to an SNES Lorom offset, another 2 bytes of the size of change, and xxxx bytes for the ASM code.
EOF: When you see the 3 bytes "45 4F 46" And notice an EOF, that means End of File (and isn't written in the ASM code you're translating.) and you're done.
Also note, when you find the SNES Lorom offset from the PC address, in notepad you just type in...
ORG $ (SNES address here)
Here's a little diagram someone made for me.
Hex code seen in Translhextion:
50 41 54 43 48 : 00 02 50 : 00 01 :
01 : 00 02 52 : 00 01 : AD :
45 4F 46
Translation:
P A T C H : [PC 000250] : [0001 BYTES OF CODE CHANGED] :
[THE CODE] : [PC 000252] : [0001 BYTES OF CODE] : [THE CODE] :
E O F
Or...
50 41 54 43 48 : P A T C H
00 02 50 : [PC 000250] ; Translate this to an SNES address and put an org $ infront of it.
00 01 : [0001 BYTES OF CODE CHANGED]
01 : [THE CODE]
00 02 52 : [PC 000252] ; Translate this to an SNES address and put an org $ infront of it.
00 01 : [0001 BYTES OF CODE CHANGED]
AD : [THE CODE]
45 4F 46 : E O F
So that's an example of a disassembled .ips patch that makes simple hex edits.
How to use DisPel
DisPel is a 65c816 Assembly Disassembler
All you have to do is put this in a .bat file and double click it.
dispel -o OUTPUTFILENAME.asm ROMNAME.smc
@pause
To specify what area in SNES lorom offset hex,
-r 108000-109000
108000 is the start and 109000 is the end in this case.
I own a community of TF2 servers!
ASMT - A new revolutionary ASM system, aka 65c816 ASseMbly Thing
SMWCP - SMW Central Presents a Product- tion long name
frog
http://esolangs.org/wiki/MarioLANG