}
}
+/*-----------------------------------------------------------------*/
+/* printCLine - try to find the c-code for this lineno */
+/*-----------------------------------------------------------------*/
+static FILE *inFile=NULL;
+static char inLineString[1024];
+static int inLineNo=0;
+int rewinds=0;
+
+char *printCLine (char *srcFile, int lineno) {
+ char *ilsP=inLineString;
+ if (!inFile) {
+ inFile=fopen(srcFile, "r");
+ if (!inFile) {
+ perror ("printCLine");
+ exit (1);
+ }
+ }
+ if (lineno<inLineNo) {
+ fseek (inFile, 0, SEEK_SET);
+ inLineNo=0;
+ rewinds++;
+ }
+ while (fgets (inLineString, 1024, inFile)) {
+ inLineNo++;
+ if (inLineNo==lineno) {
+ // remove the trailing NL
+ inLineString[strlen(inLineString)-1]='\0';
+ break;
+ }
+ }
+ while (isspace ((int)*ilsP))
+ ilsP++;
+
+ return ilsP;
+}
+
static const ASM_MAPPING _asxxxx_mapping[] =
{
{"labeldef", "%s::"},
{NULL, NULL}
};
+static const ASM_MAPPING _xa_asm_mapping[] =
+{
+ {"labeldef", "%s:"},
+ {"slabeldef", "%s:"},
+ {"tlabeldef", "L%05d:"},
+ {"tlabel", "L%05d"},
+ {"immed", "#"},
+ {"zero", "#0"},
+ {"one", "#1"},
+ {"area", ".area %s"},
+ {"areacode", ".area %s"},
+ {"areadata", ".area %s"},
+ {"areahome", ".area %s"},
+ {"ascii", ".db \"%s\""},
+ {"ds", ".ds %d"},
+ {"db", ".db"},
+ {"dbs", ".db \"%s\""},
+ {"dw", ".dw"},
+ {"dws", ".dw %s"},
+ {"constbyte", "0%02xh"},
+ {"constword", "0%04xh"},
+ {"immedword", "#0%04Xh"},
+ {"immedbyte", "#0%02Xh"},
+ {"hashedstr", "#%s"},
+ {"lsbimmeds", "#<%s"},
+ {"msbimmeds", "#>%s"},
+ {"module", "; .module %s"},
+ {"global", ".globl %s"},
+ {"fileprelude", ""},
+ {"functionheader",
+ "; ---------------------------------\n"
+ "; Function %s\n"
+ "; ---------------------------------"
+ },
+ {"functionlabeldef", "%s:"},
+ {"bankimmeds", "0 ; PENDING: bank support"},
+ {"los","(%s & 0FFh)"},
+ {"his","((%s / 256) & 0FFh)"},
+ {"hihis","((%s / 65536) & 0FFh)"},
+ {"hihihis","((%s / 16777216) & 0FFh)"},
+ {"lod","(%d & 0FFh)"},
+ {"hid","((%d / 256) & 0FFh)"},
+ {"hihid","((%d / 65536) & 0FFh)"},
+ {"hihihid","((%d / 16777216) & 0FFh)"},
+ {"lol","(L%05d & 0FFh)"},
+ {"hil","((L%05d / 256) & 0FFh)"},
+ {"hihil","((L%05d / 65536) & 0FFh)"},
+ {"hihihil","((L%09d / 16777216) & 0FFh)"},
+ {"equ"," equ"},
+ {NULL, NULL}
+};
+
const ASM_MAPPINGS asm_asxxxx_mapping =
{
NULL,
NULL,
_a390_mapping
};
+
+const ASM_MAPPINGS asm_xa_asm_mapping =
+{
+ NULL,
+ _xa_asm_mapping
+};