--- trunk/src/main.c 2007/10/08 16:17:48 2 +++ trunk/src/main.c 2007/10/08 16:18:00 4 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: main.c,v 1.228 2005/04/07 15:43:17 debug Exp $ + * $Id: main.c,v 1.232 2005/04/18 21:40:58 debug Exp $ */ #include @@ -298,13 +298,15 @@ printf(" where xxx is one or more of the following:\n"); printf(" b specifies that this is the boot" " device\n"); - printf(" c CD-ROM (instead of normal SCSI DISK)\n"); - printf(" d SCSI DISK (this is the default)\n"); - printf(" i IDE (instead of SCSI)\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" " file)\n"); - printf(" t SCSI tape\n"); - printf(" 0-7 force a specific SCSI ID number\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" @@ -379,12 +381,12 @@ "on a binary.\n" "To load a raw binary into memory, add \"address:\" in front " "of the filename,\n" - "or \"address:skiplen:\" or \"address:skiplen:initialpc\".\n" + "or \"address:skiplen:\" or \"address:skiplen:initialpc:\".\n" "Examples:\n" - " 0xbfc00000:rom.bin for a raw ROM image\n" - " 0xbfc00000:0x100:rom.bin for an image with " + " 0xbfc00000:rom.bin for a raw ROM image\n" + " 0xbfc00000:0x100:rom.bin for an image with " "0x100 bytes header\n" - " 0xbfc00000:0x100:0xbfc00884:rom.bin " + " 0xbfc00000:0x100:0xbfc00884:rom.bin " "start with pc=0xbfc00884\n"); } @@ -394,7 +396,8 @@ * * Reads command line arguments. */ -int get_cmd_args(int argc, char *argv[], struct emul *emul) +int get_cmd_args(int argc, char *argv[], struct emul *emul, + char ***diskimagesp, int *n_diskimagesp) { int ch, res, using_switch_d = 0, using_switch_Z = 0; char *type = NULL, *subtype = NULL; @@ -421,7 +424,15 @@ fully_deterministic = 1; break; case 'd': - diskimage_add(m, optarg); + /* diskimage_add() is called further down */ + (*n_diskimagesp) ++; + (*diskimagesp) = realloc(*diskimagesp, + sizeof(char *) * (*n_diskimagesp)); + if (*diskimagesp == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + (*diskimagesp)[(*n_diskimagesp) - 1] = strdup(optarg); using_switch_d = 1; msopts = 1; break; @@ -567,6 +578,10 @@ break; case 'Y': m->x11_scaledown = atoi(optarg); + if (m->x11_scaledown < 1) { + fprintf(stderr, "Invalid scaledown value.\n"); + exit(1); + } msopts = 1; break; case 'y': @@ -640,22 +655,22 @@ /* -i, -r, -t are pretty verbose: */ if (m->instruction_trace && !verbose) { - fprintf(stderr, "Implicitly turning of -q and turning on -v, " - "because of -i\n"); + fprintf(stderr, "Implicitly %sturning on -v, because" + " of -i\n", quiet_mode? "turning off -q and " : ""); verbose = 1; quiet_mode = 0; } if (m->register_dump && !verbose) { - fprintf(stderr, "Implicitly turning of -q and turning on -v, " - "because of -r\n"); + fprintf(stderr, "Implicitly %sturning on -v, because" + " of -r\n", quiet_mode? "turning off -q and " : ""); verbose = 1; quiet_mode = 0; } if (m->show_trace_tree && !verbose) { - fprintf(stderr, "Implicitly turning of -q and turning on -v, " - "because of -t\n"); + fprintf(stderr, "Implicitly %sturning on -v, because" + " of -t\n", quiet_mode? "turning off -q and " : ""); verbose = 1; quiet_mode = 0; } @@ -665,9 +680,8 @@ * Usually, an executable filename must be supplied. * * However, it is possible to boot directly from a harddisk image - * file. If no kernel is supplied, and the emulation mode is set to - * DECstation emulation, and there is a diskimage, then try to boot - * from that. + * file. If no kernel is supplied, but a diskimage is being used, + * then try to boot from disk. */ if (extra_argc == 0) { if (using_switch_d) { @@ -756,6 +770,8 @@ int main(int argc, char *argv[]) { struct emul **emuls; + char **diskimages = NULL; + int n_diskimages = 0; int n_emuls; int i; @@ -781,7 +797,7 @@ exit(1); } - get_cmd_args(argc, argv, emuls[0]); + get_cmd_args(argc, argv, emuls[0], &diskimages, &n_diskimages); if (!fully_deterministic) { /* TODO: More than just time(). Use gettimeofday(). */ @@ -805,6 +821,10 @@ if (emuls[0]->machines[0]->machine_type == MACHINE_NONE) n_emuls --; + else { + for (i=0; imachines[0], diskimages[i]); + } /* Simple initialization, from command line arguments: */ if (n_emuls > 0) {