-/* 汎用レジスタを表す文字列「GR[0-7]」をWORD値に変換
- is_xがtrueの場合は、指標レジスタとして用いる汎用レジスタ
- 文字列が汎用レジスタを表さない場合は、0xFFFFを返す */
-WORD getgr(const char *str, bool is_x)
-{
- assert(str != NULL);
- WORD r;
- if(!(strlen(str) == 3 && strncmp(str, "GR", 2) == 0 &&
- (*(str+2) >= '0' && *(str+2) <= '7')))
- {
- return 0xFFFF;
- }
- r = (WORD)(*(str+2) - '0');
- /* COMET IIの仕様により、GR0は指標レジスタとして用いることはできない */
- if(is_x == true && r == 0x0) {
- setcerr(120, NULL); /* GR0 in operand x */
- return 0x0;
- }
- return r;
-}
+/**
+ * アセンブルのエラー定義
+ */
+static CERR cerr_assemble[] = {
+ { 106, "operand mismatch in assemble command" },
+ { 107, "no label in START" },
+ { 108, "not command of operand \"r\"" },
+ { 109, "not command of operand \"r1,r2\"" },
+ { 110, "not command of operand \"r,adr[,x]\"" },
+ { 111, "not command of operand \"adr[,x]\"" },
+ { 112, "not command of no operand" },
+ { 113, "operand too many in COMET II command" },
+ { 119, "out of COMET II memory" },
+ { 120, "GR0 in operand x" },
+ { 122, "cannot create hash table" },
+ { 124, "more than one character in literal" },
+ { 125, "not GR in operand x" },
+};
+
+void printline(FILE *stream, const char *filename, int lineno, char *line);
+
+WORD getadr(const char *prog, const char *str, PASS pass);
+
+WORD getgr(const char *str, bool is_x);
+
+WORD getliteral(const char *str, PASS pass);
+
+void writememory(WORD word, WORD adr, PASS pass);
+
+void writestr(const char *str, bool literal, PASS pass);
+
+void writedc(const char *str, PASS pass);