From e2a1963d2ddaf89d33494212a0a16f7a368797e0 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Fri, 11 Mar 2011 13:37:30 +0900 Subject: [PATCH 1/1] =?utf8?q?=E5=AE=9F=E8=A1=8C=E6=99=82=E3=80=81?= =?utf8?q?=E3=83=90=E3=82=A4=E3=83=8A=E3=83=AA=E3=81=8B=E3=82=89COMET=20II?= =?utf8?q?=E4=BB=A5=E5=A4=96=E3=81=AE=E5=80=A4=E3=82=92=E8=AA=AD=E3=81=BF?= =?utf8?q?=E8=BE=BC=E3=82=93=E3=81=A0=E5=A0=B4=E5=90=88=E3=81=AF=E3=82=A8?= =?utf8?q?=E3=83=A9=E3=83=BC=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B?= =?utf8?q?=E3=82=88=E3=81=86=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/struct.h | 4 ++++ src/assemble.c | 6 +++--- src/cmd.c | 2 +- src/exec.c | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/struct.h b/include/struct.h index 88ceb16..39f874b 100644 --- a/include/struct.h +++ b/include/struct.h @@ -84,6 +84,10 @@ typedef enum { * オペランドなし */ NONE = 0, + /** + * COMET II命令以外 + */ + NOTCMD = 077, } CMDTYPE; /** diff --git a/src/assemble.c b/src/assemble.c index 10b9dea..f9d2ea7 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -148,7 +148,7 @@ bool assemblecmd(const CMDLINE *cmdl, PASS pass) } /* プログラム名の設定 */ asptr->prog = strdup_chk(cmdl->label, "asptr.prog"); - /* オペランドがある場合、実行開始番地を設定 */ + /* オペランドがある場合、実行開始アドレスを設定 */ if(pass == SECOND && cmdl->opd->opdc == 1) { if((execptr->start = getlabel(asptr->prog, cmdl->opd->opdv[0])) == 0xFFFF) { setcerr(103, cmdl->opd->opdv[0]); /* label not found */ @@ -157,11 +157,11 @@ bool assemblecmd(const CMDLINE *cmdl, PASS pass) status = true; break; case END: - /* 1回目のアセンブルの場合は、リテラル領域開始番地を設定 */ + /* 1回目のアセンブルの場合は、リテラル領域開始アドレスを設定 */ if(pass == FIRST) { asptr->lptr = asptr->ptr; } - /* 2回目のアセンブルの場合は、リテラル領域終了番地を実行終了番地として設定 */ + /* 2回目のアセンブルの場合は、リテラル領域終了アドレスを実行終了アドレスとして設定 */ else if(pass == SECOND) { execptr->end = asptr->lptr; } diff --git a/src/cmd.c b/src/cmd.c index cc7a207..53d3944 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -208,7 +208,7 @@ CMDTYPE getcmdtype(WORD code) return np->cmd->type; } } - return NONE; + return NOTCMD; } /** diff --git a/src/exec.c b/src/exec.c index 7034e19..8530640 100644 --- a/src/exec.c +++ b/src/exec.c @@ -17,6 +17,7 @@ static CERR cerr_exec[] = { { 206, "Address - out of COMET II memory" }, { 207, "Stack Pointer (SP) - out of COMET II memory" }, { 209, "not GR in operand x" }, + { 210, "not command code of COMET II" }, }; /** @@ -380,7 +381,9 @@ bool exec() /* 命令の取り出し */ op = sys->memory[sys->cpu->pr] & 0xFF00; /* 命令の解読 */ - cmdtype = getcmdtype(op); + if((cmdtype = getcmdtype(op)) == NOTCMD) { + setcerr(210, pr2str(sys->cpu->pr)); /* not command code of COMET II */ + } r_r1 = (sys->memory[sys->cpu->pr] >> 4) & 0xF; x_r2 = sys->memory[sys->cpu->pr] & 0xF; /* traceオプション指定時、レジスタを出力 */ -- 2.18.0