X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fexec.c;h=4bbe3509fb51885e3c6d1397f63b20184e9e2d1a;hb=refs%2Ftags%2Fv0.1p19;hp=e19b415929d46673a6fb7060e6567b0c70123a38;hpb=d1f82970bf7d41db2fea11b08cd8e308f6cb8138;p=YACASL2.git diff --git a/src/exec.c b/src/exec.c index e19b415..4bbe350 100644 --- a/src/exec.c +++ b/src/exec.c @@ -5,12 +5,11 @@ #include "exec.h" #include "cerr.h" -/* 実行エラーの定義 */ -static CERR cerr_loadassemble[] = { - { 201, "Loading - full of COMET II memory" }, -}; - +/** + * 実行エラーの定義 + */ static CERR cerr_exec[] = { + { 201, "Loading - full of COMET II memory" }, { 202, "SVC input - out of Input memory" }, { 203, "SVC output - out of COMET II memory" }, { 204, "Program Register (PR) - out of COMET II memory" }, @@ -24,14 +23,22 @@ static CERR cerr_exec[] = { */ EXECMODE execmode = {false, false, false}; +/** + * 実行エラーをエラーリストに追加 + */ +bool addcerrlist_exec() +{ + return addcerrlist(ARRAYSIZE(cerr_exec), cerr_exec); +} + /** * 指定されたファイルからアセンブル結果を読み込む */ -bool loadassemble(char *file) { +bool loadassemble(char *file) +{ FILE *fp; bool status = true; - addcerrlist(ARRAYSIZE(cerr_exec), cerr_loadassemble); /* エラーリスト作成 */ assert(file != NULL); if((fp = fopen(file, "r")) == NULL) { perror(file); @@ -334,7 +341,6 @@ bool exec() char *errpr = malloc_chk(CERRSTRSIZE + 1, "exec.errpr"); clock_t clock_begin, clock_end; - addcerrlist(ARRAYSIZE(cerr_exec), cerr_exec); /* エラーリスト作成 */ if(execmode.trace == true) { fprintf(stdout, "\nExecuting machine codes\n"); } @@ -409,7 +415,7 @@ bool exec() } } free_chk(errpr, "errpr"); - /* 主オペランドが1〜4の場合、第2ビットを無視 */ + /* 主オペランドが1から4の場合、第2ビットを無視 */ if(op >= 0x1000 && op <= 0x4FFF) { op &= 0xFB00; } @@ -530,6 +536,7 @@ bool exec() default: break; } + /* クロック周波数の設定 */ do { clock_end = clock(); } while(clock_end - clock_begin < CLOCKS_PER_SEC / sys->clocks);