projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hash.cの分離独立とソースコードの草取り
[YACASL2.git]
/
src
/
comet2.c
diff --git
a/src/comet2.c
b/src/comet2.c
index
0312035
..
24040b3
100644
(file)
--- a/
src/comet2.c
+++ b/
src/comet2.c
@@
-6,11
+6,12
@@
/* 指定されたファイルからCOMET II仮想メモリ(アセンブル結果)を読込 */
bool inassemble(char *file) {
FILE *fp;
/* 指定されたファイルからCOMET II仮想メモリ(アセンブル結果)を読込 */
bool inassemble(char *file) {
FILE *fp;
+ reset();
if((fp = fopen(file, "r")) == NULL) {
perror(file);
return false;
}
if((fp = fopen(file, "r")) == NULL) {
perror(file);
return false;
}
- fread(memory, sizeof(WORD),
MEMSIZE
, fp);
+ fread(memory, sizeof(WORD),
memsize
, fp);
fclose(fp);
return true;
}
fclose(fp);
return true;
}
@@
-20,6
+21,8
@@
static struct option longopts[] = {
{"tracearithmetic", no_argument, NULL, 't'},
{"tracelogical", no_argument, NULL, 'T'},
{"dump", no_argument, NULL, 'd'},
{"tracearithmetic", no_argument, NULL, 't'},
{"tracelogical", no_argument, NULL, 'T'},
{"dump", no_argument, NULL, 'd'},
+ {"memsize", required_argument, NULL, 'M'},
+ {"clocks", required_argument, NULL, 'C'},
{"help", no_argument, NULL, 'h'},
{0, 0, 0, 0}
};
{"help", no_argument, NULL, 'h'},
{0, 0, 0, 0}
};
@@
-27,9
+30,9
@@
static struct option longopts[] = {
int main(int argc, char *argv[])
{
int opt;
int main(int argc, char *argv[])
{
int opt;
- const char *usage = "Usage: %s [-tTdh] FILE\n";
+ const char *usage = "Usage: %s [-tTdh]
[-M<memsize>] [-C<clocks>]
FILE\n";
- while((opt = getopt_long(argc, argv, "tTdh", longopts, NULL)) != -1) {
+ while((opt = getopt_long(argc, argv, "tTd
M:C:
h", longopts, NULL)) != -1) {
switch(opt) {
case 't':
tracemode = true;
switch(opt) {
case 't':
tracemode = true;
@@
-41,6
+44,12
@@
int main(int argc, char *argv[])
case 'd':
dumpmode = true;
break;
case 'd':
dumpmode = true;
break;
+ case 'M':
+ memsize = atoi(optarg);
+ break;
+ case 'C':
+ clocks = atoi(optarg);
+ break;
case 'h':
fprintf(stdout, usage, argv[0]);
exit(-1);
case 'h':
fprintf(stdout, usage, argv[0]);
exit(-1);