regtab = reg65tab;
regcheck = reg65check;
regaccept = reg65accept;
+ used_architectures |= M6502;
return 0;
}
}
+// Write raw 6502 org'd code.
+// Super copypasta'd from above function
+void m6502raw(int ofd)
+{
+ CHUNK * ch = sect[M6502].scode;
+
+ // If no 6502 code was generated, bail out
+ if ((ch == NULL) || (ch->challoc == 0))
+ return;
+
+ register uint8_t *p = ch->chptr;
+
+ for(uint16_t * l=&orgmap[0][0]; l<currentorg; l+=2)
+ {
+ // Write the segment data
+ uint32_t unused = write(ofd, p + l[0], l[1] - l[0]);
+ }
+}
+
+
//
// Generate a C64 .PRG output file
//
regtab = reg56tab;
regcheck = reg56check;
regaccept = reg56accept;
+ used_architectures |= M56001P | M56001X | M56001Y | M56001L;
return 0;
}
regtab = regrisctab;
regcheck = regrisccheck;
regaccept = regriscaccept;
+ //used_architectures |= MGPU; // TODO: Should GPU/DSP have their own dedicated sections in the long run?
return 0;
}
regtab = regrisctab;
regcheck = regrisccheck;
regaccept = regriscaccept;
+ //used_architectures |= MDSP; // TODO: Should GPU/DSP have their own dedicated sections in the long run?
return 0;
}
rgpu = 0; // Unset GPU assembly
rdsp = 0; // Unset DSP assembly
dsp56001 = 0; // Unset 56001 assembly
+ //used_architectures |= MOP; // TODO: Should OP have its own dedicated section in the long run?
return OK;
}
}
else if (obj_format == RAW)
{
- if (!org68k_active)
+ if (!org68k_active && used_architectures & (!(M6502 | M56001P | M56001X | M56001Y | M56001L)))
return error("cannot output absolute binary without a starting address (.org or command line)");
+ if (used_architectures & M6502)
+ {
+ // Okay, this is not the best. But it'll have to do until we revamp things a bit with sections.
+ // Basically we assume that if raw output is requested and 6502 mode was switched on, nobody
+ // switched to other architectures. The combination doesn't make much sense anyway for now.
+ m6502raw(fd);
+ return 0;
+ }
+
// Alloc memory for text + data construction.
tds = sect[TEXT].sloc + sect[DATA].sloc;
buf = malloc(tds);
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
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
extern int *regtab;
extern int *regcheck;
extern int *regaccept;
+extern uint32_t used_architectures;
// Exported functions
void strtoupper(char * s);
#define MAJOR 2 // Major version number
#define MINOR 2 // Minor version number
-#define PATCH 11 // Patch release number
+#define PATCH 13 // Patch release number
#endif // __VERSION_H__