7 #define ADS ":::AGSdisas " VERSION " by rofl0r:::"
9 static int usage(char *argv0
) {
10 dprintf(2, ADS
"\nusage:\n%s [-obl] file.o [file.s]\n"
11 "pass input and optionally output filename.\n"
13 "-o : dump offset comments in disassembly\n"
14 "-b : dump hexadecimal bytecode comments in disassembly\n"
15 "-l : remove linenumber debug assembly directives [produces smaller files]\n"
20 static void disas(char *o
, char *s
, int flags
) {
25 ASI
*i
= ASI_read_script(f
, &sc
) ? &sc
: 0;
26 dprintf(1, "disassembling %s -> %s", o
, s
);
27 if(!i
|| !ASI_disassemble(f
, i
, s
, flags
)) dprintf(1, " FAIL");
33 int main(int argc
, char**argv
) {
35 while ((c
= getopt(argc
, argv
, "obl")) != EOF
) switch(c
) {
36 case 'o': flags
|= DISAS_DEBUG_OFFSETS
; break;
37 case 'b': flags
|= DISAS_DEBUG_BYTECODE
; break;
38 case 'l': flags
|= DISAS_SKIP_LINENO
; break;
39 default: return usage(argv
[0]);
41 if(!argv
[optind
]) return usage(argv
[0]);
42 char *o
= argv
[optind
], *s
, out
[256];
45 snprintf(out
, 256, "%s", o
);
46 out
[l
-1] = 's'; // overflow me!
48 } else s
= argv
[optind
+1];