diff lwlink/output.c @ 262:7de7b14ebaee

Add support for os9 module edition byte Add support for the symbol "edition" in the __os9 section which defines the module edition byte which follows immedately after the module name in the module. It defaults to not setting one.
author William Astle <lost@l-w.ca>
date Mon, 04 Feb 2013 21:03:59 -0700
parents ebda5c96665e
children 346966cffeef
line wrap: on
line diff
--- a/lwlink/output.c	Mon Feb 04 20:51:55 2013 -0700
+++ b/lwlink/output.c	Mon Feb 04 21:03:59 2013 -0700
@@ -272,6 +272,8 @@
 	nameoff = codedatasize; // we'll put the name at the end
 	codedatasize += 3;	// add in CRC
 	codedatasize += strlen(linkscript.name); // add in name length
+	if (linkscript.edition >= 0)
+		codedatasize += 1;
 	
 	// output the file header
 	buf[0] = 0x87;
@@ -333,6 +335,13 @@
 	writebytes(buf, 1, 1, of);
 	os9crc(crc, buf[0]);
 	
+	if (linkscript.edition >= 0)
+	{
+		buf[0] = linkscript.edition & 0x80;
+		writebytes(buf, 1, 1, of);
+		os9crc(crc, buf[0]);
+	}
+	
 	crc[0] ^= 0xff;
 	crc[1] ^= 0xff;
 	crc[2] ^= 0xff;