comparison 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
comparison
equal deleted inserted replaced
261:f45b2a68c3da 262:7de7b14ebaee
270 270
271 codedatasize += 13; // add in headers 271 codedatasize += 13; // add in headers
272 nameoff = codedatasize; // we'll put the name at the end 272 nameoff = codedatasize; // we'll put the name at the end
273 codedatasize += 3; // add in CRC 273 codedatasize += 3; // add in CRC
274 codedatasize += strlen(linkscript.name); // add in name length 274 codedatasize += strlen(linkscript.name); // add in name length
275 if (linkscript.edition >= 0)
276 codedatasize += 1;
275 277
276 // output the file header 278 // output the file header
277 buf[0] = 0x87; 279 buf[0] = 0x87;
278 buf[1] = 0xCD; 280 buf[1] = 0xCD;
279 buf[2] = (codedatasize >> 8) & 0xff; 281 buf[2] = (codedatasize >> 8) & 0xff;
331 } 333 }
332 buf[0] = linkscript.name[i] | 0x80; 334 buf[0] = linkscript.name[i] | 0x80;
333 writebytes(buf, 1, 1, of); 335 writebytes(buf, 1, 1, of);
334 os9crc(crc, buf[0]); 336 os9crc(crc, buf[0]);
335 337
338 if (linkscript.edition >= 0)
339 {
340 buf[0] = linkscript.edition & 0x80;
341 writebytes(buf, 1, 1, of);
342 os9crc(crc, buf[0]);
343 }
344
336 crc[0] ^= 0xff; 345 crc[0] ^= 0xff;
337 crc[1] ^= 0xff; 346 crc[1] ^= 0xff;
338 crc[2] ^= 0xff; 347 crc[2] ^= 0xff;
339 writebytes(crc, 1, 3, of); 348 writebytes(crc, 1, 3, of);
340 } 349 }