X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=6502.c;h=ef95a0ce128c0111b6f5fc613b36f200b281e2cf;hp=27a8e1ac9ac41f153c882c95d1f65c1149931d81;hb=c59f7a33730dacf753e066a4002e2f749051a137;hpb=bdbf34766f4d074a5933eb1326fe4ce03d249e10 diff --git a/6502.c b/6502.c index 27a8e1a..ef95a0c 100644 --- a/6502.c +++ b/6502.c @@ -645,46 +645,39 @@ badmode: if (sloc > 0x10000L) fatal("6502 code pointer > 64K"); -//Now why use this instead of at_eol()? - if (*tok != EOL) - error(extra_stuff); + ErrorIfNotAtEOL(); } // // Generate 6502 object output file. +// ggn: Converted to COM/EXE/XEX output format // -// ggn: converted into a com/exe/xex output format void m6502obj(int ofd) { - uint16_t exeheader[3]; - int headsize = 6; - uint16_t * headpoint = exeheader; + uint8_t header[4]; CHUNK * ch = sect[M6502].scode; - // If no 6502 code was generated, forget it + // If no 6502 code was generated, bail out if ((ch == NULL) || (ch->challoc == 0)) return; - exeheader[0] = 0xFFFF; // Mandatory for first segment register uint8_t * p = ch->chptr; + // Write out mandatory $FFFF header + header[0] = header[1] = 0xFF; + uint32_t unused = write(ofd, header, 2); + for(uint16_t * l=&orgmap[0][0]; l