Who wants to disassemble EarthBound Zero?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
Albert1983
Posts: 24
Joined: Tue Aug 04, 2020 6:34 pm

Who wants to disassemble EarthBound Zero?

Post by Albert1983 »

Who is willing to disassemble EarthBound Zero?
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Who wants to disassemble EarthBound Zero?

Post by Quietust »

Albert1983 wrote: Tue Dec 15, 2020 8:38 am Who is willing to disassemble EarthBound Zero?
Not me, that's for sure.

Why do you need somebody else to disassemble Earthbound? Is there a reason why you cannot do it yourself?
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
never-obsolete
Posts: 411
Joined: Wed Sep 07, 2005 9:55 am
Location: Phoenix, AZ
Contact:

Re: Who wants to disassemble EarthBound Zero?

Post by never-obsolete »

Are you willing to play through the entire game in Mesen to provide a cdl file?
. That's just like, your opinion, man .
User avatar
Albert1983
Posts: 24
Joined: Tue Aug 04, 2020 6:34 pm

Re: Who wants to disassemble EarthBound Zero?

Post by Albert1983 »

Quietust wrote: Tue Dec 15, 2020 8:41 am
Albert1983 wrote: Tue Dec 15, 2020 8:38 am Who is willing to disassemble EarthBound Zero?
Not me, that's for sure.

Why do you need somebody else to disassemble Earthbound? Is there a reason why you cannot do it yourself?
I have tried it myself, but have not been successful. And also I can't understand the use of tools like da65 well.
User avatar
Albert1983
Posts: 24
Joined: Tue Aug 04, 2020 6:34 pm

Re: Who wants to disassemble EarthBound Zero?

Post by Albert1983 »

never-obsolete wrote: Tue Dec 15, 2020 10:36 am Are you willing to play through the entire game in Mesen to provide a cdl file?
I don't have that emulator, but I think I can provide you with a cdl file of FCEUX.
User avatar
never-obsolete
Posts: 411
Joined: Wed Sep 07, 2005 9:55 am
Location: Phoenix, AZ
Contact:

Re: Who wants to disassemble EarthBound Zero?

Post by never-obsolete »

CDLs from FCEUX lack any type of information as to what banks are mapped into CPU address space making it difficult to determine where absolute addresses actually refer to. I have a custom build of Mesen that does log this information.

I could run it through using the one from FCEUX, but you would be left resolving these labels manually. What is your end goal here beyond having a disassembly?
. That's just like, your opinion, man .
Bavi_H
Posts: 193
Joined: Sun Mar 03, 2013 1:52 am
Location: Texas, USA
Contact:

Re: Who wants to disassemble EarthBound Zero?

Post by Bavi_H »

never-obsolete wrote: Wed Dec 16, 2020 5:23 pm CDLs from FCEUX lack any type of information as to what banks are mapped into CPU address space
In FCEUX 2.2.3 for Windows, the help file page Debug -> Code/Data Logger says CDL files contain some information about the bank, if I understand correctly?:
CDL files are just a mask of the ROM; that is, they are of the same size as the ROM, and each byte represents the corresponding byte of the ROM. The format of each byte is like so (in binary):

For PRG ROM:

x P d c A A D C

C = Whether it was accessed as code.
D = Whether it was accessed as data.
AA = Into which ROM bank it was mapped when last accessed:

00 = $8000-$9FFF
01 = $A000-$BFFF
10 = $C000-$DFFF
11 = $E000-$FFFF


[...]
User avatar
never-obsolete
Posts: 411
Joined: Wed Sep 07, 2005 9:55 am
Location: Phoenix, AZ
Contact:

Re: Who wants to disassemble EarthBound Zero?

Post by never-obsolete »

I should have phrased that better, it has very little information about what is mapped in at the time an instruction is executed.

The last time I checked (which was back in fceuxdsp), those bits were the bank of the instruction/data itself, not the data the instruction was accessing or where jmp/jsr end up.
. That's just like, your opinion, man .
User avatar
Albert1983
Posts: 24
Joined: Tue Aug 04, 2020 6:34 pm

Re: Who wants to disassemble EarthBound Zero?

Post by Albert1983 »

never-obsolete wrote: Wed Dec 16, 2020 5:23 pm CDLs from FCEUX lack any type of information as to what banks are mapped into CPU address space making it difficult to determine where absolute addresses actually refer to. I have a custom build of Mesen that does log this information.

I could run it through using the one from FCEUX, but you would be left resolving these labels manually. What is your end goal here beyond having a disassembly?
So do I have to use the Mesen emulator compulsorily?
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Who wants to disassemble EarthBound Zero?

Post by Quietust »

You could also try loading the ROM into Ghidra and letting it try to trace that stuff out itself (it seems to be pretty good at it), though I woudn't recommend that for beginners since there's a whole bunch of non-intuitive stuff you need to do correctly (e.g. importing each bank separately and assigning it to the right memory region as an overlay, then hand-editing cross-bank XREFs to point to the correct locations).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
strat
Posts: 409
Joined: Mon Apr 07, 2008 6:08 pm
Location: Missouri

Re: Who wants to disassemble EarthBound Zero?

Post by strat »

Albert1983 wrote: Tue Dec 15, 2020 6:28 pm I have tried it myself, but have not been successful. And also I can't understand the use of tools like da65 well.
Disassemblers aren't that useful in reverse engineering a program. If you want to document the battle system for ex. look at the vram addresses where the party members' stats are printed and work backwards to see how it decides to write those tiles to the tile map. This routine converts 24-bit numbers to decimal for displaying the party member's level, HP and PP:

Code: Select all

0F:F161:A0 08     LDY #$08
 0F:F163:88        DEY
 0F:F164:A9 00     LDA #$00
 0F:F166:A2 18     LDX #$18
 0F:F168:26 60     ROL $0060 = #$00
 0F:F16A:26 61     ROL $0061 = #$00
 0F:F16C:26 62     ROL $0062 = #$00
 0F:F16E:2A        ROL
 0F:F16F:C9 0A     CMP #$0A
 0F:F171:90 02     BCC $F175
 0F:F173:E9 0A     SBC #$0A						
 0F:F175:26 60     ROL $0060 = #$00
 0F:F177:26 61     ROL $0061 = #$00
 0F:F179:26 62     ROL $0062 = #$00
 0F:F17B:CA        DEX
 0F:F17C:D0 F0     BNE $F16E
 0F:F17E:AA        TAX
 0F:F17F:BD 9A F1  LDA $F19A,X @ $F19D = #$B3	; look up tile that corresponds to decimal digit
>0F:F182:99 68 00  STA $0068,Y @ $006E = #$A0
 0F:F185:A5 60     LDA $0060 = #$00
 0F:F187:05 61     ORA $0061 = #$00
 0F:F189:05 62     ORA $0062 = #$00
 0F:F18B:D0 D6     BNE $F163
 0F:F18D:84 63     STY $0063 = #$07
 0F:F18F:A9 A0     LDA #$A0
 0F:F191:D0 03     BNE $F196
 0F:F193:99 68 00  STA $0068,Y @ $006E = #$A0
 0F:F196:88        DEY
 0F:F197:10 FA     BPL $F193
 0F:F199:60        RTS -----------------------------------------
 
It's a lot faster to figure out sections of the code by using a debugger and breakpoints than to stare at a raw disassembly.
User avatar
Albert1983
Posts: 24
Joined: Tue Aug 04, 2020 6:34 pm

Re: Who wants to disassemble EarthBound Zero?

Post by Albert1983 »

I already downloaded the Mesen emulator, now what do I have to do to get the cdl file?
User avatar
never-obsolete
Posts: 411
Joined: Wed Sep 07, 2005 9:55 am
Location: Phoenix, AZ
Contact:

Re: Who wants to disassemble EarthBound Zero?

Post by never-obsolete »

I believe the option to save the cdl file is in the debugger menu.
. That's just like, your opinion, man .
User avatar
Albert1983
Posts: 24
Joined: Tue Aug 04, 2020 6:34 pm

Re: Who wants to disassemble EarthBound Zero?

Post by Albert1983 »

I have this CDL file that I create with the FCEUX emulator.

https://mega.nz/file/NFhg3I5S#P2UXHjB4T ... BBFBtm3YhE
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Who wants to disassemble EarthBound Zero?

Post by unregistered »

Albert1983 wrote: Wed Dec 23, 2020 9:50 am I already downloaded the Mesen emulator, now what do I have to do to get the cdl file?
Mesen’s cdl files are stored in its Debugger folder. There isn’t a button to push to create a Mesen cdl file, I don’t think so at least. Mesen writes to the game’s cdl file all the time while running a game. This constant access required thwarts a create-cdl-button/option (i.e. ex. cdl-byte-bits are changed depending if nes bytes have been visited or not).

If you are running hello.nes, the cdl file will be called hello.cdl 🙂


EDIT: sry, guess Mesen’s debugger has to be opened (possible after a game is loaded) in order to cause cdl creation. Also, within Mesen’s debugger window, click Tools>“Code/Data Logger” and make sure there is a check next to “Auto load/save log file”.

With ^that unchecked, it’s possible to load a changed cdl file with an alternate name (i.e. to see how those changes affect the debugger).
Locked