/* 他のプログラムで参照する入口名 */
char *prog;
+/* アセンブルモード: src, label, onlylabel, asdetail, onlyassemble */
+ASMODE asmode = {false, false, false, false, false};
+
/* 汎用レジスタを表す文字列「GR[0-7]」から、レジスタ番号[0-7]をWORD値で返す */
/* 文字列が汎用レジスタを表さない場合は、0xFFFFを返す */
/* is_xがtrueの場合は指標レジスタ。GR0は、COMET IIの仕様により、エラー発生 */
CMDARRAY ascmd[] = {
{ START, 0, 1, "START" },
{ END, 0, 0, "END" },
- { DC, 0, OPDSIZE, "DC" },
+ { DC, 1, OPDSIZE, "DC" },
{ DS, 1, 1, "DS" },
{ 0, 0, 0, NULL }
};
return status;
}
-void printline(FILE *stream, const char *filename, int lineno, char *line) {
- fprintf(stream, "%s:%5d:%s", filename, lineno, line);
-}
-
/* 指定された名前のファイルをアセンブル */
/* 2回実行される */
bool assemble(const char *file, PASS pass)
if((pass == FIRST && (&asmode)->src == true) ||
(pass == SECOND && (&asmode)->asdetail == true))
{
- printline(stdout, file, lineno, line);
+ fprintf(stdout, "%s:%5d:%s", file, lineno, line);
}
if((cmdl = linetok(line)) != NULL) {
if(pass == FIRST && cmdl->label != NULL) {
}
}
if(cerrno > 0) {
- fprintf(stderr, "Assemble error - %d: %s\n", cerrno, cerrmsg);
- printline(stderr, file, lineno, line);
+ fprintf(stderr, "Assemble error - %d: %s\n %s:%d: %s\n", cerrno, cerrmsg, file, lineno, line);
status = false;
}
fclose(fp);