25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $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 $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
298 |
printf(" where xxx is one or more of the following:\n"); |
printf(" where xxx is one or more of the following:\n"); |
299 |
printf(" b specifies that this is the boot" |
printf(" b specifies that this is the boot" |
300 |
" device\n"); |
" device\n"); |
301 |
printf(" c CD-ROM (instead of normal SCSI DISK)\n"); |
printf(" c CD-ROM\n"); |
302 |
printf(" d SCSI DISK (this is the default)\n"); |
printf(" d DISK\n"); |
303 |
printf(" i IDE (instead of SCSI)\n"); |
printf(" f FLOPPY\n"); |
304 |
|
printf(" i IDE\n"); |
305 |
printf(" r read-only (don't allow changes to the" |
printf(" r read-only (don't allow changes to the" |
306 |
" file)\n"); |
" file)\n"); |
307 |
printf(" t SCSI tape\n"); |
printf(" s SCSI\n"); |
308 |
printf(" 0-7 force a specific SCSI ID number\n"); |
printf(" t tape\n"); |
309 |
|
printf(" 0-7 force a specific ID\n"); |
310 |
printf(" -I x emulate clock interrupts at x Hz (affects" |
printf(" -I x emulate clock interrupts at x Hz (affects" |
311 |
" rtc devices only, not\n"); |
" rtc devices only, not\n"); |
312 |
printf(" actual runtime speed) (this disables automatic" |
printf(" actual runtime speed) (this disables automatic" |
381 |
"on a binary.\n" |
"on a binary.\n" |
382 |
"To load a raw binary into memory, add \"address:\" in front " |
"To load a raw binary into memory, add \"address:\" in front " |
383 |
"of the filename,\n" |
"of the filename,\n" |
384 |
"or \"address:skiplen:\" or \"address:skiplen:initialpc\".\n" |
"or \"address:skiplen:\" or \"address:skiplen:initialpc:\".\n" |
385 |
"Examples:\n" |
"Examples:\n" |
386 |
" 0xbfc00000:rom.bin for a raw ROM image\n" |
" 0xbfc00000:rom.bin for a raw ROM image\n" |
387 |
" 0xbfc00000:0x100:rom.bin for an image with " |
" 0xbfc00000:0x100:rom.bin for an image with " |
388 |
"0x100 bytes header\n" |
"0x100 bytes header\n" |
389 |
" 0xbfc00000:0x100:0xbfc00884:rom.bin " |
" 0xbfc00000:0x100:0xbfc00884:rom.bin " |
390 |
"start with pc=0xbfc00884\n"); |
"start with pc=0xbfc00884\n"); |
391 |
} |
} |
392 |
|
|
396 |
* |
* |
397 |
* Reads command line arguments. |
* Reads command line arguments. |
398 |
*/ |
*/ |
399 |
int get_cmd_args(int argc, char *argv[], struct emul *emul) |
int get_cmd_args(int argc, char *argv[], struct emul *emul, |
400 |
|
char ***diskimagesp, int *n_diskimagesp) |
401 |
{ |
{ |
402 |
int ch, res, using_switch_d = 0, using_switch_Z = 0; |
int ch, res, using_switch_d = 0, using_switch_Z = 0; |
403 |
char *type = NULL, *subtype = NULL; |
char *type = NULL, *subtype = NULL; |
424 |
fully_deterministic = 1; |
fully_deterministic = 1; |
425 |
break; |
break; |
426 |
case 'd': |
case 'd': |
427 |
diskimage_add(m, optarg); |
/* diskimage_add() is called further down */ |
428 |
|
(*n_diskimagesp) ++; |
429 |
|
(*diskimagesp) = realloc(*diskimagesp, |
430 |
|
sizeof(char *) * (*n_diskimagesp)); |
431 |
|
if (*diskimagesp == NULL) { |
432 |
|
fprintf(stderr, "out of memory\n"); |
433 |
|
exit(1); |
434 |
|
} |
435 |
|
(*diskimagesp)[(*n_diskimagesp) - 1] = strdup(optarg); |
436 |
using_switch_d = 1; |
using_switch_d = 1; |
437 |
msopts = 1; |
msopts = 1; |
438 |
break; |
break; |
578 |
break; |
break; |
579 |
case 'Y': |
case 'Y': |
580 |
m->x11_scaledown = atoi(optarg); |
m->x11_scaledown = atoi(optarg); |
581 |
|
if (m->x11_scaledown < 1) { |
582 |
|
fprintf(stderr, "Invalid scaledown value.\n"); |
583 |
|
exit(1); |
584 |
|
} |
585 |
msopts = 1; |
msopts = 1; |
586 |
break; |
break; |
587 |
case 'y': |
case 'y': |
655 |
/* -i, -r, -t are pretty verbose: */ |
/* -i, -r, -t are pretty verbose: */ |
656 |
|
|
657 |
if (m->instruction_trace && !verbose) { |
if (m->instruction_trace && !verbose) { |
658 |
fprintf(stderr, "Implicitly turning of -q and turning on -v, " |
fprintf(stderr, "Implicitly %sturning on -v, because" |
659 |
"because of -i\n"); |
" of -i\n", quiet_mode? "turning off -q and " : ""); |
660 |
verbose = 1; |
verbose = 1; |
661 |
quiet_mode = 0; |
quiet_mode = 0; |
662 |
} |
} |
663 |
|
|
664 |
if (m->register_dump && !verbose) { |
if (m->register_dump && !verbose) { |
665 |
fprintf(stderr, "Implicitly turning of -q and turning on -v, " |
fprintf(stderr, "Implicitly %sturning on -v, because" |
666 |
"because of -r\n"); |
" of -r\n", quiet_mode? "turning off -q and " : ""); |
667 |
verbose = 1; |
verbose = 1; |
668 |
quiet_mode = 0; |
quiet_mode = 0; |
669 |
} |
} |
670 |
|
|
671 |
if (m->show_trace_tree && !verbose) { |
if (m->show_trace_tree && !verbose) { |
672 |
fprintf(stderr, "Implicitly turning of -q and turning on -v, " |
fprintf(stderr, "Implicitly %sturning on -v, because" |
673 |
"because of -t\n"); |
" of -t\n", quiet_mode? "turning off -q and " : ""); |
674 |
verbose = 1; |
verbose = 1; |
675 |
quiet_mode = 0; |
quiet_mode = 0; |
676 |
} |
} |
680 |
* Usually, an executable filename must be supplied. |
* Usually, an executable filename must be supplied. |
681 |
* |
* |
682 |
* However, it is possible to boot directly from a harddisk image |
* However, it is possible to boot directly from a harddisk image |
683 |
* file. If no kernel is supplied, and the emulation mode is set to |
* file. If no kernel is supplied, but a diskimage is being used, |
684 |
* DECstation emulation, and there is a diskimage, then try to boot |
* then try to boot from disk. |
|
* from that. |
|
685 |
*/ |
*/ |
686 |
if (extra_argc == 0) { |
if (extra_argc == 0) { |
687 |
if (using_switch_d) { |
if (using_switch_d) { |
770 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
771 |
{ |
{ |
772 |
struct emul **emuls; |
struct emul **emuls; |
773 |
|
char **diskimages = NULL; |
774 |
|
int n_diskimages = 0; |
775 |
int n_emuls; |
int n_emuls; |
776 |
int i; |
int i; |
777 |
|
|
797 |
exit(1); |
exit(1); |
798 |
} |
} |
799 |
|
|
800 |
get_cmd_args(argc, argv, emuls[0]); |
get_cmd_args(argc, argv, emuls[0], &diskimages, &n_diskimages); |
801 |
|
|
802 |
if (!fully_deterministic) { |
if (!fully_deterministic) { |
803 |
/* TODO: More than just time(). Use gettimeofday(). */ |
/* TODO: More than just time(). Use gettimeofday(). */ |
821 |
|
|
822 |
if (emuls[0]->machines[0]->machine_type == MACHINE_NONE) |
if (emuls[0]->machines[0]->machine_type == MACHINE_NONE) |
823 |
n_emuls --; |
n_emuls --; |
824 |
|
else { |
825 |
|
for (i=0; i<n_diskimages; i++) |
826 |
|
diskimage_add(emuls[0]->machines[0], diskimages[i]); |
827 |
|
} |
828 |
|
|
829 |
/* Simple initialization, from command line arguments: */ |
/* Simple initialization, from command line arguments: */ |
830 |
if (n_emuls > 0) { |
if (n_emuls > 0) { |