Jump to content
IGNORED

New 6502 tool(s)


evilmoo

Recommended Posts

Definitely looks like one to keep an eye on. Hopefully the project won't lose steam.

 

My sentiments too, however being an IDA Pro user and having used DIS6502 then 6502bench is certainly in its infancy.

Some things on its to-do list I immediately picked up upon, e.g. drilling through to a label when double clicking on the operand column.

Link to comment
Share on other sites

being an IDA Pro user

 

How would you assess IDA's 6502 support?

 

I tried to use it to disassemble a C64 program (SMON), and it crashed at some point.

 

This was three to four years ago, maybe it has been improved in the meanwhile.

 

regards,

chris

Link to comment
Share on other sites

I use a version from 2000 (4.1.4) as I bought a license in 1999. Sadly the newer 'free' version doesn't offer the 6502 out-of-the-box. But the original DOS freeware version did and you can get that from here, its worth getting familiar with via DOSBOX (for example).

 

So to answer the question, I find the 6502 fine and can generally do the first pass disassembling of a 64K mem dump (albeit Atari or C64) in a small amount of time, e.g. generally < 1h. A crash is an extremely rare event in my experience.

 

Once the auto analysis is done there is a pass for ensuring some blocks of code either missed (e.g. VBI / DLI are only referenced after vectors are set and so aren't identified as entry points).

Following this I do some manual tasks (that I should really create scripts for). The first is a pass to change "#-" immediates to positive values. That is somewhat by habit as ca65 didn't like them whereas MADS etc would be,

Then you need to manually turn the addresses of ",X/Y" commands to offsets as IDA doesn't do that for you. Then I'll go on the hunt for zero-page indirect usage and turn the addresses used to offsets.

Another task is to hunt for tables. These can often be quickly identified from the checking the values store to zero-page offsets. If you are lucky the programmer would have used a table of word offsets.

These can then be turned into a table and making them offsets set labels against those addresses so very handy. Where two tables of low and high bytes are used, the IDA doesn't have support to mark those appropriately but that's no biggie.

 

After this the process of understanding what code is doing and assigning appropriate labels begin a snowballing of understanding. I can then get to a point where I am happy to export the assembler and chop and change it such that I can (with luck) assemble it back to a binary that can be loaded under emulation and reflects the original. From there I can then begin the task of relocate code and data around as I see fit, build and test - which will usually flush out where you've not assigned a label you should have or the setting of a pointer is not using #>label and #<label and so the original values point to the wrong thing. So when things like this are found I can go back to the IDA file and update things which may uncover more understanding.

 

So, for me, the power of IDA is the turnaround speed and even having given DIS6502 a go and had a peek at 6502bench, those don't appear to offer me the same. But I appreciate that the investment in such a tool was mine at that time.

Link to comment
Share on other sites

I'm using IDA 5.6 from 2009. Got it from work where we mostly (in fact, exclusively) use the X86 and ARM backends. I never encountered a crash or other problems there.

 

When I had the crash with the 6502 backend I just figured that 6502 is a rather exotic backend for a professional tool, and it might not be that thoroughly maintained as X86 or ARM.

 

But when you say you didn't have problems, I might try to disassemble the C64 program again and report the problem to Hex-Rays if it happens again. Maybe the support has bit-rotted. And I could check if we still have an IDA 4.x somewhere and try whith that version.

 

From what I remember I was fiddling with a jump table. The SMON program is just 4K (for the $C000..$CFFF area on the C64) and contains a jump table where (destination address - 1) is stored. In order to push the two bytes on the stack and then RTS.

IDA wasn't detecting this as jump table as such and I wanted to force it into, so I don't have to manually assign the destination addresses. But my memory is hazy.

 

regards,

chris

Link to comment
Share on other sites

:D I was tempted to mention in my post that the 'address-1' tables are a pain because they'll simply make labels for the adjacent location. If you are lucky then this is an RTS but most other times not. I'd suspect the same as you, as IDA Pro has evolved the 6502 target's support may not have been of prime focus and so could be a little more temperamental.

 

I mentioned a while back now that I'd take an A8 to 5200 port and make a YouTube video guide covering how its done, I should stick to my word the next time I do one :)

Edited by Wrathchild
Link to comment
Share on other sites

:D I was tempted to mention in my post that the 'address-1' tables are a pain because they'll simply make labels for the adjacent location. If you are lucky then this is an RTS but most other times not. I'd suspect the same as you, as IDA Pro has evolved the 6502 target's support may not have been of prime focus and so could be a little more temperamental.

 

I swear I made this work with control-R before, but I can't seem to reproduce it. I'll keep poking at it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...