I have a device containing a modified 6502. I would like to disassemble its firmware ROM. Are there any disassemblers out there that can handle a modified instruction set?
If I really have to, I can make my own disassembler, but surely there's an easier way.
Are there any disassemblers for weird 6502 variants?
-
- Posts: 1565
- Joined: Tue Feb 07, 2017 2:03 am
Re: Are there any disassemblers for weird 6502 variants?
I doubt anything handles those, they are somewhat rare. Modifying https://github.com/fadden/6502bench/ is probably your best bet.
Re: Are there any disassemblers for weird 6502 variants?
For whatever other flaws may exist in bisqwit's clever-disasm, I found it pretty easy to extend to support for the Mitsubishi 740 65C02-based microcontrollers.
Re: Are there any disassemblers for weird 6502 variants?
If all you need is a quick and dirty disassembly, it might be simplest to just write a disassembler yourself. That way, you'll have a "baseline" tool which gives you the basic stuff you need, and you'd have it pretty quickly.
Taking a fancier disassembler and extending it would be ideal in the long-run, but might also require additional work which goes beyond simply "read bytes get text". For example, the disassembler you're extending might also want an emulator for the modified instruction set so it can perform static analysis (and give a better disassembly). If you're OK with that, then try that out instead.
Either of these things might be the "easier" thing depending on who you ask (including yourself), so it comes down to what your particular needs are, and what you're willing to put your effort towards (e.g., figuring out how to extend an existing codebase vs. writing it from scratch yourself), and how often you're going to need what the tool does.
I think I would write my own disassembler first, just to have something at all, and would move onto extending an existing 6502 disassembler later, if it turns out I need something more robust. That's just my personal take though, and might not be what others would do.
Taking a fancier disassembler and extending it would be ideal in the long-run, but might also require additional work which goes beyond simply "read bytes get text". For example, the disassembler you're extending might also want an emulator for the modified instruction set so it can perform static analysis (and give a better disassembly). If you're OK with that, then try that out instead.
Either of these things might be the "easier" thing depending on who you ask (including yourself), so it comes down to what your particular needs are, and what you're willing to put your effort towards (e.g., figuring out how to extend an existing codebase vs. writing it from scratch yourself), and how often you're going to need what the tool does.
I think I would write my own disassembler first, just to have something at all, and would move onto extending an existing 6502 disassembler later, if it turns out I need something more robust. That's just my personal take though, and might not be what others would do.
Re: Are there any disassemblers for weird 6502 variants?
Hmm. I doubt there will be anything interesting in this firmware ROM, and a couple of this CPU's addressing modes are different from a typical 6502, so it sounds like the best option is writing my own disassembler.
Oh well.
Oh well.
Re: Are there any disassemblers for weird 6502 variants?
MAME's 'unidasm' tool with the "-arch r65c19" option should do what you want (at least at a glance, the instructions it supports seem to match the table in the documentation you posted).
Re: Are there any disassemblers for weird 6502 variants?
You're right, that's the same CPU core. It looks like the CPU core was used in a few MCUs, so if I come across any others in my collection I'll give that a shot.