13 static struct option longopts[] = {
14 {"trace", no_argument, NULL, 't'},
15 {"tracearithmetic", no_argument, NULL, 't'},
16 {"tracelogical", no_argument, NULL, 'T'},
17 {"dump", no_argument, NULL, 'd'},
18 {"memorysize", required_argument, NULL, 'M'},
19 {"clocks", required_argument, NULL, 'C'},
20 {"help", no_argument, NULL, 'h'},
27 int main(int argc, char *argv[])
29 int memsize = DEFAULT_MEMSIZE, clocks = DEFAULT_CLOCKS;
31 const char *usage = "Usage: %s [-tTdh] [-M <MEMORYSIZE>] [-C <CLOCKS>] FILE\n";
38 while((opt = getopt_long(argc, argv, "tTdM:C:h", longopts, NULL)) != -1) {
41 execmode.trace = true;
44 execmode.trace = true;
45 execmode.logical = true;
51 memsize = atoi(optarg);
54 clocks = atoi(optarg);
57 fprintf(stdout, usage, argv[0]);
60 fprintf(stderr, usage, argv[0]);
64 if(argv[optind] == NULL) {
65 setcerr(208, NULL); /* object file is not specified */
66 fprintf(stderr, "comet2 error - %d: %s\n", cerr->num, cerr->msg);
69 /* COMET II仮想マシンのリセット */
70 reset(memsize, clocks);
72 if(loadassemble(argv[optind]) == true) {
73 create_code_type(); /* タイプがキーの命令ハッシュ表を作成 */
75 free_code_type(); /* タイプがキーの命令ハッシュ表を解放 */
77 /* COMET II仮想マシンのシャットダウン */