--- trunk/src/main.c 2007/10/08 16:18:00 4 +++ trunk/src/main.c 2007/10/08 16:18:27 10 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: main.c,v 1.232 2005/04/18 21:40:58 debug Exp $ + * $Id: main.c,v 1.238 2005/06/25 13:25:33 debug Exp $ */ #include @@ -155,76 +155,6 @@ /* - * mystrtoull(): - * - * This function is used on OSes that don't have strtoull() in libc. - */ -unsigned long long mystrtoull(const char *s, char **endp, int base) -{ - unsigned long long res = 0; - int minus_sign = 0; - - if (s == NULL) - return 0; - - /* TODO: Implement endp? */ - if (endp != NULL) { - fprintf(stderr, "mystrtoull(): endp isn't implemented\n"); - exit(1); - } - - if (s[0] == '-') { - minus_sign = 1; - s++; - } - - /* Guess base: */ - if (base == 0) { - if (s[0] == '0') { - /* Just "0"? :-) */ - if (!s[1]) - return 0; - if (s[1] == 'x' || s[1] == 'X') { - base = 16; - s += 2; - } else { - base = 8; - s ++; - } - } else if (s[0] >= '1' && s[0] <= '9') - base = 10; - } - - while (s[0]) { - int c = s[0]; - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'a' && c <= 'f') - c = c - 'a' + 10; - else if (c >= 'A' && c <= 'F') - c = c - 'A' + 10; - else - break; - switch (base) { - case 8: res = (res << 3) | c; - break; - case 16:res = (res << 4) | c; - break; - default:res = (res * base) + c; - } - s++; - } - - if (minus_sign) - res = (uint64_t) -(int64_t)res; - return res; -} - - -/*****************************************************************************/ - - -/* * internal_w(): * * For internal use by gxemul itself. @@ -288,25 +218,28 @@ printf("\nOther options:\n"); #ifdef BINTRANS - printf(" -B disable dynamic binary translation completely\n"); - printf(" -b use the OLD binary translation subsystem\n"); + printf(" -B disable dynamic binary translation. (translation" + " is turned on\n by default, if the host " + "supports it)\n"); #endif printf(" -C x try to emulate a specific CPU. (Use -H to get a " "list of types.)\n"); printf(" -d fname add fname as a disk image. You can add \"xxx:\"" " as a prefix\n"); printf(" where xxx is one or more of the following:\n"); - printf(" b specifies that this is the boot" + printf(" b specifies that this is the boot" " device\n"); - printf(" c CD-ROM\n"); - printf(" d DISK\n"); - printf(" f FLOPPY\n"); - printf(" i IDE\n"); - printf(" r read-only (don't allow changes to the" + printf(" c CD-ROM\n"); + printf(" d DISK\n"); + printf(" f FLOPPY\n"); + printf(" gH;S; set geometry to H heads and S" + " sectors-per-track\n"); + printf(" i IDE\n"); + printf(" r read-only (don't allow changes to the" " file)\n"); - printf(" s SCSI\n"); - printf(" t tape\n"); - printf(" 0-7 force a specific ID\n"); + printf(" s SCSI\n"); + printf(" t tape\n"); + printf(" 0-7 force a specific ID\n"); printf(" -I x emulate clock interrupts at x Hz (affects" " rtc devices only, not\n"); printf(" actual runtime speed) (this disables automatic" @@ -405,17 +338,13 @@ int msopts = 0; /* Machine-specific options used */ struct machine *m = emul_add_machine(emul, "default"); - while ((ch = getopt(argc, argv, "BbC:Dd:E:e:HhI:iJj:KM:m:" + while ((ch = getopt(argc, argv, "BC:Dd:E:e:HhI:iJj:KM:m:" "Nn:Oo:p:QqRrSsTtUu:VvW:XxY:y:Z:z:")) != -1) { switch (ch) { case 'B': m->bintrans_enable = 0; msopts = 1; break; - case 'b': - m->old_bintrans_enable = 1; - msopts = 1; - break; case 'C': m->cpu_name = strdup(optarg); msopts = 1; @@ -612,8 +541,8 @@ msopts = 1; break; default: - fprintf(stderr, "Invalid option.\n"); - usage(0); + fprintf(stderr, "Run %s -h for help on command " + "line options.\n", progname); exit(1); } } @@ -634,17 +563,6 @@ extra_argv = argv; - if (!m->bintrans_enable && m->old_bintrans_enable) { - fprintf(stderr, "You cannot both select old bintrans and" - " disable bintrans at the same time.\n"); - exit(1); - } - - /* TODO: Remove this once there is a new bintrans system. */ - if (m->bintrans_enable && !m->old_bintrans_enable) { - m->bintrans_enable = 0; - } - if (m->machine_type == MACHINE_NONE && msopts) { fprintf(stderr, "Machine specific options used directly on " "the command line, but no machine\nemulation specified?\n"); @@ -675,6 +593,12 @@ quiet_mode = 0; } + if ((m->instruction_trace || m->register_dump || m->show_trace_tree) + && m->bintrans_enable) { + fprintf(stderr, "Implicitly turning off bintrans.\n"); + m->bintrans_enable = 0; + } + /* * Usually, an executable filename must be supplied. @@ -868,7 +792,11 @@ } if (n_emuls == 0) { - fprintf(stderr, "No emulations defined.\n"); + fprintf(stderr, "No emulations defined. Maybe you forgot to " + "use -E xx (and -e yy), to specify\nthe machine type)." + " For example:\n\n %s -E dec -e 3max -d disk.img\n\n" + "to boot an emulated DECstation 5000/200 with a disk " + "image.\n", progname); exit(1); }