X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=rmac.c;h=4772d203bd93d612f5e9e6a7121ae37e98fc9786;hp=f88f849a77963ed5ad5b2842dd83b7d1eb2ee2a9;hb=HEAD;hpb=526716329c31d18f0ecc0e23698fa6381628409c diff --git a/rmac.c b/rmac.c index f88f849..17715f7 100644 --- a/rmac.c +++ b/rmac.c @@ -62,6 +62,7 @@ int activefpu = FPU_NONE; // Active FPU (none by default) int org68k_active = 0; // .org switch for 68k (only with RAW output format) uint32_t org68k_address; // .org for 68k int correctMathRules; // 1, use C operator precedence in expressions +uint32_t used_architectures; // Bitmask that records exactly which architectures were used during assembly // // Convert a string to uppercase @@ -163,6 +164,7 @@ void DisplayHelp(void) " -f[format] Output object file format\n" " a: ALCYON\n" " b: BSD (use this for Jaguar)\n" + " c: PRG (C64)\n" " e: ELF\n" " p: P56 (use this for DSP56001 only)\n" " l: LOD (use this for DSP56001 only)\n" @@ -376,6 +378,7 @@ int Process(int argc, char ** argv) regcheck = reg68check; // Idem regaccept = reg68accept; // Idem correctMathRules = 0; // respect operator precedence + used_architectures = 0; // Initialise used architectures bitfield // Initialize modules InitSymbolTable(); // Symbol table InitTokenizer(); // Tokenizer @@ -443,6 +446,10 @@ int Process(int argc, char ** argv) case 'B': obj_format = BSD; break; + case 'c': + case 'C': + obj_format = C64PRG; + break; case 'e': // -fe = ELF case 'E': obj_format = ELF; @@ -751,7 +758,9 @@ int Process(int argc, char ** argv) if (firstfname == NULL) firstfname = defname; - strcpy(fnbuf, firstfname); + // It's the size of fnbuf minus 5 because of the possible 4 char suffix + // + trailing null (added by fext()). + strncpy(fnbuf, firstfname, sizeof(fnbuf) - 5); fext(fnbuf, (prg_flag ? ".prg" : ".o"), 1); objfname = fnbuf; }