comparison lwasm/main.c @ 406:4411a6123716

Add "basic" output format Add "basic" output format. This outputs the code in the form of a Basic program that installs the assembled output. If an execution address is provided to the END pseudo operation, it will transfer control there using the Basic EXEC command. Thanks to Tim Lindner <tlindner@macmess.org> for the original patch. I used it mostly as is except for a couple of minor fixes for coding style and removing a variable declaration from inside a for() statement for portability reasons.
author William Astle <lost@l-w.ca>
date Thu, 03 Mar 2016 21:04:39 -0700
parents 1ebb5a0b2874
children 9f796134d6f4
comparison
equal deleted inserted replaced
405:4c8925f97eb5 406:4411a6123716
42 42
43 static struct lw_cmdline_options options[] = 43 static struct lw_cmdline_options options[] =
44 { 44 {
45 { "output", 'o', "FILE", 0, "Output to FILE"}, 45 { "output", 'o', "FILE", 0, "Output to FILE"},
46 { "debug", 'd', "LEVEL", lw_cmdline_opt_optional, "Set debug mode"}, 46 { "debug", 'd', "LEVEL", lw_cmdline_opt_optional, "Set debug mode"},
47 { "format", 'f', "TYPE", 0, "Select output format: decb, raw, obj, os9"}, 47 { "format", 'f', "TYPE", 0, "Select output format: decb, basic, raw, obj, os9"},
48 { "list", 'l', "FILE", lw_cmdline_opt_optional, "Generate list [to FILE]"}, 48 { "list", 'l', "FILE", lw_cmdline_opt_optional, "Generate list [to FILE]"},
49 { "symbols", 's', 0, lw_cmdline_opt_optional, "Generate symbol list in listing, no effect without --list"}, 49 { "symbols", 's', 0, lw_cmdline_opt_optional, "Generate symbol list in listing, no effect without --list"},
50 { "symbols-nolocals", 0x103, 0, lw_cmdline_opt_optional, "Same as --symbols but with local labels ignored"}, 50 { "symbols-nolocals", 0x103, 0, lw_cmdline_opt_optional, "Same as --symbols but with local labels ignored"},
51 { "tabs", 't', "WIDTH", 0, "Set tab spacing in listing (0=don't expand tabs)" }, 51 { "tabs", 't', "WIDTH", 0, "Set tab spacing in listing (0=don't expand tabs)" },
52 { "map", 'm', "FILE", lw_cmdline_opt_optional, "Generate map [to FILE]"}, 52 { "map", 'm', "FILE", lw_cmdline_opt_optional, "Generate map [to FILE]"},
173 break; 173 break;
174 174
175 case 'f': 175 case 'f':
176 if (!strcasecmp(arg, "decb")) 176 if (!strcasecmp(arg, "decb"))
177 as -> output_format = OUTPUT_DECB; 177 as -> output_format = OUTPUT_DECB;
178 else if (strcasecmp(arg, "basic"))
179 as -> output_format = OUTPUT_BASIC;
178 else if (!strcasecmp(arg, "raw")) 180 else if (!strcasecmp(arg, "raw"))
179 as -> output_format = OUTPUT_RAW; 181 as -> output_format = OUTPUT_RAW;
180 else if (!strcasecmp(arg, "rawrel")) 182 else if (!strcasecmp(arg, "rawrel"))
181 as -> output_format = OUTPUT_RAWREL; 183 as -> output_format = OUTPUT_RAWREL;
182 else if (!strcasecmp(arg, "obj")) 184 else if (!strcasecmp(arg, "obj"))