6 /* 指定されたファイルからCOMET II仮想メモリ(アセンブル結果)を読込 */
7 bool inassemble(char *file) {
10 if((fp = fopen(file, "r")) == NULL) {
14 fread(memory, sizeof(WORD), memsize, fp);
19 static struct option longopts[] = {
20 {"trace", no_argument, NULL, 't'},
21 {"tracearithmetic", no_argument, NULL, 't'},
22 {"tracelogical", no_argument, NULL, 'T'},
23 {"dump", no_argument, NULL, 'd'},
24 {"memorysize", required_argument, NULL, 'M'},
25 {"clocks", required_argument, NULL, 'C'},
26 {"help", no_argument, NULL, 'h'},
30 int main(int argc, char *argv[])
33 const char *usage = "Usage: %s [-tTdh] [-M <memorysize>] [-C <clocks>] FILE\n";
35 while((opt = getopt_long(argc, argv, "tTdM:C:h", longopts, NULL)) != -1) {
48 memsize = atoi(optarg);
51 clocks = atoi(optarg);
54 fprintf(stdout, usage, argv[0]);
57 fprintf(stderr, usage, argv[0]);
61 if(inassemble(argv[optind]) == true) {