]> j8takagi.net git repositories - yacasl2.git/commitdiff
コマンド実行時のクロック周波数とメモリサイズの指定時にチェックするように v0.5p48
authorj8takagi <j8takagi@nifty.com>
Mon, 8 Jun 2026 11:16:35 +0000 (20:16 +0900)
committerj8takagi <j8takagi@nifty.com>
Mon, 8 Jun 2026 11:16:35 +0000 (20:16 +0900)
63 files changed:
VERSION
as/sample/test.casl [new file with mode: 0644]
include/cmem.h
include/exec.h
include/struct.h
src/casl2.c
src/cmem.c
src/comet2.c
src/comet2monitor.c
src/exec.c
src/load.c
src/struct.c
test/system/casl2_err/err_202_memsize1/0.txt [new file with mode: 0644]
test/system/casl2_err/err_202_memsize1/Makefile [new file with mode: 0644]
test/system/casl2_err/err_202_memsize1/cmd [new file with mode: 0755]
test/system/casl2_err/err_optC_-1/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optC_-1/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optC_-1/cmd [new file with mode: 0755]
test/system/casl2_err/err_optC_0/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optC_0/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optC_0/cmd [new file with mode: 0755]
test/system/casl2_err/err_optC_1.5/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optC_1.5/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optC_1.5/cmd [new file with mode: 0755]
test/system/casl2_err/err_optC_abc/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optC_abc/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optC_abc/cmd [new file with mode: 0755]
test/system/casl2_err/err_optM_-1/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optM_-1/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optM_-1/cmd [new file with mode: 0755]
test/system/casl2_err/err_optM_0/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optM_0/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optM_0/cmd [new file with mode: 0755]
test/system/casl2_err/err_optM_1.5/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optM_1.5/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optM_1.5/cmd [new file with mode: 0755]
test/system/casl2_err/err_optM_65537/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optM_65537/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optM_65537/cmd [new file with mode: 0755]
test/system/casl2_err/err_optM_abc/0.txt [new file with mode: 0644]
test/system/casl2_err/err_optM_abc/Makefile [new file with mode: 0644]
test/system/casl2_err/err_optM_abc/cmd [new file with mode: 0755]
test/system/casl2_opt/opt_C_1/0.txt [new file with mode: 0644]
test/system/casl2_opt/opt_C_1/Makefile [new file with mode: 0644]
test/system/casl2_opt/opt_C_1/cmd [new file with mode: 0755]
test/system/casl2_opt/opt_C_1000/0.txt [new file with mode: 0644]
test/system/casl2_opt/opt_C_1000/Makefile [new file with mode: 0644]
test/system/casl2_opt/opt_C_1000/cmd [new file with mode: 0755]
test/system/casl2_opt/opt_C_1000000/0.txt [new file with mode: 0644]
test/system/casl2_opt/opt_C_1000000/Makefile [new file with mode: 0644]
test/system/casl2_opt/opt_C_1000000/cmd [new file with mode: 0755]
test/system/casl2_opt/opt_C_1000001/0.txt [new file with mode: 0644]
test/system/casl2_opt/opt_C_1000001/Makefile [new file with mode: 0644]
test/system/casl2_opt/opt_C_1000001/cmd [new file with mode: 0755]
test/system/casl2_opt/opt_M_2/0.txt [new file with mode: 0644]
test/system/casl2_opt/opt_M_2/Makefile [new file with mode: 0644]
test/system/casl2_opt/opt_M_2/cmd [new file with mode: 0755]
test/system/casl2_opt/opt_M_512/0.txt [new file with mode: 0644]
test/system/casl2_opt/opt_M_512/Makefile [new file with mode: 0644]
test/system/casl2_opt/opt_M_512/cmd [new file with mode: 0755]
test/system/casl2_opt/opt_M_65535/0.txt [new file with mode: 0644]
test/system/casl2_opt/opt_M_65535/Makefile [new file with mode: 0644]
test/system/casl2_opt/opt_M_65535/cmd [new file with mode: 0755]

diff --git a/VERSION b/VERSION
index f148788ee101dc1a674b06c9e9247d10184aba43..f3d98b8fb5d106dfc4d66d2fc6665980676d2ec6 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-v0.5p47
+v0.5p48
diff --git a/as/sample/test.casl b/as/sample/test.casl
new file mode 100644 (file)
index 0000000..5356eba
--- /dev/null
@@ -0,0 +1,3 @@
+TEST    START
+        RET
+        END
index f8ccf50d608a37faa406e43ca58bd9d46ccdea18..622f4d30df23537bb3eda9d7130c5057ffcaf258 100644 (file)
@@ -6,6 +6,7 @@
 #include <string.h>
 #include <assert.h>
 #include <stdbool.h>
+#include <limits.h>
 
 /**
  * @brief 配列のサイズを返すマクロ
 #define FREE(ptr) {free(ptr); ptr = NULL;}
 #endif
 
+/**
+ * @brief 数値文字列が特定の範囲の数値かチェックし、正の場合は変換した数値、不正の場合は0を返す
+ *
+ * @param str 数値文字列
+ * @param min 範囲最小値
+ * @param min 範囲最大値
+ * @param tag エラーメッセージなどで表示される名前
+ *
+ */
+long str2l_range(const char *str, long min, long max, const char *name);
+
 /**
  * @brief mallocを実行し、0で初期化する
  *
index 9a8a45bf5dec5bbd2003b4a1bee2ef751333c9e6..855efee4dea0bd5d2cd576eaee71c224421c56af 100644 (file)
@@ -14,6 +14,15 @@ enum {
     INSIZE = 256    /**<IN命令の、入力領域 */
 };
 
+/**
+ * @brief クロック周波数を表す文字列を正しいかチェックし、正の整数値に変換
+  *
+ * @return クロック周波数を表す正の整数値
+ *
+ * @param str クロック周波数を表す文字列
+ */
+CLOCK clock_str2clock(const char *str);
+
 /**
  * @brief 実行エラーをエラーリストに追加する
  */
index 746975ed7829f87ee6ecae3fd44274cae5b05e6e..0fed02075ab7a6b874786f8a0d9e3ebf499ae6dc 100644 (file)
@@ -9,14 +9,18 @@
 #include "cmem.h"
 #include "hash.h"
 
+typedef unsigned int CLOCK;
+
 /**
  * @brief COMET IIの規格値
  */
 enum {
     CMDSIZE = 4,              /**<命令の最大文字数 */
-    GRSIZE = 8,               /**<汎用レジスタの数。COMET II規格では、8(0から7) */
-    DEFAULT_MEMSIZE = 512,    /**<デフォルトのメモリ容量。COMET II規格では、65535語(word) */
-    DEFAULT_CLOCKS = 5000000, /**<デフォルトのクロック周波数。COMET II規格では、未定義 */
+    GRSIZE = 8,               /**<汎用レジスタの数。COMET II規格で、GR0〜GR7までの8 */
+    MAX_MEMSIZE = 65536,      /**<メモリ容量の最大値。COMET II規格で、アドレス0~65535の65536語(word) */
+    DEFAULT_MEMSIZE = 512,    /**<メモリ容量の初期値。COMET II規格では、アドレス0~65535の65536語(word) */
+    MAX_CLOCKS = 1000000,     /**<クロック周波数の最大値。POSIXのCLOCKS_PER_SECと同値 */
+    DEFAULT_CLOCKS = MAX_CLOCKS, /**<クロック周波数の初期値。最大値と同値 */
 };
 
 /**
@@ -44,8 +48,8 @@ typedef struct {
 typedef struct {
     CPU *cpu;        /**<CPU */
     WORD *memory;    /**<メモリ */
-    int memsize;     /**<メモリサイズ */
-    clock_t clocks;  /**<クロック周波数 */
+    WORD memsize;     /**<メモリサイズ */
+    CLOCK clocks;    /**<クロック周波数 */
 } SYSTEM;
 
 /**
@@ -162,13 +166,25 @@ extern EXECMODE execmode;
 char *grstr(WORD word);
 
 /**
- * COMET II仮想マシンのリセット
+ * @brief メモリーサイズとして受け取った文字列をに変換。1から65536までの範囲の整数に変換できない場合はエラー
+ *
+ * @return メモリーサイズの数値。1から65536までの範囲の整数
+ *
+ * @param str メモリーサイズ文字列
  */
-void comet2_init(int memsize, int clocks);
+WORD memsize_str2word(const char *str);
 
 /**
- * COMET II仮想マシンのCPUをリセット
+ * @brief COMET II仮想マシンの初期化
+ *
+ * @param memsize メモリーサイズ。1から65535までの範囲の整数
+ * @param clocks クロック数。1から1000000までの範囲の整数
  */
+void comet2_init(WORD memsize, CLOCK clocks);
+
+/**
+ * @brief COMET II仮想マシンのCPUをリセット
+  */
 void comet2_reset();
 
 /**
@@ -177,7 +193,7 @@ void comet2_reset();
 void comet2_resetall();
 
 /**
- * COMET II仮想マシンのシャットダウン
+ * @brief COMET II仮想マシンのシャットダウン
  */
 void comet2_shutdown();
 
index 4292fdf31ae606ec0829ea782b364101609ae40d..9ef67a445f619f3ea27ee303c8822e2010abbdcb 100644 (file)
@@ -16,7 +16,7 @@ void addcerrlist_casl2();
  *
  * @param *str ファイル名
  */
-char *objfile_name(const char *str);
+char *objfile_name(const char *name);
 
 /**
  * @brief casl2コマンドのオプション
@@ -132,10 +132,14 @@ int main(int argc, char *argv[])
             execmode.step = true;
             break;
         case 'M':
-            memsize = atoi(optarg);
+            if((memsize = memsize_str2word(optarg)) == 0) {
+                goto casl2fin;
+            }
             break;
         case 'C':
-            clocks = atoi(optarg);
+            if((clocks = clock_str2clock(optarg)) == 0) {
+                goto casl2fin;
+            }
             break;
         case 'v':
             fprintf(stdout, cmdversion, version);
index bd6328d94ef80bdfadc72153fc51b5c2105cb6a6..ba899258fd09eefb9c5db1d041cf8c00adb301d3 100644 (file)
@@ -1,5 +1,25 @@
 #include "cmem.h"
 
+long str2l_range(const char *str, long min, long max, const char *name) {
+    char *endptr = NULL;
+    long val = strtol(str, &endptr, 10);
+    if(endptr == str) {
+        fprintf(stderr, "%s: Not specified.\n", name);
+        return 0;
+    } else if(*endptr != '\0') {
+        fprintf(stderr, "%s: `%s' is not integer.\n", name, str);
+        return 0;
+    } else if(val < min || max < val) {
+        if(max == LONG_MAX) {
+            fprintf(stderr, "%s: %s out of range: %ld -\n", str, name, min);
+        } else {
+            fprintf(stderr, "%s: %s out of range: %ld - %ld\n", str, name, min, max);
+        }
+        return 0;
+    }
+    return val;
+}
+
 void *malloc_chk(size_t size, const char *tag)
 {
     void *p = NULL;
index 6da125948dbe0882108d95bd895e5a3ef2bf335d..b3f59a9d1b412f4195413914f1ffe6ef1da17fda 100644 (file)
@@ -60,10 +60,14 @@ int main(int argc, char *argv[])
             execmode.monitor = true;
             break;
         case 'M':
-            memsize = atoi(optarg);
+            if((memsize = memsize_str2word(optarg)) == 0) {
+                goto comet2fin;
+            }
             break;
         case 'C':
-            clocks = atoi(optarg);
+            if((clocks = clock_str2clock(optarg)) == 0) {
+                goto comet2fin;
+            }
             break;
         case 'v':
             fprintf(stdout, cmdversion, version);
index cd429be10849cc468dfa828cf302f910caf27cd2..0b9a53e066ce58af0f533d2642f98d831b1bc6cd 100644 (file)
@@ -55,10 +55,14 @@ int main(int argc, char *argv[])
     while((opt = getopt_long(argc, argv, "M:C:vh", longopts, NULL)) != -1) {
         switch(opt) {
         case 'M':
-            memsize = atoi(optarg);
+            if((memsize = memsize_str2word(optarg)) == 0) {
+                goto comet2monitorfin;
+            }
             break;
         case 'C':
-            clocks = atoi(optarg);
+            if((clocks = clock_str2clock(optarg)) == 0) {
+                goto comet2monitorfin;
+            }
             break;
         case 'v':
             fprintf(stdout, cmdversion, version);
index ae8c9e2a2ca5237a06a9613c43baaa6dd364ae56..e80421bd05478112f7ab9e37feb2f96761fb6849 100644 (file)
@@ -80,6 +80,8 @@ static CERR cerr_exec[] = {
     { 207, "address in word #2 - out of memory" },
     { 208, "SVC input - memory overflow" },
     { 209, "SVC output - memory overflow" },
+    { 214, "CPU Clocks - not positive integer" },
+    { 215, "Memory Size - not integer or out of range: 1 - 65536" },
 };
 
 /**
@@ -87,6 +89,15 @@ static CERR cerr_exec[] = {
  */
 EXECMODE execmode = {false, false, false, 0, 0xFFFF, false, false};
 
+CLOCK clock_str2clock(const char *str) {
+    long val = str2l_range(str, 1, LONG_MAX, "Clock");
+    if(val > MAX_CLOCKS) {
+        val = MAX_CLOCKS;
+        fprintf(stderr, "Info - %s: Clock frequency exceeds maximum. Set to %ld\n", str, val);
+    }
+    return (CLOCK)val;
+}
+
 char *pr2str(WORD pr)
 {
     char *str = malloc_chk(CERRSTRSIZE + 1, "pr2str.pr");
@@ -110,7 +121,8 @@ void svcin()
             break;
         }
         if(sys->cpu->gr[1] + i > execptr->end) {
-            setcerr(208, "");    /* SVC input - memory overflow */
+            setcerr
+                (208, "");    /* SVC input - memory overflow */
             break;
         }
         sys->memory[sys->cpu->gr[1] + i] = buf[i];
@@ -672,8 +684,8 @@ void svc()
 
 void exec()
 {
-    clock_t clock_begin = 0;
-    clock_t clock_end = 0;
+    CLOCK clock_begin = 0;
+    CLOCK clock_end = 0;
     void (*cmdptr)() = NULL;
     char *s = NULL;
     const char *monmsg = "COMET II machine code monitor. Type ? for help.\n";
index 5ee775d8dc7debf8b1d7e5f2146eda5434cc072f..8eb83e1e1ce76b745139b0508be446f570d87ce9 100644 (file)
@@ -30,6 +30,7 @@ WORD loadassemble(const char *file, WORD start)
     end = start + fread(sys->memory + start, sizeof(WORD), sys->memsize - start, fp);
     if(end == sys->memsize) {
         setcerr(210, file);    /* load - memory overflow */
+        fprintf(stderr, "Load error - %d: %s\n", cerr->num, cerr->msg);
     }
     fclose(fp);
     return end;
index 444d849a4e1722fd7557d8e614de39e6a76d26cc..086c28644208f4d49e16cda41f297cc93b364985 100644 (file)
@@ -1,3 +1,4 @@
+#include <errno.h>
 #include "struct.h"
 #include "exec.h"
 
@@ -82,6 +83,16 @@ unsigned hash_cmdtype(const char *cmd, CMDTYPE type);
  */
 unsigned hash_code(WORD code);
 
+/**
+ * CPUのリセット
+ */
+void cpu_reset();
+
+/**
+ * メモリのリセット
+ */
+void memory_reset();
+
 /**
  * 命令の名前とタイプからハッシュ値を生成する
  */
@@ -247,39 +258,53 @@ char *grstr(WORD word)
     return str;
 }
 
-void cpu_reset() {
-    sys->cpu = malloc_chk(sizeof(CPU), "cpu");
-    for(int i = 0; i < GRSIZE; i++) {                    /* 汎用レジスタ  */
-        sys->cpu->gr[i] = 0x0;
-    }
-    sys->cpu->sp = sys->memsize;   /* スタックポインタ */
-    sys->cpu->pr = 0x0;            /* プログラムレジスタ */
-    sys->cpu->fr = 0x0;            /* フラグレジスタ */
-}
-
-void memory_reset() {
+WORD memsize_str2word(const char *str) {
+    return (WORD)str2l_range(str, 1, MAX_MEMSIZE, "Memory Size");
 }
 
-
 /**
  * COMET II仮想マシンの初期化
  */
-void comet2_init(int memsize, int clocks)
+void comet2_init(WORD memsize, CLOCK clocks)
 {
     sys = malloc_chk(sizeof(SYSTEM), "sys");
     /* メモリサイズを設定 */
+    assert(0 < memsize && memsize <= MAX_MEMSIZE-1);
     sys->memsize = memsize;
     /* クロック周波数を設定 */
+    assert(0 < clocks && clocks <= MAX_CLOCKS);
     sys->clocks = clocks;
-    /* メモリ領域の確保 */
-    sys->memory = calloc_chk(sys->memsize, sizeof(WORD), "memory");
-    /* CPUã\82\92ã\82¯ã\83ªã\82¢ */
+    /* CPU領域の確保 */
+    sys->cpu = malloc_chk(sizeof(CPU), "comet2_init.cpu");
+    /* CPUã\82\92ã\83ªã\82»ã\83\83ã\83\88 */
     cpu_reset();
+    /* メモリ領域の確保 */
+    sys->memory = calloc_chk(sys->memsize, sizeof(WORD), "comet2_init.memory");
+    /* メモリをリセット */
+    memory_reset();
     /* CASL2プログラムの開始と終了のアドレスを初期化 */
     execptr = malloc_chk(sizeof(EXECPTR), "execptr");
     execptr->stop = false;
 }
 
+
+void cpu_reset() {
+    /* 汎用レジスタ  */
+    for(int i = 0; i < GRSIZE; i++) {
+        sys->cpu->gr[i] = 0x0;
+    }
+    sys->cpu->sp = sys->memsize;   /* スタックポインタ */
+    sys->cpu->pr = 0x0;            /* プログラムレジスタ */
+    sys->cpu->fr = 0x0;            /* フラグレジスタ */
+}
+
+/**
+ * メモリのリセット
+ */
+void memory_reset() {
+    memset(sys->memory, 0, sys->memsize * sizeof(WORD));
+}
+
 /**
  * COMET II仮想マシンのCPUリセット
  */
@@ -297,7 +322,7 @@ void comet2_resetall()
     /* CPUをリセット */
     cpu_reset();
     /* メモリをリセット */
-    memset(sys->memory, 0, sys->memsize * sizeof(WORD));
+    memory_reset();
 }
 
 /**
diff --git a/test/system/casl2_err/err_202_memsize1/0.txt b/test/system/casl2_err/err_202_memsize1/0.txt
new file mode 100644 (file)
index 0000000..ccbdff3
--- /dev/null
@@ -0,0 +1 @@
+Execute error - 202: PR:#0000: Stack Pointer (SP) - stack overflow
diff --git a/test/system/casl2_err/err_202_memsize1/Makefile b/test/system/casl2_err/err_202_memsize1/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_202_memsize1/cmd b/test/system/casl2_err/err_202_memsize1/cmd
new file mode 100755 (executable)
index 0000000..bbe9813
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M1 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optC_-1/0.txt b/test/system/casl2_err/err_optC_-1/0.txt
new file mode 100644 (file)
index 0000000..62e9f44
--- /dev/null
@@ -0,0 +1 @@
+-1: Clock out of range: 1 -
diff --git a/test/system/casl2_err/err_optC_-1/Makefile b/test/system/casl2_err/err_optC_-1/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optC_-1/cmd b/test/system/casl2_err/err_optC_-1/cmd
new file mode 100755 (executable)
index 0000000..fad578a
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -C -1 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optC_0/0.txt b/test/system/casl2_err/err_optC_0/0.txt
new file mode 100644 (file)
index 0000000..9604e87
--- /dev/null
@@ -0,0 +1 @@
+0: Clock out of range: 1 -
diff --git a/test/system/casl2_err/err_optC_0/Makefile b/test/system/casl2_err/err_optC_0/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optC_0/cmd b/test/system/casl2_err/err_optC_0/cmd
new file mode 100755 (executable)
index 0000000..4358be2
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -C 0 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optC_1.5/0.txt b/test/system/casl2_err/err_optC_1.5/0.txt
new file mode 100644 (file)
index 0000000..518625d
--- /dev/null
@@ -0,0 +1 @@
+Clock: `1.5' is not integer.
diff --git a/test/system/casl2_err/err_optC_1.5/Makefile b/test/system/casl2_err/err_optC_1.5/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optC_1.5/cmd b/test/system/casl2_err/err_optC_1.5/cmd
new file mode 100755 (executable)
index 0000000..e1ee190
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -C 1.5 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optC_abc/0.txt b/test/system/casl2_err/err_optC_abc/0.txt
new file mode 100644 (file)
index 0000000..72497c4
--- /dev/null
@@ -0,0 +1 @@
+Clock: Not specified.
diff --git a/test/system/casl2_err/err_optC_abc/Makefile b/test/system/casl2_err/err_optC_abc/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optC_abc/cmd b/test/system/casl2_err/err_optC_abc/cmd
new file mode 100755 (executable)
index 0000000..7a352ab
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -C abc ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optM_-1/0.txt b/test/system/casl2_err/err_optM_-1/0.txt
new file mode 100644 (file)
index 0000000..6a8178f
--- /dev/null
@@ -0,0 +1 @@
+-1: Memory Size out of range: 1 - 65536
diff --git a/test/system/casl2_err/err_optM_-1/Makefile b/test/system/casl2_err/err_optM_-1/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optM_-1/cmd b/test/system/casl2_err/err_optM_-1/cmd
new file mode 100755 (executable)
index 0000000..651193b
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M -1 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optM_0/0.txt b/test/system/casl2_err/err_optM_0/0.txt
new file mode 100644 (file)
index 0000000..e3918ee
--- /dev/null
@@ -0,0 +1 @@
+0: Memory Size out of range: 1 - 65536
diff --git a/test/system/casl2_err/err_optM_0/Makefile b/test/system/casl2_err/err_optM_0/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optM_0/cmd b/test/system/casl2_err/err_optM_0/cmd
new file mode 100755 (executable)
index 0000000..d7d0649
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M 0 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optM_1.5/0.txt b/test/system/casl2_err/err_optM_1.5/0.txt
new file mode 100644 (file)
index 0000000..eb4eb00
--- /dev/null
@@ -0,0 +1 @@
+Memory Size: `1.5' is not integer.
diff --git a/test/system/casl2_err/err_optM_1.5/Makefile b/test/system/casl2_err/err_optM_1.5/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optM_1.5/cmd b/test/system/casl2_err/err_optM_1.5/cmd
new file mode 100755 (executable)
index 0000000..98d338a
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M 1.5 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optM_65537/0.txt b/test/system/casl2_err/err_optM_65537/0.txt
new file mode 100644 (file)
index 0000000..4f53f89
--- /dev/null
@@ -0,0 +1 @@
+65537: Memory Size out of range: 1 - 65536
diff --git a/test/system/casl2_err/err_optM_65537/Makefile b/test/system/casl2_err/err_optM_65537/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optM_65537/cmd b/test/system/casl2_err/err_optM_65537/cmd
new file mode 100755 (executable)
index 0000000..8146306
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M 65537 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_err/err_optM_abc/0.txt b/test/system/casl2_err/err_optM_abc/0.txt
new file mode 100644 (file)
index 0000000..c8e767b
--- /dev/null
@@ -0,0 +1 @@
+Memory Size: Not specified.
diff --git a/test/system/casl2_err/err_optM_abc/Makefile b/test/system/casl2_err/err_optM_abc/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_err/err_optM_abc/cmd b/test/system/casl2_err/err_optM_abc/cmd
new file mode 100755 (executable)
index 0000000..03992f0
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M abc ../../../../as/sample/test.casl
diff --git a/test/system/casl2_opt/opt_C_1/0.txt b/test/system/casl2_opt/opt_C_1/0.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/system/casl2_opt/opt_C_1/Makefile b/test/system/casl2_opt/opt_C_1/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_opt/opt_C_1/cmd b/test/system/casl2_opt/opt_C_1/cmd
new file mode 100755 (executable)
index 0000000..01fea54
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -C 1 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_opt/opt_C_1000/0.txt b/test/system/casl2_opt/opt_C_1000/0.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/system/casl2_opt/opt_C_1000/Makefile b/test/system/casl2_opt/opt_C_1000/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_opt/opt_C_1000/cmd b/test/system/casl2_opt/opt_C_1000/cmd
new file mode 100755 (executable)
index 0000000..1d7d948
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -C 1000 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_opt/opt_C_1000000/0.txt b/test/system/casl2_opt/opt_C_1000000/0.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/system/casl2_opt/opt_C_1000000/Makefile b/test/system/casl2_opt/opt_C_1000000/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_opt/opt_C_1000000/cmd b/test/system/casl2_opt/opt_C_1000000/cmd
new file mode 100755 (executable)
index 0000000..a50f9d0
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M 65535 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_opt/opt_C_1000001/0.txt b/test/system/casl2_opt/opt_C_1000001/0.txt
new file mode 100644 (file)
index 0000000..189a126
--- /dev/null
@@ -0,0 +1 @@
+Info - 1000001: Clock frequency exceeds maximum. Set to 1000000
diff --git a/test/system/casl2_opt/opt_C_1000001/Makefile b/test/system/casl2_opt/opt_C_1000001/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_opt/opt_C_1000001/cmd b/test/system/casl2_opt/opt_C_1000001/cmd
new file mode 100755 (executable)
index 0000000..1585b05
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -C 1000001 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_opt/opt_M_2/0.txt b/test/system/casl2_opt/opt_M_2/0.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/system/casl2_opt/opt_M_2/Makefile b/test/system/casl2_opt/opt_M_2/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_opt/opt_M_2/cmd b/test/system/casl2_opt/opt_M_2/cmd
new file mode 100755 (executable)
index 0000000..244f3c0
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M 2 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_opt/opt_M_512/0.txt b/test/system/casl2_opt/opt_M_512/0.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/system/casl2_opt/opt_M_512/Makefile b/test/system/casl2_opt/opt_M_512/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_opt/opt_M_512/cmd b/test/system/casl2_opt/opt_M_512/cmd
new file mode 100755 (executable)
index 0000000..6566ccf
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M 512 ../../../../as/sample/test.casl
diff --git a/test/system/casl2_opt/opt_M_65535/0.txt b/test/system/casl2_opt/opt_M_65535/0.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/system/casl2_opt/opt_M_65535/Makefile b/test/system/casl2_opt/opt_M_65535/Makefile
new file mode 100644 (file)
index 0000000..b6dac59
--- /dev/null
@@ -0,0 +1,2 @@
+include ../Define.mk
+include ../Test.mk
diff --git a/test/system/casl2_opt/opt_M_65535/cmd b/test/system/casl2_opt/opt_M_65535/cmd
new file mode 100755 (executable)
index 0000000..a50f9d0
--- /dev/null
@@ -0,0 +1 @@
+../../../../casl2 -M 65535 ../../../../as/sample/test.casl