scddisassemble

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
bgvanbur
Interested
Posts: 46
Joined: Fri Jun 22, 2012 11:13 pm

scddisassemble

Post by bgvanbur » Wed May 28, 2014 11:26 am

As part of my SCDTools tool suit, I have added a disassembler for the 68000 and z80. It can produce code that assembles, has code following knowledge, can use code lists (such once produced by blastem emulator), and extract labels and code points from an asm68k list. Use -68k or -z80 to specify the CPU. Use -asl, -asm68k (or -snasm68k which is same assembler), -asmx, -gas, -gasmri (gas using --mri option), -pasmo, -sjasm, -tasm, -vasm to specify target assembler (you can specify multiple of these and it will try its best to make it work for all the assemblers, but for example -gas for 68000 does not work with any other assembler target). Also, some assemblers have default optimizations, such as asmx will assembler 0(An) as (An) and not make a byte perfect disassembly, so for -asmx it will comment out the code and put in dc.w. There are many other options detailed in the help text.

It gives some nice statistics when disassembling such as which assemblers could have assembled the code originally, which SN asm68k options could have been used to make smaller code, the number of instructions disassembled, bytes disassembler, bytes unoptimized (only using SNASM optimizations, does not do all the optimizations vasm can do). Here is a sample output from the disassembly I am working on:

Could have been assembled by asl: N, asmx: N, gas: N, SNASM68K: Y, vasm: Y
Could use SNASM68K opts op: Y, os: Y, ow: Y, oz: Y, oaq: N, osq: N, omq: N
Code Points: 23875
Code Points Bytes: 97954
Code Points Bytes Unoptimized: 7116
Code Points Usage: 9%
Data Points Bytes: 512
Data Points Usage: 0%

You can scddisassemble and the rest of the SCDTools at http://sourceforge.net/projects/scdtools/

powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Wed May 28, 2014 6:06 pm

Nice, it produces a pretty good output with a BlastEm address list. This would be a great alternative to IDA for when you want to peek at something but don't want to go through all the trouble of IDA. I'll probably get some use out of this.

bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien » Thu May 29, 2014 9:33 am

Thanks for your tools but i have an answer:
how did you output the result ?
i can see the asm command in my shell prompt but can't extract it for rebuild with asm68K.

bgvanbur
Interested
Posts: 46
Joined: Fri Jun 22, 2012 11:13 pm

Post by bgvanbur » Thu May 29, 2014 11:38 am

It outputs the assembly to STDOUT and any messages/errors/statistics to STDERR. So use "scddisassemble ... > dis.asm" to save it to dis.asm. I will add an option to specify an output file instead though.

bgvanbur
Interested
Posts: 46
Joined: Fri Jun 22, 2012 11:13 pm

Post by bgvanbur » Thu May 29, 2014 11:52 am

I added the option -asmfile=<file> to specify the file to save the disassembly to. If not specified it sends it to STDOUT instead.

bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien » Thu May 29, 2014 1:34 pm

And that's works very well !
Thanks a lot :D

Post Reply