This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Interactive disassembler for 6502

Interactive disassembler for 6502
by on (#130735)
I've been wanting to create an interactive disassembler. It would gather data from code-data-logging the video game you wish to disassemble.

It would then provide options like this for disability;

Code:
rts
lda #$46


Code:
rts

lda #$46


This inserts a space

It would also allow you to add comments to what will be the eventual disassembly.

Most importantly, you would be able to define labels, equates (including groups of equates that function as flags), and then inside the code, you can make adjustments like:

Code:
.byte $56
.byte $87
.byte $9A
.byte $BB


by making it into a single line, for the disassembler to produce, so you don't have to do it yourself:

Code:
.byte $56, $87, $9A, $BB


You would be able to make use equates and labels by looking up matching labels/equates (or for immediate addressing or single-byte data equates flags as well), like so:

Code:
jmp $8765
.byte $A8


For $8765, the system will find all the labels and equates with that value. For $A8, it would look up the equates flags as well, so you can pick the correct label/equate/equate flag group to substitute in code. It could change to this for example:

Code:
jmp DoStuff
.byte flg3 | $flg4


Pretty neat, huh? You could also split it up into files, with a master file that includes all the files, which I expect would be useful for disassembling something like Kirby's Adventure, where each bank can have its own source file.

Now, what are some of the best ways to implement this? Should I make use of a toolbar? Should I use a list item to store every line (including the empty spaces, comments, equates, and label names), or perhaps a more generic label that calculates where you're at now in the code?

I'm working on the best design to allow you to do that, to decide exactly how the disassembly, and I wonder if there is any advice anyone could give?

I should design the interface before coding, right?
Re: Interactive disassembler for 6502
by on (#130736)
This somehow makes me think of what FCEUX CDL files were made for, in combination with FCEUX Bookmarks.

Also, an interactive disassembler for 6502 is already available in the form of IDA Pro, but of course the issue there is that there's no NES emulator integration + memory mapped register knowledge. Honestly, for NES stuff an interactive disassembler is mainly useful when there's an emulator tied to it in real-time (same goes for Apple II stuff, etc.).
Re: Interactive disassembler for 6502
by on (#130738)
koitsu wrote:
This somehow makes me think of what FCEUX CDL files were made for, in combination with FCEUX Bookmarks.

Also, an interactive disassembler for 6502 is already available in the form of IDA Pro, but of course the issue there is that there's no NES emulator integration + memory mapped register knowledge. Honestly, for NES stuff an interactive disassembler is mainly useful when there's an emulator tied to it in real-time (same goes for Apple II stuff, etc.).


Indeed, I do plan to incorporate CDL files into the project. You would play the game until the CDL file is nearly full and then when you load the new project in interactive disassembler, it connects code to code and data to data properly.

I also made a modified version of FCEUX that offers better FDS support by mapping everything going on in the range $6000-$DFFF. (You would want to switch the CDL files whenever a new part of the disk is being loaded or the disk gets turned around.)

I actually might want to contact them about that extra support for the FDS.
Re: Interactive disassembler for 6502
by on (#130752)
koitsu wrote:
Honestly, for NES stuff an interactive disassembler is mainly useful when there's an emulator tied to it in real-time (same goes for Apple II stuff, etc.).

Why do you think that?

Also the fact that IDA Pro is not free (and is in fact quite expensive) is a deal breaker for many.