X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Fexec.c;h=5dc4eb101ae845ce927e08fab6e2ca3320fc8db6;hp=ab0a133a86939e838f1c04211c22b3309888c05d;hb=4aaa5bc19f9fe9f0bb22d2854e91d0b9f78d8708;hpb=539d2aa8319c65bd9782de8782deb45fae28243c diff --git a/src/exec.c b/src/exec.c index ab0a133..5dc4eb1 100644 --- a/src/exec.c +++ b/src/exec.c @@ -529,7 +529,7 @@ void svc(const WORD r, const WORD adr) bool exec() { WORD op, r_r1, x_r2, val; - CMDTYPE cmdtype; + CMD *cmd; void (*cmdptr)(); clock_t clock_begin, clock_end; @@ -574,16 +574,16 @@ bool exec() op = sys->memory[sys->cpu->pr] & 0xFF00; /* 命令の解読 */ /* 命令がCOMET II命令ではない場合はエラー終了 */ - if((cmdtype = getcmdtype(op)) == NOTCMD) { + if((cmd = getcmd(op)) == NULL) { setcerr(210, pr2str(sys->cpu->pr)); /* not command code of COMET II */ goto execerr; } - cmdptr = getcmdptr(op); + cmdptr = cmd->ptr; r_r1 = (sys->memory[sys->cpu->pr] >> 4) & 0xF; x_r2 = sys->memory[sys->cpu->pr] & 0xF; sys->cpu->pr++; /* オペランドの取り出し */ - if(cmdtype == R1_R2) { + if(cmd->type == R1_R2) { /* オペランドの数値が汎用レジスタの範囲外の場合はエラー */ if(x_r2 > GRSIZE - 1) { setcerr(209, pr2str(sys->cpu->pr-1)); /* not GR in operand x */ @@ -591,7 +591,7 @@ bool exec() } val = sys->cpu->gr[x_r2]; } - else if(cmdtype == R_ADR_X || cmdtype == R_ADR_X_ || cmdtype == ADR_X) { + else if(cmd->type == R_ADR_X || cmd->type == R_ADR_X_ || cmd->type == ADR_X) { /* オペランドの数値が汎用レジスタの範囲外の場合はエラー */ if(x_r2 > GRSIZE - 1) { setcerr(209, pr2str(sys->cpu->pr-1)); /* not GR in operand x */ @@ -604,7 +604,7 @@ bool exec() val += sys->cpu->gr[x_r2]; } /* ロード/算術論理演算命令/比較演算命令では、アドレスに格納されている内容を取得 */ - if(cmdtype == R_ADR_X_) { + if(cmd->type == R_ADR_X_) { if(val >= sys->memsize) { setcerr(206, pr2str(sys->cpu->pr-1)); /* Address - out of COMET II memory */ goto execerr;