diff --git a/emul.exe.stackdump b/emul.exe.stackdump deleted file mode 100644 index 605ba5d..0000000 --- a/emul.exe.stackdump +++ /dev/null @@ -1,23 +0,0 @@ -Exception: STATUS_ACCESS_VIOLATION at rip=001801A4281 -rax=0000000184429320 rbx=8080808080808080 rcx=FEFEFEFF0F000003 -rdx=00000000FFFFC981 rsi=FEFEFEFEFEFEFEFF rdi=00000000FFFFCDF0 -r8 =0000000184429321 r9 =000000000000004C r10=FEFEFEFEFF0F0000 -r11=FEFEFEFEFF4F4E4E r12=0000000000000000 r13=0000000000000000 -r14=0000000000000000 r15=0000000000000000 -rbp=00000000FFFFC900 rsp=00000000FFFFC8C8 -program=C:\cygwin64\home\takayun\dev\emul\emul.exe, pid 3840, thread main -cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B -Stack trace: -Frame Function Args -000FFFFC900 001801A4281 (003FECFD45B, 000FFFFC930, 00100402720, 000FFFFC930) -000FFFFC900 00100402CEB (00000000016, 00000000008, 00000000004, 000FFFFCA10) -000FFFFC930 00100401E57 (00000000016, 000FFFFCAB0, 00000000001, 00180347688) -000FFFFCA10 00100402020 (0000000003A, 0010042904C, 00000000000, 00600038550) -000FFFFCB10 0010040211C (00000000016, 00100409AAC, 00000000000, 00100000040) -000FFFFCB50 00100402484 (00000000015, 00100429041, 00000000000, 4C204C4542414C3A) -000FFFFCBD0 00100403220 (00000000039, 00000000000, 2F656D6F682F3D5F, 00000000000) -000FFFFCC10 0010040118B (000FFFFCC60, 300010F0100FF00, 00180047B61, 000FFFFD680) -000FFFFCCC0 00180047BD2 (00000000000, 00000000000, 00000000000, 00000000000) -00000000000 0018004591C (00000000000, 00000000000, 00000000000, 00000000000) -000FFFFFFF0 001800459B4 (00000000000, 00000000000, 00000000000, 00000000000) -End of stack trace diff --git a/emul_inst_decipher.c b/emul_inst_decipher.c index fe0d02a..7a9b78c 100644 --- a/emul_inst_decipher.c +++ b/emul_inst_decipher.c @@ -69,7 +69,7 @@ }; -#define PSEUDO_COUNT 22 +#define PSEUDO_COUNT 24 emul_pseudo_t pseudo_dict[REG_COUNT] = { { DUMP , ":DUMP" }, { DUMP , ":dump" }, @@ -91,6 +91,8 @@ { OUTPUT , ":output" }, { CRLF , ":CRLF" }, { CRLF , ":crlf" }, + { EXEC , ":EXEC" }, + { EXEC , ":exec" }, { EXIT , ":EXIT" }, { EXIT , ":exit" } }; diff --git a/emul_inst_exec.c b/emul_inst_exec.c index 2f2d103..7d1dedd 100644 --- a/emul_inst_exec.c +++ b/emul_inst_exec.c @@ -267,6 +267,10 @@ emul_out_std("\n"); } +void emul_inst_exec_pseudo_exec(char *filename) { + emul_inst_exec_load(filename); +} + /* :Exit * プログラムを正常終了 */ void emul_inst_exec_pseudo_exit() { @@ -340,6 +344,12 @@ case CRLF: emul_inst_exec_pseudo_crlf(); break; + case EXEC: + emul_inst_dec_get_token(label); + emul_inst_exec_pseudo_exec( + label + ); + break; case EXIT: emul_inst_exec_pseudo_exit(); break; diff --git a/emul_inst_pseudo.h b/emul_inst_pseudo.h index 1981881..88710e8 100644 --- a/emul_inst_pseudo.h +++ b/emul_inst_pseudo.h @@ -56,6 +56,10 @@ * 画面へ改行コードを送信する,改行コードについて決まりはない */ CRLF, + /* :EXEC + * 現在のプログラムへFILEから読み込んだプログラムを追記する */ + EXEC, + /* プログラムを正常終了する */ EXIT diff --git a/emul_repl.c b/emul_repl.c index f5df076..9302b2c 100644 --- a/emul_repl.c +++ b/emul_repl.c @@ -19,15 +19,40 @@ void emul_repl_init() { emul_inst_exec_init(); + // ウィンドウポインタ取得 + win = emul_getWin(); + keypad(win, TRUE); } +char *menu[] = { + "Display help >>:help", + " Exit >>:exit" +}; + void emul_repl_start() { char input[READ_LINE_MAX]; exitcode_t state; + int y, x; + char *title = "Wellcome!"; + int i,j; emul_repl_init(); - // ウィンドウポインタ取得 - win = emul_getWin(); + + // title + getmaxyx(win, y, x); + move(y/2-2, (x-strlen(title))/2); + printw("%s", title); + for (int i = 0; i < 2; i++) { + move(y/2+i, (x-strlen(menu[i]))/2); + printw("%s", menu[i]); + } + move(0, 0); + printw(""); + refresh(); + getch(); + wclear(win); + refresh(); + while (1) { emul_repl_readline(input);