[hatari-devel] A new disassembler in Hatari
Eero Tamminen
eerot at users.berlios.de
Thu Nov 18 23:59:32 CET 2010
Hi,
On Thursday 18 November 2010, Markus Fritze wrote:
> With a bit delay (work...) here is the new 68k disassembler. I've written
> it from scratch and tested it against IDA Pro (BTW: which has a BUNCH of
> bugs in 68k). It is plain drop-in: add the ZIP'd source to the project
> and remove the old m68k_disasm() routine from newcpu.c (as well as the
> leftovers from the old one).
Great, thanks!
Others can comment how nice it's to use, I'll comment on bit on things
in the code that might need improvement. :)
* "written by" -> "copyright by"
* I don't think all pre-processors support '#' being anywhere else than
at the start of the line ("define" can be indented though):
#define MC68EC000 0x000002 // 16-/32-Bit Embedded Controller
* You should use TAB size of 8, e.g. this looks pretty broken:
---------
long addr; // address of the label
Disass68kDataType type; // type of the data on the address
int size; // size of the
label, references inside it are addressed via base address + offset
int count; // number of
elements at this address with the given size
int structIndex; // -1 no struct to describe
the element
char *name; // name of the label
char *comment; // optional comment
} disSymbolEntry;
---------
(trying to keep most things within 80 cols instead of putting several
things on same line would be nice too.)
* Disass68k() is huge function, maybe you could consider splitting it to
couple of subfunctions?
* As far as I could see, your code wasn't using/showing normal debugger
symbols, nor profiler information. Could that be added?
> If you want: add the symbol files from Symbols.zip to the .hatari folder
> to get symbols (and more detailed ones for the TOS 3.06 and 4.04)
Those will be useful, but:
* I think the current debugger symbol code could be easily extended
to support symbol size & count and extra types, everything else except
structures.
* Why OSX has separate binary versions of the symbols files?
(and debugger code?)
> The disassembler can be fully configured via Diss68kOptions and
> optionCPUTypeMask as well the TAB settings. Check the beginning of the
> source. Somebody might want to add this to the preferences of Hatari.
I can do that later on. Please add TODOs about those to suitable places in
your code. :-)
> The disassembler is able to deal with any 68k CPU (68000...68060, CPU32,
> FPU and PMMU) and should detect illegal opcodes based on the CPU mask.
Is there a function to get next instruction address which _doesn't_ print
anything?
- Eero
PS. As you have all the opcode tables, a potentially useful future addition
could be a function that search for given instruction subset from memory,
similarly to Monst...
More information about the hatari-devel
mailing list