X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fexec.c;h=353dc24b8cdb649d730655c64adaa8167802133a;hb=f656c0e92ba6a746a6301bc8a26c6f5b5a4cdc3a;hp=29b1afc264367ce9c986599b9ff49d0486d31bc5;hpb=87da65b534d88b60dcfb59ff1252101daf35e44e;p=YACASL2.git diff --git a/src/exec.c b/src/exec.c index 29b1afc..353dc24 100644 --- a/src/exec.c +++ b/src/exec.c @@ -1,6 +1,9 @@ #include "casl2.h" #include "exec.h" +/* 実行モード: trace, logical, dump */ +EXECMODE execmode = {false, false, false}; + /* 標準入力から文字データを読込(SVC 1) */ void svcin() { @@ -149,7 +152,7 @@ WORD sla(WORD val0, WORD val1) last = res & 0x4000; res <<= 1; } - res = sign | res; + res = sign | (res & 0x7FFF); /* OFに、レジスタから最後に送り出されたビットの値を設定 */ if(last > 0x0) { FR += OF; @@ -273,7 +276,7 @@ void exec() char *errpr = malloc(8); clock_t clock_begin, clock_end; - if((&execmode)->tracemode) { + if((&execmode)->trace) { fprintf(stdout, "\nExecuting machine codes\n"); } /* フラグレジスタの初期値設定 */ @@ -309,15 +312,15 @@ void exec() if(cerrno > 0) { goto execerr; } - if((&execmode)->tracemode){ + if((&execmode)->trace){ fprintf(stdout, "#%04X: Register::::\n", PR); dspregister(); } - if((&execmode)->dumpmode){ + if((&execmode)->dump){ fprintf(stdout, "#%04X: Memory::::\n", PR); dumpmemory(); } - if((&execmode)->dumpmode || (&execmode)->tracemode) { + if((&execmode)->dump || (&execmode)->trace) { fprintf(stdout, "\n"); } PR++;