PDA

View Full Version : Just curious about disasseblers


imnonoitall
10-13-2004, 08:45 AM
I've downloaded a few disassemblers for the 65c816 but I'm wondering if any of them out there are capable of doing more than just extracting huge blocks of assembly. I'm interested in separating disassembled code into some sort of understandable unit (like functions). From what I've read about 65c816 instructions, it doesn't sound like this would be very easy, but I'm not even all that familiar with x86 assembly yet, so I'm kind of a noobie when it comes to such low level programming. Are there any tools available to split up a 65c816 program into somewhat more structured code? I'm not expecting it to magically produce C code or anything like that, but I just want to separate out areas of code that were meant to do specific things. Probably nothing that can do this yet, is there?

<P ID="signature"></P>

Gil-Galad
10-13-2004, 03:35 PM
Yes you're probally not going to find a disassembler like what you're looking for. I dabble in 6502 myself and I found this disassembler DCC6502 that has the option for Nintendo register commenting, this option is really usefull and if you could find a 65C816 disassembler with the same option it would help you. This way you would have a idea of what's going on in teh code in some sections.

<P ID="signature"></P>

king killa
10-14-2004, 01:56 AM
what would be really nice is a disassmbler than could generate code that was ready to re-assemble. This way, you could make dramatic changes to the game and not have to open a hex editor.

<P ID="signature"></P>

Gavin_86
10-14-2004, 06:32 AM
there are actually two of these "smart disassemblers" that i know of for the 6502, or rather the NES specifically. Neither are currently released, however. There is also a third that was made for someones own private use.. i'm not sure if there was ever intention for release. not that it helps, but they're quite handy <img src=smilies/upeyes.gif>

<P ID="signature"><center>I'm just a Paranoid Android watching through my superb crystal viewing glass

.::http://gavin.panicus.orgGavin.Panicus.org</a> ::.</center></P>

imnonoitall
10-14-2004, 08:24 AM
Thanks for your insights! Now, I have another question that might be a little easier to answer. Does the 65c816 instruction set have any instructions specifically meant for calling procedures, or does it just use long jumps? (I hope that question makes sense - as I mentioned before, I'm not too familiar with assembly.)

<P ID="signature"></P>

Lenophis
10-14-2004, 09:03 AM
<blockquote><font class="small">In reply to:</font><hr>

I hope that question makes sense - as I mentioned before, I'm not too familiar with assembly.

<hr></blockquote>
I know the feeling, although I don't know if it will help, here's an instrucion set (http://www.obelisk.demon.co.uk/65C02/reference.html) and addressing modes (http://www.obelisk.demon.co.uk/65C02/addressing.html). Hope this helps

<P ID="signature"><img src=http://www.cpinternet.com/~norwin/lenophis/sig.png>
"For lovers of irony; I'll just say one thing...wishes do come true." - Lobster Cowboy. Jade (http://disch.zophar.net)</P>

imnonoitall
10-15-2004, 02:04 AM
It does! I think I'm getting a better idea of just how all those numbers work. One final question: How does the processor know what part of the ROM to execute? If I'm right, a 16 bit processor can only use 64 kilobytes in memory at a time, right? So how does it decide where to start and when/where to move on?

<P ID="signature"></P>

Gideon Zhi
10-15-2004, 02:47 AM
You're wrong.
The 6502 (8-bit) can only address 64 kilobytes of memory at a time, so you have mapper chips built into NES games that can swap out chunks of ROM for other chunks of ROM, thus getting around the limitation.

For 65816 (16-bit), you have 24-bit addressing, so you can address quite a lot more than 64 kilobytes at a time :) The max on the SNES is 64mbit, but even anything beyond 32 really requires a special non-standard mapping (the standards being LoROM and HiROM.)

As far as where to start is concerned, you need to look at the reset vector, whose address I don't have handy.

<P ID="signature"><hr><center>http://agtp.romhack.net<img src=http://agtp.romhack.net/linkage.gif></a>
Aeon Genesis ~ Aiyah! Thank you for the always and always. (http://agtp.romhack.net)</center></P>

imnonoitall
10-15-2004, 05:07 AM
Wow, confusing! So, how would you specify a 24-bit address for, say, an LDX command? Since the most that LDX accepts is a 16-bit address, how would I specify the most significant byte of the address? (If you're getting tired of my noobish questions and you have a link to a tutorial or something that explains this, that would be great!)

<P ID="signature"></P>

Evil Peer
10-15-2004, 03:43 PM
Actually, you are correct. It can only address 64k of material at a time. But it is capable of addressing multiple pages of 64k.

As for addressing, the quickest way to find out would be to just look at some ROM traces. Get my Snes9x Tracer and have at it.

And while not quite a discrete function disassembler, Dispel will insert line breaks after every return, which tends to break up the assembly quite well.

---Evil Peer

<P ID="signature"></P>

JadussD
10-15-2004, 04:23 PM
> Wow, confusing! So, how would you specify a 24-bit address
> for, say, an LDX command?

The 65c816 has separate LDX commands(and LDY, and LDA and other related commands that address things) with different bytes signifying which one is used. You should be able to find these on an instruction set that lists the opcodes. One LDX command is followed by a 3-bytes for 24-bit addresses, the other is followed by a 2-bytes for 16-bit addresses. The assembler automatically figures out which opcode to use depending on the size of the address in the code.

<P ID="signature"><HR>
<CENTER>http://members.aol.com/jadussvii/Alcahest-Sociopathic_Engineering.oggThis music wants you dead.</a></center></P>

imnonoitall
10-16-2004, 11:55 PM
Very nice tool! Even better than a disassembler, since I just have to trace the right part of the ROM and sift through a < 500KB file instead of an unsorted 20 MB complete disassebled ROM. Many thanks and compliments on the well-featured emulator.

<P ID="signature"></P>

imnonoitall
10-17-2004, 05:06 AM
My assembly noobishness is surfacing again. The tracer is giving me all the addresses as page:address. For example: I see the emulator run the subroutine at 14:FD03. Is there any way I can translate the page:address into the physical address of the subroutine in the ROM file?

<P ID="signature"></P>