diff lwasm/main.c @ 543:e10618b48e68

Implement support for dragon format binaries Implement support for dragon format binaries. As an added bonus, also implement a variation on raw binaries which guarantees the whole binary fits in the file. These are the "dragon" and "abs" output formats. Based on code submitted by Mike Miller.
author William Astle <lost@l-w.ca>
date Thu, 29 Sep 2022 13:59:42 -0600
parents 7fbf3171ca15
children ddc7b05a5675
line wrap: on
line diff
--- a/lwasm/main.c	Wed Aug 17 17:06:30 2022 -0600
+++ b/lwasm/main.c	Thu Sep 29 13:59:42 2022 -0600
@@ -44,7 +44,7 @@
 {
 	{ "output",		'o',	"FILE",		0,							"Output to FILE"},
 	{ "debug",		'd',	"LEVEL",	lw_cmdline_opt_optional,	"Set debug mode"},
-	{ "format",		'f',	"TYPE",		0,							"Select output format: decb, basic, raw, obj, os9, ihex, srec"},
+	{ "format",		'f',	"TYPE",		0,							"Select output format: decb, basic, raw, obj, os9, ihex, srec, dragon, abs"},
 	{ "list",		'l',	"FILE",		lw_cmdline_opt_optional,	"Generate list [to FILE]"},
 	{ "list-nofiles", 0x104, 0,			0,							"Omit file names in list output"},
 	{ "symbols",	's',	0,			lw_cmdline_opt_optional,	"Generate symbol list in listing, no effect without --list"},
@@ -53,6 +53,8 @@
 	{ "tabs",		't',	"WIDTH",	0,							"Set tab spacing in listing (0=don't expand tabs)" },
 	{ "map",		'm',	"FILE",		lw_cmdline_opt_optional,	"Generate map [to FILE]"},
 	{ "decb",		'b',	0,			0,							"Generate DECB .bin format output, equivalent of --format=decb"},
+	{ "dragon",     0x107,  0,          0,                          "Generate a Dragon DOS binary format, equivalent of --format=dragon"},
+	{ "abs",        0x108,  0,          0,                          "Generate absolute binary format, equivalent of --format=abs"},
 	{ "raw",		'r',	0,			0,							"Generate raw binary format output, equivalent of --format=raw"},
 	{ "obj",		0x100,	0,			0,							"Generate proprietary object file format for later linking, equivalent of --format=obj" },
 	{ "depend",		0x101,	0,			0,							"Output a dependency list to stdout; do not do any actual output though assembly is completed as usual" },
@@ -173,6 +175,14 @@
 	case 'b':
 		as -> output_format = OUTPUT_DECB;
 		break;
+	
+	case 0x107:
+		as -> output_format = OUTPUT_DRAGON;
+		break;
+	
+	case 0x108:
+		as -> output_format = OUTPUT_ABS;
+		break;
 
 	case 'r':
 		as -> output_format = OUTPUT_RAW;
@@ -211,6 +221,10 @@
 			as -> output_format = OUTPUT_IHEX;
 		else if (!strcasecmp(arg, "hex"))
 			as -> output_format = OUTPUT_HEX;
+		else if (!strcasecmp(arg, "dragon"))
+			as -> output_format = OUTPUT_DRAGON;
+		else if (!strcasecmp(arg, "abs"))
+			as -> output_format = OUTPUT_ABS;
 		else if (!strcasecmp(arg, "os9"))
 		{
 			as -> pragmas |= PRAGMA_DOLLARNOTLOCAL;