diff --git a/README.md b/README.md index c80967a..5166fbd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Koopman TOY CPU Interpreter This is a CPU interpreter, based on the specification of Phil Koopmans paper: [Microcoded Versus Hard-wired Control](https://users.ece.cmu.edu/~koopman/misc/byte87a.pdf).
-For more details, have a look at /doc or press `toy_cpu -h` (for help) or `toy_cpu -i` (for cpu architecture overview) +For more details, have a look at /doc or press `toy_cpu -h` (for help) or `toy_cpu -a` (for cpu architecture overview) ## Build diff --git a/src/main.c b/src/main.c index 2b4babf..243fe13 100644 --- a/src/main.c +++ b/src/main.c @@ -28,9 +28,6 @@ int main(int argc, char *argv[]) if(initialise_ram(ram,argc,argv)==-1) return 1; /*load data from command line into RAM (-1 in case of error, else number of correctly read words)*/ - - print_architecture(); //print cpu architecture at startup - while(run) { ir = ram[pc]; //get instruction from RAM @@ -57,19 +54,21 @@ int main(int argc, char *argv[]) //handle user output printf("ACCU: %d\n",get2compl(*ACCU)); printf("PROGRAM COUNTER: %" PRIu16 - "\n-----------------------------------",pc); - printf("\n(n)ext step or (q)uit or (c)oredump ?\n"); + "\n----------------------------------------",pc); + printf("\n|(n)ext step or (q)uit or (c)oredump ? "); //handle program flow while((quit = getchar()) != '\n') { - switch(quit) - { - case EOF: break; - case 'c': makeHexDump(true,ram); break; - case 'q': run = false; - } + switch(quit) + { + case EOF: break; + case 'c': makeHexDump(true,ram); break; + case 'q': run = false; + } } + + printf("----------------------------------------\n"); } return 0; } diff --git a/src/toy.c b/src/toy.c index f8070b8..e421ed7 100644 --- a/src/toy.c +++ b/src/toy.c @@ -113,7 +113,9 @@ int initialise_ram(uint16_t *ram, int argc, char **argv ) if(argc<2) { fprintf(stderr,"%s","no \".toy\" input file!\n" - "interpretation terminated. (press -h for help)\n"); + "interpretation terminated.\n\n" + "press toy-CPU -h for help\n" + "press toy-CPU -a for cpu architecture overview\n"); return -1; } if(argc >2) @@ -128,7 +130,7 @@ int initialise_ram(uint16_t *ram, int argc, char **argv ) return -1; } - if(strcmp(argv[1],"-i")==0) + if(strcmp(argv[1],"-a")==0) { printf("interpretation terminated.\n\n"); print_architecture();