- convert nearly all bx_options to parameter form. All options that have
been converted into parameters temporarily have the letter "O" appended to their name. I don't want to keep it this way, but it has helped in the conversion process because the compiler refuses to compile the old uses of the name. Before I started using the "O" trick, there were many bugs like this: if (bx_options.diskc.present) {...} This was legal with the new parameters, but it was testing whether the parameter structure had been created, instead of testing the value of the present parameter. Renaming present to Opresent turns this into a compile error, which points out the incorrect use of the param. - the "--disable-control-panel" no longer works, I'm afraid. I can no longer support this and continue progress.
This commit is contained in:
parent
ce339e0b78
commit
ec0fbf18bc
@ -569,52 +569,25 @@ int bx_parse_cmdline (int argc, char *argv[]);
|
||||
int bx_read_configuration (char *rcfile);
|
||||
int bx_write_configuration (char *rcfile, int overwrite);
|
||||
|
||||
#if BX_USE_CONTROL_PANEL==0
|
||||
// with control panel enabled, this is defined in gui/siminterface.h instead.
|
||||
|
||||
#define BX_PATHNAME_LEN 512
|
||||
|
||||
// for control panel, I moved these into gui/siminterface.h. BBD
|
||||
typedef struct {
|
||||
char path[BX_PATHNAME_LEN];
|
||||
unsigned type;
|
||||
unsigned initial_status;
|
||||
} bx_floppy_options;
|
||||
|
||||
typedef struct {
|
||||
Boolean present;
|
||||
char path[BX_PATHNAME_LEN];
|
||||
unsigned int cylinders;
|
||||
unsigned int heads;
|
||||
unsigned int spt;
|
||||
} bx_disk_options;
|
||||
|
||||
struct bx_cdrom_options
|
||||
{
|
||||
Boolean present;
|
||||
char dev[BX_PATHNAME_LEN];
|
||||
Boolean inserted;
|
||||
};
|
||||
#endif /* if BX_USE_CONTROL_PANEL==0 */
|
||||
|
||||
typedef struct {
|
||||
bx_param_string_c *path;
|
||||
bx_param_num_c *address;
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_num_c *Oaddress;
|
||||
} bx_rom_options;
|
||||
|
||||
typedef struct {
|
||||
bx_param_string_c *path;
|
||||
bx_param_string_c *Opath;
|
||||
} bx_vgarom_options;
|
||||
|
||||
typedef struct {
|
||||
//size_t megs;
|
||||
bx_param_num_c *size;
|
||||
bx_param_num_c *Osize;
|
||||
} bx_mem_options;
|
||||
|
||||
typedef struct {
|
||||
char *path;
|
||||
Boolean cmosImage;
|
||||
unsigned int time0;
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_bool_c *OcmosImage;
|
||||
bx_param_num_c *Otime0;
|
||||
} bx_cmos_options;
|
||||
|
||||
typedef struct {
|
||||
@ -634,14 +607,15 @@ typedef struct {
|
||||
// to implement real mode up front.
|
||||
#define Load32bitOSLinux 1
|
||||
#define Load32bitOSNullKernel 2 // being developed for freemware
|
||||
unsigned whichOS;
|
||||
char *path;
|
||||
char *iolog;
|
||||
char *initrd;
|
||||
#define Load32bitOSLast 2
|
||||
bx_param_num_c *OwhichOS;
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_string_c *Oiolog;
|
||||
bx_param_string_c *Oinitrd;
|
||||
} bx_load32bitOSImage_t;
|
||||
|
||||
typedef struct {
|
||||
char filename[BX_PATHNAME_LEN];
|
||||
bx_param_string_c *Ofilename;
|
||||
// one array item for each log level, indexed by LOGLEV_*.
|
||||
// values: ACT_IGNORE, ACT_REPORT, ACT_ASK, ACT_FATAL
|
||||
unsigned char actions[N_LOGLEV];
|
||||
@ -654,6 +628,9 @@ typedef struct {
|
||||
Bit32u dmatimer;
|
||||
} bx_sb16_options;
|
||||
|
||||
#define BX_BOOT_FLOPPYA 0
|
||||
#define BX_BOOT_DISKC 0x80
|
||||
|
||||
typedef struct {
|
||||
bx_floppy_options floppya;
|
||||
bx_floppy_options floppyb;
|
||||
@ -664,17 +641,17 @@ typedef struct {
|
||||
bx_vgarom_options vgarom;
|
||||
bx_mem_options memory;
|
||||
bx_sb16_options sb16;
|
||||
char bootdrive[2];
|
||||
bx_param_num_c *vga_update_interval;
|
||||
unsigned long keyboard_serial_delay;
|
||||
unsigned long floppy_command_delay;
|
||||
bx_param_num_c *ips;
|
||||
bx_param_num_c *mouse_enabled;
|
||||
Boolean private_colormap;
|
||||
Boolean i440FXSupport;
|
||||
bx_param_num_c *Obootdrive; //0=floppya, 0x80=diskc
|
||||
bx_param_num_c *Ovga_update_interval;
|
||||
bx_param_num_c *Okeyboard_serial_delay;
|
||||
bx_param_num_c *Ofloppy_command_delay;
|
||||
bx_param_num_c *Oips;
|
||||
bx_param_bool_c *Omouse_enabled;
|
||||
bx_param_bool_c *Oprivate_colormap;
|
||||
bx_param_bool_c *Oi440FXSupport;
|
||||
bx_cmos_options cmos;
|
||||
bx_ne2k_options ne2k;
|
||||
Boolean newHardDriveSupport;
|
||||
bx_param_bool_c *OnewHardDriveSupport;
|
||||
bx_load32bitOSImage_t load32bitOSImage;
|
||||
bx_log_options log;
|
||||
} bx_options_t;
|
||||
|
@ -400,6 +400,10 @@
|
||||
|
||||
#endif // BX_WITH_WIN32
|
||||
|
||||
#define BX_MAX_UINT 4294967295
|
||||
#define BX_MAX_INT 2147483647
|
||||
|
||||
|
||||
// create an unsigned integer type that is the same size as a pointer.
|
||||
// You can typecast a pointer to a bx_pr_equiv_t without losing any
|
||||
// bits (and without getting the compiler excited). This is used in
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* gui/control.cc
|
||||
* $Id: control.cc,v 1.23 2001-06-19 14:55:34 fries Exp $
|
||||
* $Id: control.cc,v 1.24 2001-06-20 14:01:39 bdenney Exp $
|
||||
*
|
||||
* This is code for a text-mode control panel. Note that this file
|
||||
* does NOT include bochs.h. Instead, it does all of its contact with
|
||||
@ -232,9 +232,10 @@ ask_string (char *prompt, char *the_default, char *out)
|
||||
{
|
||||
char buffer[1024];
|
||||
char *clean;
|
||||
assert (the_default != out);
|
||||
out[0] = 0;
|
||||
printf (prompt, the_default);
|
||||
if (!fgets (buffer, sizeof(buffer), stdin))
|
||||
if (fgets (buffer, sizeof(buffer), stdin) == NULL)
|
||||
return -1;
|
||||
clean = clean_string (buffer);
|
||||
if (strlen(clean) < 1) {
|
||||
@ -398,25 +399,26 @@ void build_disk_options_prompt (char *format, char *buf, int size)
|
||||
char buffer[7][128];
|
||||
for (int i=0; i<2; i++) {
|
||||
SIM->get_floppy_options (i, &floppyop);
|
||||
sprintf (buffer[i], "%s, size=%s, %s", floppyop.path,
|
||||
SIM->get_floppy_type_name (floppyop.type),
|
||||
floppyop.initial_status ? "inserted" : "ejected");
|
||||
if (!floppyop.path[0]) strcpy (buffer[i], "none");
|
||||
sprintf (buffer[i], "%s, size=%s, %s", floppyop.Opath->getptr (),
|
||||
SIM->get_floppy_type_name (floppyop.Otype->get ()),
|
||||
floppyop.Oinitial_status->get () ? "inserted" : "ejected");
|
||||
if (!floppyop.Opath->getptr()[0]) strcpy (buffer[i], "none");
|
||||
SIM->get_disk_options (i, &diskop);
|
||||
sprintf (buffer[2+i], "%s, %d cylinders, %d heads, %d sectors/track",
|
||||
diskop.path, diskop.cylinders, diskop.heads, diskop.spt);
|
||||
if (!diskop.present) strcpy (buffer[2+i], "none");
|
||||
diskop.Opath->getptr (), diskop.Ocylinders->get (),
|
||||
diskop.Oheads->get (), diskop.Ospt->get ());
|
||||
if (!diskop.Opresent->get ()) strcpy (buffer[2+i], "none");
|
||||
}
|
||||
SIM->get_cdrom_options (0, &cdromop);
|
||||
sprintf (buffer[4], "%s, %spresent, %s",
|
||||
cdromop.dev, cdromop.present?"":"not ",
|
||||
cdromop.inserted?"inserted":"ejected");
|
||||
if (!cdromop.dev[0]) strcpy (buffer[4], "none");
|
||||
cdromop.Opath->getptr (), cdromop.Opresent->get ()?"":"not ",
|
||||
cdromop.Oinserted?"inserted":"ejected");
|
||||
if (!cdromop.Opath->getptr()[0]) strcpy (buffer[4], "none");
|
||||
sprintf (buffer[5], "%s", SIM->get_newhd_support () ? "yes":"no");
|
||||
sprintf (buffer[6], "%s", SIM->get_boot_hard_disk () ? "hard drive":"floppy drive");
|
||||
// check if diskd and cdromd are on at once
|
||||
SIM->get_disk_options (1, &diskop);
|
||||
int conflict = (diskop.present && cdromop.present);
|
||||
int conflict = (diskop.Opresent->get () && cdromop.Opresent->get ());
|
||||
char *diskd_cdromd_conflict_msg = "\nERROR:\nThis configuration has both a cdrom and a hard disk enabled.\nYou cannot have both!";
|
||||
snprintf (buf, size, format, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], conflict? diskd_cdromd_conflict_msg : "");
|
||||
}
|
||||
@ -429,15 +431,15 @@ void build_runtime_options_prompt (char *format, char *buf, int size)
|
||||
char buffer[3][128];
|
||||
for (int i=0; i<2; i++) {
|
||||
SIM->get_floppy_options (i, &floppyop);
|
||||
sprintf (buffer[i], "%s, size=%s, %s", floppyop.path,
|
||||
SIM->get_floppy_type_name (floppyop.type),
|
||||
floppyop.initial_status ? "inserted" : "ejected");
|
||||
if (!floppyop.path[0]) strcpy (buffer[i], "none");
|
||||
sprintf (buffer[i], "%s, size=%s, %s", floppyop.Opath->getptr (),
|
||||
SIM->get_floppy_type_name (floppyop.Otype->get ()),
|
||||
floppyop.Oinitial_status->get () ? "inserted" : "ejected");
|
||||
if (!floppyop.Opath->getptr ()[0]) strcpy (buffer[i], "none");
|
||||
}
|
||||
SIM->get_cdrom_options (0, &cdromop);
|
||||
sprintf (buffer[2], "%s, %spresent, %s",
|
||||
cdromop.dev, cdromop.present?"":"not ",
|
||||
cdromop.inserted?"inserted":"ejected");
|
||||
cdromop.Opath->getptr (), cdromop.Opresent->get ()?"":"not ",
|
||||
cdromop.Oinserted->get ()?"inserted":"ejected");
|
||||
snprintf (buf, size, format, buffer[0], buffer[1], buffer[2],
|
||||
ips->get (),
|
||||
SIM->get_param_num (BXP_VGA_UPDATE_INTERVAL)->get (),
|
||||
@ -597,13 +599,15 @@ void bx_edit_floppy (int drive)
|
||||
assert (SIM->get_floppy_options (drive, &opt) >= 0);
|
||||
newopt = opt;
|
||||
fprintf (stderr, "Changing options for floppy drive %d\n", drive);
|
||||
if (ask_string ("Enter new pathname: [%s] ", opt.path, newopt.path) < 0)
|
||||
char the_default[512];
|
||||
opt.Opath->get (the_default, sizeof(the_default));
|
||||
if (ask_string ("Enter new pathname: [%s] ", the_default, newopt.Opath->getptr ()) < 0)
|
||||
return;
|
||||
int newtype, oldtype = opt.type - BX_FLOPPY_NONE;
|
||||
int newtype, oldtype = opt.Otype->get () - BX_FLOPPY_NONE;
|
||||
if (ask_menu ("What is the floppy disk size?\nChoices are 720K, 1.2M, 1.44M, 2.88M. [%s] ", n_floppy_type_names, floppy_type_names, oldtype, &newtype) < 0) return;
|
||||
newopt.type = newtype + BX_FLOPPY_NONE;
|
||||
newopt.Otype->set (newtype + BX_FLOPPY_NONE);
|
||||
if (SIM->set_floppy_options (drive, &newopt) < 0) {
|
||||
fprintf (stderr, "The disk image %s could not be opened.\n", newopt.path);
|
||||
fprintf (stderr, "The disk image %s could not be opened.\n", newopt.Opath->getptr ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,24 +617,26 @@ void bx_edit_hard_disk (int drive)
|
||||
assert (SIM->get_disk_options (drive, &opt) >= 0);
|
||||
newopt = opt;
|
||||
fprintf (stderr, "Changing options for hard drive %d\n", drive);
|
||||
if (ask_string ("Enter new pathname, or type 'none' for no disk: [%s] ", opt.path, newopt.path) < 0)
|
||||
char buf[512];
|
||||
opt.Opath->get (buf, sizeof (buf));
|
||||
if (ask_string ("Enter new pathname, or type 'none' for no disk: [%s] ", buf, newopt.Opath->getptr ()) < 0)
|
||||
return;
|
||||
newopt.present = (strcmp (newopt.path, "none") != 0);
|
||||
if (newopt.present) { // skip if "none" is the path.
|
||||
newopt.Opresent->set (strcmp (newopt.Opath->getptr (), "none") != 0);
|
||||
if (newopt.Opresent->get ()) { // skip if "none" is the path.
|
||||
// ask cyl, head, sec.
|
||||
Bit32u n;
|
||||
if (ask_uint ("How many cylinders? [%d] ", 1, 65535, opt.cylinders, &n, 10) < 0)
|
||||
if (ask_uint ("How many cylinders? [%d] ", 1, 65535, opt.Ocylinders->get (), &n, 10) < 0)
|
||||
return;
|
||||
newopt.cylinders = n;
|
||||
if (ask_uint ("How many heads? [%d] ", 1, 256, opt.heads, &n, 10) < 0)
|
||||
newopt.Ocylinders->set (n);
|
||||
if (ask_uint ("How many heads? [%d] ", 1, 256, opt.Oheads->get (), &n, 10) < 0)
|
||||
return;
|
||||
newopt.heads = n;
|
||||
if (ask_uint ("How many sectors per track? [%d] ", 1, 255, opt.spt, &n, 10) < 0)
|
||||
newopt.Oheads->set (n);
|
||||
if (ask_uint ("How many sectors per track? [%d] ", 1, 255, opt.Ospt->get (), &n, 10) < 0)
|
||||
return;
|
||||
newopt.spt = n;
|
||||
newopt.Ospt->set (n);
|
||||
}
|
||||
if (SIM->set_disk_options (drive, &newopt) < 0) {
|
||||
fprintf (stderr, "The disk image %s could not be opened.\n", newopt.path);
|
||||
fprintf (stderr, "The disk image %s could not be opened.\n", newopt.Opath->getptr ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -639,15 +645,17 @@ void bx_edit_cdrom ()
|
||||
bx_cdrom_options opt, newopt;
|
||||
assert (SIM->get_cdrom_options (0, &opt) >= 0);
|
||||
newopt = opt;
|
||||
newopt.present = 1;
|
||||
if (ask_string ("Enter pathname of the cdrom device, or 'none' for no cdrom: [%s] ", opt.dev, newopt.dev) < 0)
|
||||
newopt.Opresent->set (1);
|
||||
char buf[512];
|
||||
opt.Opath->get (buf, sizeof (buf));
|
||||
if (ask_string ("Enter pathname of the cdrom device, or 'none' for no cdrom: [%s] ", buf, newopt.Opath->getptr ()) < 0)
|
||||
return;
|
||||
if (!strcmp (newopt.dev, "none")) {
|
||||
newopt.dev[0] = 0;
|
||||
newopt.present = 0;
|
||||
if (!strcmp (newopt.Opath->getptr (), "none")) {
|
||||
newopt.Opath->getptr ()[0] = 0;
|
||||
newopt.Opresent->set (0);
|
||||
}
|
||||
if (SIM->set_cdrom_options (0, &newopt) < 0) {
|
||||
fprintf (stderr, "The device at %s could not be opened.\n", newopt.dev);
|
||||
fprintf (stderr, "The device at %s could not be opened.\n", newopt.Opath->getptr ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -897,6 +905,18 @@ bx_param_num_c::text_print (FILE *fp)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_param_bool_c::text_print (FILE *fp)
|
||||
{
|
||||
if (get_format ()) {
|
||||
fprintf (fp, get_format (), get ());
|
||||
fprintf (fp, "\n");
|
||||
} else {
|
||||
char *format = "%s: %s\n";
|
||||
fprintf (fp, format, get_name (), get () ? "yes" : "no");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_param_string_c::text_print (FILE *fp)
|
||||
{
|
||||
@ -946,6 +966,24 @@ bx_param_num_c::text_ask (FILE *fpin, FILE *fpout)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_param_bool_c::text_ask (FILE *fpin, FILE *fpout)
|
||||
{
|
||||
fprintf (fpout, "\n");
|
||||
int status;
|
||||
char *prompt = get_ask_format ();
|
||||
if (prompt == NULL) {
|
||||
// default prompt, if they didn't set an ask format string
|
||||
prompt = "Set %s to: [%s] ";
|
||||
}
|
||||
Bit32u n = get ();
|
||||
status = ask_yn (prompt, n, &n);
|
||||
if (status < 0) return status;
|
||||
set (n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bx_param_string_c::text_ask (FILE *fpin, FILE *fpout)
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheight)
|
||||
BX_GRAVITY_LEFT, floppyB_handler);
|
||||
|
||||
// Mouse button
|
||||
if (bx_options.mouse_enabled->get ())
|
||||
if (bx_options.Omouse_enabled->get ())
|
||||
BX_GUI_THIS mouse_hbar_id = headerbar_bitmap(BX_GUI_THIS mouse_bmap_id,
|
||||
BX_GRAVITY_LEFT, mouse_handler);
|
||||
else
|
||||
@ -188,8 +188,8 @@ bx_gui_c::snapshot_handler(void)
|
||||
void
|
||||
bx_gui_c::mouse_handler(void)
|
||||
{
|
||||
int old = bx_options.mouse_enabled->get ();
|
||||
bx_options.mouse_enabled->set (!old);
|
||||
int old = bx_options.Omouse_enabled->get ();
|
||||
bx_options.Omouse_enabled->set (!old);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* gui/siminterface.cc
|
||||
* $Id: siminterface.cc,v 1.23 2001-06-19 21:36:09 fries Exp $
|
||||
* $Id: siminterface.cc,v 1.24 2001-06-20 14:01:39 bdenney Exp $
|
||||
*
|
||||
* Defines the actual link between bx_simulator_interface_c methods
|
||||
* and the simulator. This file includes bochs.h because it needs
|
||||
@ -86,7 +86,8 @@ bx_real_sim_c::get_param_num (bx_id id) {
|
||||
BX_PANIC (("get_param_num(%u) could not find a parameter", id));
|
||||
return NULL;
|
||||
}
|
||||
if (generic->get_type () == BXT_PARAM_NUM)
|
||||
int type = generic->get_type ();
|
||||
if (type == BXT_PARAM_NUM || type == BXT_PARAM_BOOL)
|
||||
return (bx_param_num_c *)generic;
|
||||
BX_PANIC (("get_param_num %u could not find an integer parameter with that id", id));
|
||||
return NULL;
|
||||
@ -219,14 +220,14 @@ bx_real_sim_c::write_rc (char *rc, int overwrite)
|
||||
int
|
||||
bx_real_sim_c::get_log_file (char *path, int len)
|
||||
{
|
||||
strncpy (path, bx_options.log.filename, len);
|
||||
strncpy (path, bx_options.log.Ofilename->getptr (), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::set_log_file (char *path)
|
||||
{
|
||||
strncpy (bx_options.log.filename, path, sizeof(bx_options.log.filename));
|
||||
bx_options.log.Ofilename->set (path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -294,17 +295,19 @@ bx_real_sim_c::set_cdrom_options (int drive, bx_cdrom_options *out)
|
||||
int
|
||||
bx_real_sim_c::get_newhd_support ()
|
||||
{
|
||||
return bx_options.newHardDriveSupport;
|
||||
return bx_options.OnewHardDriveSupport->get ();
|
||||
}
|
||||
|
||||
void
|
||||
bx_real_sim_c::set_newhd_support (int en)
|
||||
{
|
||||
bx_options.newHardDriveSupport = (en != 0);
|
||||
bx_options.OnewHardDriveSupport->set (en != 0);
|
||||
}
|
||||
|
||||
char *floppy_type_names[] = { "none", "1.2M", "1.44M", "2.88M", "720K" };
|
||||
char *floppy_type_names[] = { "none", "1.2M", "1.44M", "2.88M", "720K", NULL };
|
||||
int n_floppy_type_names = 5;
|
||||
char *floppy_status_names[] = { "ejected", "inserted", NULL };
|
||||
int n_floppy_status_names = 2;
|
||||
|
||||
char *
|
||||
bx_real_sim_c::get_floppy_type_name (int type)
|
||||
@ -317,14 +320,13 @@ bx_real_sim_c::get_floppy_type_name (int type)
|
||||
int
|
||||
bx_real_sim_c::get_boot_hard_disk ()
|
||||
{
|
||||
return bx_options.bootdrive[0] == 'c';
|
||||
return bx_options.Obootdrive->get () == BX_BOOT_DISKC;
|
||||
}
|
||||
|
||||
int
|
||||
bx_real_sim_c::set_boot_hard_disk (int val)
|
||||
{
|
||||
bx_options.bootdrive[0] = val? 'c' : 'a';
|
||||
bx_options.bootdrive[1] = 0;
|
||||
bx_options.Obootdrive->set (val? BX_BOOT_DISKC : BX_BOOT_FLOPPYA);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -350,13 +352,13 @@ bx_real_sim_c::set_rom_path (char *path)
|
||||
int
|
||||
bx_real_sim_c::get_private_colormap ()
|
||||
{
|
||||
return bx_options.private_colormap;
|
||||
return bx_options.Oprivate_colormap->get ();
|
||||
}
|
||||
|
||||
void
|
||||
bx_real_sim_c::set_private_colormap (int en)
|
||||
{
|
||||
bx_options.private_colormap = en;
|
||||
bx_options.Oprivate_colormap->set (en);
|
||||
}
|
||||
|
||||
void
|
||||
@ -451,7 +453,6 @@ bx_param_num_c::bx_param_num_c (bx_id id,
|
||||
this->val = initial_val;
|
||||
this->handler = NULL;
|
||||
this->base = 10;
|
||||
SIM->register_param (id, this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -484,6 +485,31 @@ bx_param_num_c::set (Bit32s newval)
|
||||
}
|
||||
}
|
||||
|
||||
bx_param_bool_c::bx_param_bool_c (bx_id id,
|
||||
char *name,
|
||||
char *description,
|
||||
Bit32s initial_val)
|
||||
: bx_param_num_c (id, name, description, 0, 1, initial_val)
|
||||
{
|
||||
set_type (BXT_PARAM_BOOL);
|
||||
}
|
||||
|
||||
bx_param_enum_c::bx_param_enum_c (bx_id id,
|
||||
char *name,
|
||||
char *description,
|
||||
char **choices,
|
||||
Bit32s initial_val,
|
||||
Bit32s value_base)
|
||||
: bx_param_num_c (id, name, description, value_base, BX_MAX_INT, initial_val)
|
||||
{
|
||||
this->choices = choices;
|
||||
this->value_base = value_base;
|
||||
// count number of choices, set max
|
||||
char **p = choices;
|
||||
while (*p != NULL) p++;
|
||||
this->max = value_base + (p - choices - 1);
|
||||
}
|
||||
|
||||
bx_param_string_c::bx_param_string_c (bx_id id,
|
||||
char *name,
|
||||
char *description,
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* gui/siminterface.h
|
||||
* $Id: siminterface.h,v 1.13 2001-06-18 14:11:55 bdenney Exp $
|
||||
* $Id: siminterface.h,v 1.14 2001-06-20 14:01:39 bdenney Exp $
|
||||
*
|
||||
* Interface to the simulator, currently only used by control.cc.
|
||||
* The base class bx_simulator_interface_c, contains only virtual functions
|
||||
@ -16,40 +16,6 @@
|
||||
|
||||
#define BX_UI_TEXT 1
|
||||
|
||||
#define BX_PATHNAME_LEN 512
|
||||
|
||||
#define BX_FLOPPY_NONE 10 // floppy not present
|
||||
#define BX_FLOPPY_1_2 11 // 1.2M 5.25"
|
||||
#define BX_FLOPPY_1_44 12 // 1.44M 3.5"
|
||||
#define BX_FLOPPY_2_88 13 // 2.88M 3.5"
|
||||
#define BX_FLOPPY_720K 14 // 720K 3.5"
|
||||
#define BX_FLOPPY_LAST 14 // last legal value of floppy type
|
||||
#define BX_FLOPPY_GUESS 20 // decide based on image size
|
||||
|
||||
extern char *floppy_type_names[];
|
||||
extern int n_floppy_type_names;
|
||||
|
||||
typedef struct {
|
||||
char path[BX_PATHNAME_LEN];
|
||||
unsigned type;
|
||||
unsigned initial_status;
|
||||
} bx_floppy_options;
|
||||
|
||||
typedef struct {
|
||||
int present;
|
||||
char path[BX_PATHNAME_LEN];
|
||||
unsigned int cylinders;
|
||||
unsigned int heads;
|
||||
unsigned int spt;
|
||||
} bx_disk_options;
|
||||
|
||||
struct bx_cdrom_options
|
||||
{
|
||||
int present;
|
||||
char dev[BX_PATHNAME_LEN];
|
||||
int inserted;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum {
|
||||
@ -65,6 +31,39 @@ typedef enum {
|
||||
BXP_LIST_OPTIONS, //options field in any bx_list
|
||||
BXP_LIST_CHOICE, //choice field in any bx_list
|
||||
BXP_MEMORY_OPTIONS_MENU,
|
||||
BXP_KBD_SERIAL_DELAY,
|
||||
BXP_FLOPPY_CMD_DELAY,
|
||||
BXP_FLOPPYA_PATH,
|
||||
BXP_FLOPPYA_TYPE,
|
||||
BXP_FLOPPYA_STATUS,
|
||||
BXP_FLOPPYB_PATH,
|
||||
BXP_FLOPPYB_TYPE,
|
||||
BXP_FLOPPYB_STATUS,
|
||||
BXP_DISKC_PRESENT,
|
||||
BXP_DISKC_PATH,
|
||||
BXP_DISKC_CYLINDERS,
|
||||
BXP_DISKC_HEADS,
|
||||
BXP_DISKC_SPT,
|
||||
BXP_DISKD_PRESENT,
|
||||
BXP_DISKD_PATH,
|
||||
BXP_DISKD_CYLINDERS,
|
||||
BXP_DISKD_HEADS,
|
||||
BXP_DISKD_SPT,
|
||||
BXP_CDROM_PRESENT,
|
||||
BXP_CDROM_PATH,
|
||||
BXP_CDROM_INSERTED,
|
||||
BXP_PRIVATE_COLORMAP,
|
||||
BXP_I440FX_SUPPORT,
|
||||
BXP_NEWHARDDRIVESUPPORT,
|
||||
BXP_LOG_FILENAME,
|
||||
BXP_CMOS_PATH,
|
||||
BXP_CMOS_IMAGE,
|
||||
BXP_CMOS_TIME0,
|
||||
BXP_LOAD32BITOS_WHICH,
|
||||
BXP_LOAD32BITOS_PATH,
|
||||
BXP_LOAD32BITOS_IOLOG,
|
||||
BXP_LOAD32BITOS_INITRD,
|
||||
BXP_BOOTDRIVE,
|
||||
BXP_THIS_IS_THE_LAST // used to determine length of list
|
||||
} bx_id;
|
||||
|
||||
@ -73,6 +72,8 @@ typedef enum {
|
||||
BXT_NODE,
|
||||
BXT_PARAM,
|
||||
BXT_PARAM_NUM,
|
||||
BXT_PARAM_BOOL,
|
||||
BXT_PARAM_ENUM,
|
||||
BXT_PARAM_STRING,
|
||||
BXT_LIST
|
||||
} bx_objtype;
|
||||
@ -159,6 +160,7 @@ public:
|
||||
typedef Bit32s (*param_event_handler)(class bx_param_c *, int set, Bit32s val);
|
||||
|
||||
class bx_param_num_c : public bx_param_c {
|
||||
protected:
|
||||
Bit32s min, max, val, initial_val;
|
||||
param_event_handler handler;
|
||||
int base;
|
||||
@ -178,6 +180,34 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
class bx_param_bool_c : public bx_param_num_c {
|
||||
public:
|
||||
bx_param_bool_c (bx_id id,
|
||||
char *name,
|
||||
char *description,
|
||||
Bit32s initial_val);
|
||||
#if BX_UI_TEXT
|
||||
virtual void text_print (FILE *fp);
|
||||
virtual int text_ask (FILE *fpin, FILE *fpout);
|
||||
#endif
|
||||
};
|
||||
|
||||
class bx_param_enum_c : public bx_param_num_c {
|
||||
Bit32s value_base;
|
||||
char **choices;
|
||||
public:
|
||||
bx_param_enum_c (bx_id id,
|
||||
char *name,
|
||||
char *description,
|
||||
char **choices,
|
||||
Bit32s initial_val,
|
||||
Bit32s value_base = 0);
|
||||
#if BX_UI_TEXT
|
||||
//virtual void text_print (FILE *fp);
|
||||
//virtual int text_ask (FILE *fpin, FILE *fpout);
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Bit32s (*param_string_event_handler)(class bx_param_string_c *, int set, char *val, int maxlen);
|
||||
|
||||
class bx_param_string_c : public bx_param_c {
|
||||
@ -256,6 +286,43 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define BX_FLOPPY_NONE 10 // floppy not present
|
||||
#define BX_FLOPPY_1_2 11 // 1.2M 5.25"
|
||||
#define BX_FLOPPY_1_44 12 // 1.44M 3.5"
|
||||
#define BX_FLOPPY_2_88 13 // 2.88M 3.5"
|
||||
#define BX_FLOPPY_720K 14 // 720K 3.5"
|
||||
#define BX_FLOPPY_LAST 14 // last legal value of floppy type
|
||||
#define BX_FLOPPY_GUESS 20 // decide based on image size
|
||||
|
||||
extern char *floppy_type_names[];
|
||||
extern int n_floppy_type_names;
|
||||
extern char *floppy_status_names[];
|
||||
extern int n_floppy_status_names;
|
||||
|
||||
typedef struct {
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_enum_c *Otype;
|
||||
bx_param_enum_c *Oinitial_status;
|
||||
} bx_floppy_options;
|
||||
|
||||
typedef struct {
|
||||
bx_param_bool_c *Opresent;
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_num_c *Ocylinders;
|
||||
bx_param_num_c *Oheads;
|
||||
bx_param_num_c *Ospt;
|
||||
} bx_disk_options;
|
||||
|
||||
struct bx_cdrom_options
|
||||
{
|
||||
bx_param_bool_c *Opresent;
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_bool_c *Oinserted;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -282,8 +282,8 @@ bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth,
|
||||
th->setprefix("XGUI");
|
||||
UNUSED(th);
|
||||
|
||||
if (bx_options.private_colormap) {
|
||||
BX_ERROR(( "private_colormap option not handled yet." ));
|
||||
if (bx_options.Oprivate_colormap->get ()) {
|
||||
BX_ERROR(( "Oprivate_colormap option not handled yet." ));
|
||||
}
|
||||
|
||||
x_tilesize = tilewidth;
|
||||
@ -340,7 +340,7 @@ if (bx_options.private_colormap) {
|
||||
default_depth = DefaultDepth(bx_x_display, bx_x_screen_num);
|
||||
default_visual = DefaultVisual(bx_x_display, bx_x_screen_num);
|
||||
|
||||
if (bx_options.private_colormap) {
|
||||
if (bx_options.Oprivate_colormap->get ()) {
|
||||
default_cmap = XCreateColormap(bx_x_display, DefaultRootWindow(bx_x_display),
|
||||
default_visual, AllocNone);
|
||||
if (XAllocColorCells(bx_x_display, default_cmap, False,
|
||||
@ -610,7 +610,7 @@ bx_gui_c::handle_events(void)
|
||||
|
||||
// (mch) Hack for easier mouse handling (toggle mouse enable)
|
||||
mouse_handler();
|
||||
if (bx_options.mouse_enabled->get ()) {
|
||||
if (bx_options.Omouse_enabled->get ()) {
|
||||
BX_INFO(("[x] Mouse on"));
|
||||
mouse_enable_x = current_x;
|
||||
mouse_enable_y = current_y;
|
||||
@ -1095,7 +1095,7 @@ bx_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigned
|
||||
color.green = green << 8;
|
||||
color.blue = blue << 8;
|
||||
|
||||
if (bx_options.private_colormap) {
|
||||
if (bx_options.Oprivate_colormap->get ()) {
|
||||
color.pixel = index;
|
||||
XStoreColor(bx_x_display, default_cmap, &color);
|
||||
return(0); // no screen update needed
|
||||
@ -1241,7 +1241,7 @@ bx_gui_c::exit(void)
|
||||
|
||||
static void warp_cursor (int dx, int dy)
|
||||
{
|
||||
if (bx_options.mouse_enabled->get ()) {
|
||||
if (bx_options.Omouse_enabled->get ()) {
|
||||
warp_dx = dx;
|
||||
warp_dy = dy;
|
||||
XWarpPointer(bx_x_display, None, None, 0, 0, 0, 0, dx, dy);
|
||||
|
@ -100,10 +100,10 @@ bx_cmos_c::init(bx_devices_c *d)
|
||||
BX_CMOS_THIS s.timeval = BX_USE_SPECIFIED_TIME0;
|
||||
#endif
|
||||
|
||||
if (bx_options.cmos.time0 == 1)
|
||||
if (bx_options.cmos.Otime0->get () == 1)
|
||||
BX_CMOS_THIS s.timeval = time(NULL);
|
||||
else if (bx_options.cmos.time0 != 0)
|
||||
BX_CMOS_THIS s.timeval = bx_options.cmos.time0;
|
||||
else if (bx_options.cmos.Otime0->get () != 0)
|
||||
BX_CMOS_THIS s.timeval = bx_options.cmos.Otime0->get ();
|
||||
|
||||
char *tmptime;
|
||||
while( (tmptime = strdup(ctime(&(BX_CMOS_THIS s.timeval)))) == NULL) {
|
||||
@ -116,19 +116,19 @@ bx_cmos_c::init(bx_devices_c *d)
|
||||
update_clock();
|
||||
|
||||
// load CMOS from image file if requested.
|
||||
if (bx_options.cmos.cmosImage) {
|
||||
if (bx_options.cmos.OcmosImage->get ()) {
|
||||
// CMOS image file requested
|
||||
int fd, ret;
|
||||
struct stat stat_buf;
|
||||
|
||||
fd = open(bx_options.cmos.path, O_RDONLY
|
||||
fd = open(bx_options.cmos.Opath->getptr (), O_RDONLY
|
||||
#ifdef O_BINARY
|
||||
| O_BINARY
|
||||
#endif
|
||||
);
|
||||
if (fd < 0) {
|
||||
BX_PANIC(("trying to open cmos image file '%s'",
|
||||
bx_options.cmos.path));
|
||||
bx_options.cmos.Opath->getptr ()));
|
||||
}
|
||||
ret = fstat(fd, &stat_buf);
|
||||
if (ret) {
|
||||
@ -144,7 +144,7 @@ bx_cmos_c::init(bx_devices_c *d)
|
||||
}
|
||||
close(fd);
|
||||
BX_INFO(("successfuly read from image file '%s'.",
|
||||
bx_options.cmos.path));
|
||||
bx_options.cmos.Opath->getptr ()));
|
||||
}
|
||||
else {
|
||||
// CMOS values generated
|
||||
|
@ -109,7 +109,7 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_FD_THIS s.media_present[0] = 0;
|
||||
|
||||
|
||||
switch (bx_options.floppya.type) {
|
||||
switch (bx_options.floppya.Otype->get ()) {
|
||||
case BX_FLOPPY_NONE:
|
||||
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x00;
|
||||
break;
|
||||
@ -129,10 +129,10 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_PANIC(( "unknown floppya type" ));
|
||||
}
|
||||
|
||||
if (bx_options.floppya.type != BX_FLOPPY_NONE) {
|
||||
if (bx_options.floppya.Otype->get () != BX_FLOPPY_NONE) {
|
||||
BX_FD_THIS s.num_supported_floppies++;
|
||||
if ( bx_options.floppya.initial_status == BX_INSERTED) {
|
||||
if (evaluate_media(bx_options.floppya.type, bx_options.floppya.path,
|
||||
if ( bx_options.floppya.Oinitial_status->get () == BX_INSERTED) {
|
||||
if (evaluate_media(bx_options.floppya.Otype->get (), bx_options.floppya.Opath->getptr (),
|
||||
& BX_FD_THIS s.media[0]))
|
||||
BX_FD_THIS s.media_present[0] = 1;
|
||||
}
|
||||
@ -150,7 +150,7 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_FD_THIS s.media[1].fd = -1;
|
||||
BX_FD_THIS s.media_present[1] = 0;
|
||||
|
||||
switch (bx_options.floppyb.type) {
|
||||
switch (bx_options.floppyb.Otype->get ()) {
|
||||
case BX_FLOPPY_NONE:
|
||||
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0xf0) | 0x00;
|
||||
break;
|
||||
@ -170,10 +170,10 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_PANIC(("unknown floppyb type"));
|
||||
}
|
||||
|
||||
if (bx_options.floppyb.type != BX_FLOPPY_NONE) {
|
||||
if (bx_options.floppyb.Otype->get () != BX_FLOPPY_NONE) {
|
||||
BX_FD_THIS s.num_supported_floppies++;
|
||||
if ( bx_options.floppyb.initial_status == BX_INSERTED) {
|
||||
if (evaluate_media(bx_options.floppyb.type, bx_options.floppyb.path,
|
||||
if ( bx_options.floppyb.Oinitial_status->get () == BX_INSERTED) {
|
||||
if (evaluate_media(bx_options.floppyb.Otype->get (), bx_options.floppyb.Opath->getptr (),
|
||||
& BX_FD_THIS s.media[1]))
|
||||
BX_FD_THIS s.media_present[1] = 1;
|
||||
}
|
||||
@ -192,10 +192,10 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
|
||||
BX_FD_THIS s.floppy_timer_index =
|
||||
bx_pc_system.register_timer( this, timer_handler,
|
||||
bx_options.floppy_command_delay, 0,0);
|
||||
bx_options.Ofloppy_command_delay->get (), 0,0);
|
||||
|
||||
BX_INFO(("bx_options.floppy_command_delay = %u",
|
||||
(unsigned) bx_options.floppy_command_delay));
|
||||
BX_INFO(("bx_options.Ofloppy_command_delay = %u",
|
||||
(unsigned) bx_options.Ofloppy_command_delay->get ()));
|
||||
}
|
||||
|
||||
|
||||
@ -391,7 +391,7 @@ bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
BX_FD_THIS s.pending_command = 0xfe; // RESET pending
|
||||
|
||||
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
|
||||
bx_options.floppy_command_delay, 0 );
|
||||
bx_options.Ofloppy_command_delay->get (), 0 );
|
||||
#endif
|
||||
}
|
||||
else if (prev_normal_operation && normal_operation==0) {
|
||||
@ -400,7 +400,7 @@ bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
BX_FD_THIS s.pending_command = 0xfe; // RESET pending
|
||||
|
||||
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
|
||||
bx_options.floppy_command_delay, 0 );
|
||||
bx_options.Ofloppy_command_delay->get (), 0 );
|
||||
}
|
||||
if (bx_dbg.floppy) {
|
||||
BX_INFO(("io_write: digital output register"));
|
||||
@ -606,7 +606,7 @@ bx_floppy_ctrl_c::floppy_command(void)
|
||||
BX_FD_THIS s.DOR |= 0x20; // turn on MOTB
|
||||
BX_FD_THIS s.cylinder[drive] = 0;
|
||||
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
|
||||
bx_options.floppy_command_delay, 0 );
|
||||
bx_options.Ofloppy_command_delay->get (), 0 );
|
||||
/* command head to track 0
|
||||
* controller set to non-busy
|
||||
* error condition noted in Status reg 0's equipment check bit
|
||||
@ -662,7 +662,7 @@ bx_floppy_ctrl_c::floppy_command(void)
|
||||
BX_PANIC(("floppy_command(): seek: drive>1"));
|
||||
/* ??? should also check cylinder validity */
|
||||
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
|
||||
bx_options.floppy_command_delay, 0 );
|
||||
bx_options.Ofloppy_command_delay->get (), 0 );
|
||||
/* data reg not ready, controller busy */
|
||||
BX_FD_THIS s.main_status_reg = FD_MS_DIO | FD_MS_BUSY;
|
||||
BX_FD_THIS s.pending_command = 0x0f; /* seek pending */
|
||||
@ -700,7 +700,7 @@ bx_floppy_ctrl_c::floppy_command(void)
|
||||
BX_FD_THIS s.result[5] = 0; /* sector at completion */
|
||||
BX_FD_THIS s.result[6] = 2;
|
||||
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
|
||||
bx_options.floppy_command_delay, 0 );
|
||||
bx_options.Ofloppy_command_delay->get (), 0 );
|
||||
/* data reg not ready, controller busy */
|
||||
BX_FD_THIS s.main_status_reg = FD_MS_DIO | FD_MS_BUSY;
|
||||
BX_FD_THIS s.pending_command = 0x4a; /* read ID pending */
|
||||
@ -802,7 +802,7 @@ bx_floppy_ctrl_c::floppy_command(void)
|
||||
BX_FD_THIS s.result[6] = 2; // sector size = 512
|
||||
|
||||
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
|
||||
bx_options.floppy_command_delay, 0 );
|
||||
bx_options.Ofloppy_command_delay->get (), 0 );
|
||||
/* data reg not ready, controller busy */
|
||||
BX_FD_THIS s.main_status_reg = FD_MS_DIO | FD_MS_BUSY;
|
||||
BX_FD_THIS s.pending_command = BX_FD_THIS s.command[0];
|
||||
@ -881,7 +881,7 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
|
||||
}
|
||||
|
||||
#ifdef macintosh
|
||||
if (strcmp(bx_options.floppya.path, SuperDrive))
|
||||
if (strcmp(bx_options.floppya.Opath->getptr (), SuperDrive))
|
||||
#endif
|
||||
{
|
||||
ret = lseek(BX_FD_THIS s.media[drive].fd, offset, SEEK_SET);
|
||||
@ -892,7 +892,7 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
|
||||
|
||||
if (direction == FROM_FLOPPY) {
|
||||
#ifdef macintosh
|
||||
if (!strcmp(bx_options.floppya.path, SuperDrive))
|
||||
if (!strcmp(bx_options.floppya.Opath->getptr (), SuperDrive))
|
||||
ret = fd_read((char *) buffer, offset, bytes);
|
||||
else
|
||||
#endif
|
||||
@ -914,7 +914,7 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
|
||||
else { // TO_FLOPPY
|
||||
BX_ASSERT (!BX_FD_THIS s.media[drive].write_protected);
|
||||
#ifdef macintosh
|
||||
if (!strcmp(bx_options.floppya.path, SuperDrive))
|
||||
if (!strcmp(bx_options.floppya.Opath->getptr (), SuperDrive))
|
||||
ret = fd_write((char *) buffer, offset, bytes);
|
||||
else
|
||||
#endif
|
||||
@ -1165,12 +1165,12 @@ bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
|
||||
else {
|
||||
// insert floppy
|
||||
if (drive == 0) {
|
||||
path = bx_options.floppya.path;
|
||||
type = bx_options.floppya.type;
|
||||
path = bx_options.floppya.Opath->getptr ();
|
||||
type = bx_options.floppya.Otype->get ();
|
||||
}
|
||||
else {
|
||||
path = bx_options.floppyb.path;
|
||||
type = bx_options.floppyb.type;
|
||||
path = bx_options.floppyb.Opath->getptr ();
|
||||
type = bx_options.floppyb.Otype->get ();
|
||||
}
|
||||
if (evaluate_media(type, path, & BX_FD_THIS s.media[drive])) {
|
||||
BX_FD_THIS s.media_present[drive] = 1;
|
||||
@ -1204,7 +1204,7 @@ bx_floppy_ctrl_c::evaluate_media(unsigned type, char *path, floppy_t *media)
|
||||
media->write_protected = 0;
|
||||
#ifdef macintosh
|
||||
media->fd = 0;
|
||||
if (strcmp(bx_options.floppya.path, SuperDrive))
|
||||
if (strcmp(bx_options.floppya.Opath->getptr (), SuperDrive))
|
||||
#endif
|
||||
media->fd = open(path, O_RDWR
|
||||
#ifdef O_BINARY
|
||||
@ -1218,7 +1218,7 @@ bx_floppy_ctrl_c::evaluate_media(unsigned type, char *path, floppy_t *media)
|
||||
media->write_protected = 1;
|
||||
#ifdef macintosh
|
||||
media->fd = 0;
|
||||
if (strcmp(bx_options.floppya.path, SuperDrive))
|
||||
if (strcmp(bx_options.floppya.Opath->getptr (), SuperDrive))
|
||||
#endif
|
||||
media->fd = open(path, O_RDONLY
|
||||
#ifdef O_BINARY
|
||||
@ -1234,7 +1234,7 @@ bx_floppy_ctrl_c::evaluate_media(unsigned type, char *path, floppy_t *media)
|
||||
BX_INFO(("opened %s with readonly=%d", path, media->write_protected));
|
||||
|
||||
#if BX_WITH_MACOS
|
||||
if (!strcmp(bx_options.floppya.path, SuperDrive))
|
||||
if (!strcmp(bx_options.floppya.Opath->getptr (), SuperDrive))
|
||||
ret = fd_stat(&stat_buf);
|
||||
else
|
||||
ret = fstat(media->fd, &stat_buf);
|
||||
|
@ -122,17 +122,17 @@ bx_hard_drive_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
|
||||
BX_HD_THIS drive_select = 0;
|
||||
|
||||
BX_HD_THIS s[0].hard_drive->cylinders = bx_options.diskc.cylinders;
|
||||
BX_HD_THIS s[0].hard_drive->heads = bx_options.diskc.heads;
|
||||
BX_HD_THIS s[0].hard_drive->sectors = bx_options.diskc.spt;
|
||||
BX_HD_THIS s[0].hard_drive->cylinders = bx_options.diskc.Ocylinders->get ();
|
||||
BX_HD_THIS s[0].hard_drive->heads = bx_options.diskc.Oheads->get ();
|
||||
BX_HD_THIS s[0].hard_drive->sectors = bx_options.diskc.Ospt->get ();
|
||||
BX_HD_THIS s[0].device_type = IDE_DISK;
|
||||
BX_HD_THIS s[1].hard_drive->cylinders = bx_options.diskd.cylinders;
|
||||
BX_HD_THIS s[1].hard_drive->heads = bx_options.diskd.heads;
|
||||
BX_HD_THIS s[1].hard_drive->sectors = bx_options.diskd.spt;
|
||||
BX_HD_THIS s[1].hard_drive->cylinders = bx_options.diskd.Ocylinders->get ();
|
||||
BX_HD_THIS s[1].hard_drive->heads = bx_options.diskd.Oheads->get ();
|
||||
BX_HD_THIS s[1].hard_drive->sectors = bx_options.diskd.Ospt->get ();
|
||||
BX_HD_THIS s[1].device_type = IDE_DISK;
|
||||
|
||||
if (bx_options.cdromd.present) {
|
||||
bx_options.diskd.present = 1;
|
||||
if (bx_options.cdromd.Opresent->get ()) {
|
||||
bx_options.diskd.Opresent->set (1);
|
||||
BX_DEBUG(( "Experimental CDROM on target 1" ));
|
||||
BX_HD_THIS s[1].device_type = IDE_CDROM;
|
||||
BX_HD_THIS s[1].cdrom.locked = 0;
|
||||
@ -186,77 +186,77 @@ bx_hard_drive_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
}
|
||||
|
||||
/* open hard drive image file */
|
||||
if (bx_options.diskc.present) {
|
||||
if (bx_options.diskc.Opresent->get ()) {
|
||||
BX_INFO(("Opening image for device 0"));
|
||||
if ((BX_HD_THIS s[0].hard_drive->open(bx_options.diskc.path)) < 0) {
|
||||
if ((BX_HD_THIS s[0].hard_drive->open(bx_options.diskc.Opath->getptr ())) < 0) {
|
||||
BX_PANIC(("could not open hard drive image file '%s'",
|
||||
bx_options.diskc.path));
|
||||
bx_options.diskc.Opath->getptr ()));
|
||||
}
|
||||
}
|
||||
if (bx_options.diskd.present && !bx_options.cdromd.present) {
|
||||
if (bx_options.diskd.Opresent->get () && !bx_options.cdromd.Opresent->get ()) {
|
||||
BX_INFO(("Opening image for device 1"));
|
||||
if ((BX_HD_THIS s[1].hard_drive->open(bx_options.diskd.path)) < 0) {
|
||||
if ((BX_HD_THIS s[1].hard_drive->open(bx_options.diskd.Opath->getptr ())) < 0) {
|
||||
BX_PANIC(("could not open hard drive image file '%s'",
|
||||
bx_options.diskd.path));
|
||||
bx_options.diskd.Opath->getptr ()));
|
||||
}
|
||||
}
|
||||
|
||||
// generate CMOS values for hard drive if not using a CMOS image
|
||||
if (!bx_options.cmos.cmosImage) {
|
||||
if (!bx_options.cmos.OcmosImage->get ()) {
|
||||
cmos->s.reg[0x12] = 0x00; // start out with: no drive 0, no drive 1
|
||||
|
||||
if (bx_options.diskc.present) {
|
||||
if (bx_options.diskc.Opresent->get ()) {
|
||||
// Flag drive type as Fh, use extended CMOS location as real type
|
||||
cmos->s.reg[0x12] = (cmos->s.reg[0x12] & 0x0f) | 0xf0;
|
||||
cmos->s.reg[0x19] = 47; // user definable type
|
||||
// AMI BIOS: 1st hard disk #cyl low byte
|
||||
cmos->s.reg[0x1b] = (bx_options.diskc.cylinders & 0x00ff);
|
||||
cmos->s.reg[0x1b] = (bx_options.diskc.Ocylinders->get () & 0x00ff);
|
||||
// AMI BIOS: 1st hard disk #cyl high byte
|
||||
cmos->s.reg[0x1c] = (bx_options.diskc.cylinders & 0xff00) >> 8;
|
||||
cmos->s.reg[0x1c] = (bx_options.diskc.Ocylinders->get () & 0xff00) >> 8;
|
||||
// AMI BIOS: 1st hard disk #heads
|
||||
cmos->s.reg[0x1d] = (bx_options.diskc.heads);
|
||||
cmos->s.reg[0x1d] = (bx_options.diskc.Oheads->get ());
|
||||
// AMI BIOS: 1st hard disk write precompensation cylinder, low byte
|
||||
cmos->s.reg[0x1e] = 0xff; // -1
|
||||
// AMI BIOS: 1st hard disk write precompensation cylinder, high byte
|
||||
cmos->s.reg[0x1f] = 0xff; // -1
|
||||
// AMI BIOS: 1st hard disk control byte
|
||||
cmos->s.reg[0x20] = 0xc0 | ((bx_options.diskc.heads > 8) << 3);
|
||||
cmos->s.reg[0x20] = 0xc0 | ((bx_options.diskc.Oheads->get () > 8) << 3);
|
||||
// AMI BIOS: 1st hard disk landing zone, low byte
|
||||
cmos->s.reg[0x21] = cmos->s.reg[0x1b];
|
||||
// AMI BIOS: 1st hard disk landing zone, high byte
|
||||
cmos->s.reg[0x22] = cmos->s.reg[0x1c];
|
||||
// AMI BIOS: 1st hard disk sectors/track
|
||||
cmos->s.reg[0x23] = bx_options.diskc.spt;
|
||||
cmos->s.reg[0x23] = bx_options.diskc.Ospt->get ();
|
||||
}
|
||||
|
||||
//set up cmos for second hard drive
|
||||
if (bx_options.diskd.present) {
|
||||
if (bx_options.diskd.Opresent->get ()) {
|
||||
BX_DEBUG(("1: I will put 0xf into the second hard disk field"));
|
||||
// fill in lower 4 bits of 0x12 for second HD
|
||||
cmos->s.reg[0x12] = (cmos->s.reg[0x12] & 0xf0) | 0x0f;
|
||||
cmos->s.reg[0x1a] = 47; // user definable type
|
||||
// AMI BIOS: 2nd hard disk #cyl low byte
|
||||
cmos->s.reg[0x24] = (bx_options.diskd.cylinders & 0x00ff);
|
||||
cmos->s.reg[0x24] = (bx_options.diskd.Ocylinders->get () & 0x00ff);
|
||||
// AMI BIOS: 2nd hard disk #cyl high byte
|
||||
cmos->s.reg[0x25] = (bx_options.diskd.cylinders & 0xff00) >> 8;
|
||||
cmos->s.reg[0x25] = (bx_options.diskd.Ocylinders->get () & 0xff00) >> 8;
|
||||
// AMI BIOS: 2nd hard disk #heads
|
||||
cmos->s.reg[0x26] = (bx_options.diskd.heads);
|
||||
cmos->s.reg[0x26] = (bx_options.diskd.Oheads->get ());
|
||||
// AMI BIOS: 2nd hard disk write precompensation cylinder, low byte
|
||||
cmos->s.reg[0x27] = 0xff; // -1
|
||||
// AMI BIOS: 2nd hard disk write precompensation cylinder, high byte
|
||||
cmos->s.reg[0x28] = 0xff; // -1
|
||||
// AMI BIOS: 2nd hard disk, 0x80 if heads>8
|
||||
cmos->s.reg[0x29] = (bx_options.diskd.heads > 8) ? 0x80 : 0x00;
|
||||
cmos->s.reg[0x29] = (bx_options.diskd.Oheads->get () > 8) ? 0x80 : 0x00;
|
||||
// AMI BIOS: 2nd hard disk landing zone, low byte
|
||||
cmos->s.reg[0x2a] = cmos->s.reg[0x1b];
|
||||
// AMI BIOS: 2nd hard disk landing zone, high byte
|
||||
cmos->s.reg[0x2b] = cmos->s.reg[0x1c];
|
||||
// AMI BIOS: 2nd hard disk sectors/track
|
||||
cmos->s.reg[0x2c] = bx_options.diskd.spt;
|
||||
cmos->s.reg[0x2c] = bx_options.diskd.Ospt->get ();
|
||||
}
|
||||
|
||||
|
||||
if ( bx_options.bootdrive[0] == 'c' ) {
|
||||
if ( bx_options.Obootdrive->get () == BX_BOOT_DISKC) {
|
||||
// system boot sequence C:, A:
|
||||
cmos->s.reg[0x2d] &= 0xdf;
|
||||
}
|
||||
@ -361,7 +361,7 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
BX_SELECTED_CONTROLLER.status.busy = 0;
|
||||
BX_SELECTED_CONTROLLER.status.drive_ready = 1;
|
||||
BX_SELECTED_CONTROLLER.status.write_fault = 0;
|
||||
if (bx_options.newHardDriveSupport)
|
||||
if (bx_options.OnewHardDriveSupport->get ())
|
||||
BX_SELECTED_CONTROLLER.status.seek_complete = 1;
|
||||
else
|
||||
BX_SELECTED_CONTROLLER.status.seek_complete = 0;
|
||||
@ -399,7 +399,7 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
|
||||
case 0xec: // Drive ID Command
|
||||
case 0xa1:
|
||||
if (bx_options.newHardDriveSupport) {
|
||||
if (bx_options.OnewHardDriveSupport->get ()) {
|
||||
unsigned index;
|
||||
|
||||
BX_SELECTED_CONTROLLER.status.busy = 0;
|
||||
@ -576,7 +576,7 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
|
||||
|
||||
case 0x1f7: // Hard Disk Status
|
||||
case 0x3f6: // Hard Disk Alternate Status
|
||||
if (BX_HD_THIS drive_select && !bx_options.diskd.present) {
|
||||
if (BX_HD_THIS drive_select && !bx_options.diskd.Opresent->get ()) {
|
||||
// (mch) Just return zero for these registers
|
||||
value8 = 0;
|
||||
} else {
|
||||
@ -1280,7 +1280,7 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
case 0x1f7: // hard disk command
|
||||
// (mch) Writes to the command register with drive_select != 0
|
||||
// are ignored if no secondary device is present
|
||||
if (BX_HD_THIS drive_select != 0 && value != 0x90 && !bx_options.diskd.present)
|
||||
if (BX_HD_THIS drive_select != 0 && value != 0x90 && !bx_options.diskd.Opresent->get ())
|
||||
break;
|
||||
|
||||
if (BX_SELECTED_CONTROLLER.status.busy)
|
||||
@ -1292,7 +1292,7 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
case 0x10: // calibrate drive
|
||||
if (BX_SELECTED_HD.device_type != IDE_DISK)
|
||||
BX_PANIC(("calibrate drive issued to non-disk"));
|
||||
if (BX_HD_THIS drive_select != 0 && !bx_options.diskd.present) {
|
||||
if (BX_HD_THIS drive_select != 0 && !bx_options.diskd.Opresent->get ()) {
|
||||
BX_SELECTED_CONTROLLER.error_register = 0x02; // Track 0 not found
|
||||
BX_SELECTED_CONTROLLER.status.busy = 0;
|
||||
BX_SELECTED_CONTROLLER.status.drive_ready = 1;
|
||||
@ -1418,7 +1418,7 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
(unsigned) BX_HD_THIS drive_select));
|
||||
BX_INFO((" head number = %u",
|
||||
(unsigned) BX_SELECTED_CONTROLLER.head_no));
|
||||
if (BX_HD_THIS drive_select != 0 && !bx_options.diskd.present) {
|
||||
if (BX_HD_THIS drive_select != 0 && !bx_options.diskd.Opresent->get ()) {
|
||||
BX_PANIC(("init drive params: drive != 0"));
|
||||
//BX_SELECTED_CONTROLLER.error_register = 0x12;
|
||||
BX_SELECTED_CONTROLLER.status.busy = 0;
|
||||
@ -1440,11 +1440,11 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
break;
|
||||
|
||||
case 0xec: // Get Drive Info
|
||||
if (bx_options.newHardDriveSupport) {
|
||||
if (bx_options.OnewHardDriveSupport->get ()) {
|
||||
if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
|
||||
BX_INFO(("Drive ID Command issued : 0xec "));
|
||||
|
||||
if (BX_HD_THIS drive_select && !bx_options.diskd.present) {
|
||||
if (BX_HD_THIS drive_select && !bx_options.diskd.Opresent->get ()) {
|
||||
BX_INFO(("2nd drive not present, aborting"));
|
||||
command_aborted(value);
|
||||
break;
|
||||
@ -1496,7 +1496,7 @@ bx_hard_drive_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
break;
|
||||
|
||||
case 0x40: //
|
||||
if (bx_options.newHardDriveSupport) {
|
||||
if (bx_options.OnewHardDriveSupport->get ()) {
|
||||
if (BX_SELECTED_HD.device_type != IDE_DISK)
|
||||
BX_PANIC(("read verify issued to non-disk"));
|
||||
BX_INFO(("Verify Command : 0x40 ! "));
|
||||
|
@ -138,8 +138,8 @@ bx_keyb_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_KEY_THIS s.kbd_controller.irq1_requested = 0;
|
||||
BX_KEY_THIS s.kbd_controller.irq12_requested = 0;
|
||||
|
||||
//BX_DEBUG(( "# keyboard_serial_delay is %u usec",
|
||||
// (unsigned) bx_options.keyboard_serial_delay));
|
||||
//BX_DEBUG(( "# Okeyboard_serial_delay is %u usec",
|
||||
// (unsigned) bx_options.Okeyboard_serial_delay->get ()));
|
||||
BX_KEY_THIS s.kbd_controller.timer_pending = 0;
|
||||
|
||||
// Mouse initialization stuff
|
||||
@ -1121,7 +1121,7 @@ bx_keyb_c::periodic( Bit32u usec_delta )
|
||||
bx_keyb_c::activate_timer(void)
|
||||
{
|
||||
if (BX_KEY_THIS s.kbd_controller.timer_pending == 0) {
|
||||
BX_KEY_THIS s.kbd_controller.timer_pending = bx_options.keyboard_serial_delay;
|
||||
BX_KEY_THIS s.kbd_controller.timer_pending = bx_options.Okeyboard_serial_delay->get ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1327,7 +1327,7 @@ bx_keyb_c::mouse_motion(int delta_x, int delta_y, unsigned button_state)
|
||||
|
||||
// If mouse events are disabled on the GUI headerbar, don't
|
||||
// generate any mouse data
|
||||
if (bx_options.mouse_enabled->get () == 0)
|
||||
if (bx_options.Omouse_enabled->get () == 0)
|
||||
return;
|
||||
|
||||
|
||||
|
@ -187,9 +187,9 @@ bx_vga_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
bx_gui.init(1, &argv[0], BX_VGA_THIS s.x_tilesize, BX_VGA_THIS s.y_tilesize);
|
||||
}
|
||||
|
||||
BX_INFO(("interval=%lu", bx_options.vga_update_interval));
|
||||
BX_INFO(("interval=%lu", bx_options.Ovga_update_interval->get ()));
|
||||
BX_VGA_THIS timer_id = bx_pc_system.register_timer(this, timer_handler,
|
||||
bx_options.vga_update_interval->get (), 1, 1);
|
||||
bx_options.Ovga_update_interval->get (), 1, 1);
|
||||
|
||||
cmos->s.reg[0x14] = (cmos->s.reg[0x14] & 0xcf) | 0x00; /* video card with BIOS ROM */
|
||||
|
||||
@ -1112,7 +1112,6 @@ BX_VGA_THIS s.sequencer.bit1 = (value >> 1) & 0x01;
|
||||
void
|
||||
bx_vga_c::set_update_interval (unsigned interval)
|
||||
{
|
||||
bx_options.vga_update_interval->set (interval);
|
||||
BX_INFO (("Changing timer interval to %d\n", interval));
|
||||
BX_VGA_THIS timer ();
|
||||
bx_pc_system.activate_timer (BX_VGA_THIS timer_id, interval, 1);
|
||||
|
@ -43,7 +43,7 @@ bx_load32bitOSimagehack(void)
|
||||
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(bx_options.load32bitOSImage.iolog, "r");
|
||||
fp = fopen(bx_options.load32bitOSImage.Oiolog->getptr (), "r");
|
||||
|
||||
if (fp == NULL) {
|
||||
BX_PANIC(("could not open IO init file."));
|
||||
@ -72,7 +72,7 @@ bx_load32bitOSimagehack(void)
|
||||
}
|
||||
|
||||
// Invoke proper hack depending on which OS image we're loading
|
||||
switch (bx_options.load32bitOSImage.whichOS) {
|
||||
switch (bx_options.load32bitOSImage.OwhichOS->get ()) {
|
||||
case Load32bitOSLinux:
|
||||
bx_load_linux_hack();
|
||||
break;
|
||||
@ -175,13 +175,13 @@ bx_load_linux_hack(void)
|
||||
// Set CPU and memory features which are assumed at this point.
|
||||
|
||||
// Load Linux kernel image
|
||||
bx_load_kernel_image( bx_options.load32bitOSImage.path, 0x100000 );
|
||||
bx_load_kernel_image( bx_options.load32bitOSImage.Opath->getptr (), 0x100000 );
|
||||
|
||||
// Load initial ramdisk image if requested
|
||||
if ( bx_options.load32bitOSImage.initrd )
|
||||
if ( bx_options.load32bitOSImage.Oinitrd->getptr () )
|
||||
{
|
||||
initrd_start = 0x00800000; /* FIXME: load at top of memory */
|
||||
initrd_size = bx_load_kernel_image( bx_options.load32bitOSImage.initrd, initrd_start );
|
||||
initrd_size = bx_load_kernel_image( bx_options.load32bitOSImage.Oinitrd->getptr (), initrd_start );
|
||||
}
|
||||
|
||||
// Setup Linux startup parameters buffer
|
||||
@ -224,7 +224,7 @@ bx_load_null_kernel_hack(void)
|
||||
// The RESET function will have been called first.
|
||||
// Set CPU and memory features which are assumed at this point.
|
||||
|
||||
bx_load_kernel_image(bx_options.load32bitOSImage.path, 0x100000);
|
||||
bx_load_kernel_image(bx_options.load32bitOSImage.Opath->getptr (), 0x100000);
|
||||
|
||||
// EIP deltas
|
||||
BX_CPU(0)->prev_eip =
|
||||
|
475
bochs/main.cc
475
bochs/main.cc
@ -63,37 +63,35 @@ class state_file state_stuff("state_file.out", "options");
|
||||
bx_debug_t bx_dbg;
|
||||
|
||||
bx_options_t bx_options = {
|
||||
{ "", BX_FLOPPY_NONE, BX_EJECTED }, // floppya
|
||||
{ "", BX_FLOPPY_NONE, BX_EJECTED }, // floppyb
|
||||
{ 0, "", 0, 0, 0 }, // diskc
|
||||
{ 0, "", 0, 0, 0 }, // diskd
|
||||
{ 0, "", 0 }, // cdromd
|
||||
{ NULL, NULL, NULL }, // floppya
|
||||
{ NULL, NULL, NULL }, // floppyb
|
||||
{ 0, NULL, 0, 0, 0 }, // diskc
|
||||
{ 0, NULL, 0, 0, 0 }, // diskd
|
||||
{ 0, NULL, 0 }, // cdromd
|
||||
{ NULL, NULL }, // rom
|
||||
{ NULL }, // vgarom
|
||||
{ NULL }, // memory
|
||||
{ 0, NULL, NULL, NULL, 0, 0, 0, 0 }, // SB16
|
||||
"a", // boot drive
|
||||
NULL, // boot drive
|
||||
NULL, // vga update interval
|
||||
20000, // default keyboard serial path delay (usec)
|
||||
50000, // default floppy command delay (usec)
|
||||
NULL, // default keyboard serial path delay (usec)
|
||||
NULL, // default floppy command delay (usec)
|
||||
NULL, // ips
|
||||
NULL, // default mouse_enabled
|
||||
0, // default private_colormap
|
||||
0, // default i440FXSupport
|
||||
{NULL, 0}, // cmos path, cmos image boolean
|
||||
NULL, // default private_colormap
|
||||
NULL, // default i440FXSupport
|
||||
{NULL, NULL}, // cmos path, cmos image boolean
|
||||
{ 0, 0, 0, {0,0,0,0,0,0}, NULL, NULL }, // ne2k
|
||||
1, // newHardDriveSupport
|
||||
NULL, // newHardDriveSupport
|
||||
{ 0, NULL, NULL, NULL }, // load32bitOSImage hack stuff
|
||||
// log options: ignore debug, report info and error, crash on panic.
|
||||
{ "-", { ACT_IGNORE, ACT_REPORT, ACT_REPORT, ACT_ASK } },
|
||||
{ NULL, { ACT_IGNORE, ACT_REPORT, ACT_REPORT, ACT_ASK } },
|
||||
};
|
||||
|
||||
static void parse_line_unformatted(char *context, char *line);
|
||||
static void parse_line_formatted(char *context, int num_params, char *params[]);
|
||||
static int parse_bochsrc(char *rcfile);
|
||||
|
||||
|
||||
|
||||
static Bit32s
|
||||
bx_param_handler (bx_param_c *param, int set, Bit32s val)
|
||||
{
|
||||
@ -117,36 +115,133 @@ bx_param_handler (bx_param_c *param, int set, Bit32s val)
|
||||
|
||||
void bx_init_options ()
|
||||
{
|
||||
bx_options.floppya.Opath = new bx_param_string_c (BXP_FLOPPYA_PATH,
|
||||
"floppya:path",
|
||||
"Pathname of first floppy image file or device. If you're booting from floppy, this should be a bootable floppy.",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.floppya.Otype = new bx_param_enum_c (BXP_FLOPPYA_TYPE,
|
||||
"floppya:type",
|
||||
"Type of floppy disk",
|
||||
floppy_status_names,
|
||||
BX_FLOPPY_NONE,
|
||||
BX_FLOPPY_NONE);
|
||||
bx_options.floppya.Oinitial_status = new bx_param_enum_c (BXP_FLOPPYA_STATUS,
|
||||
"floppya:status",
|
||||
"Inserted or ejected",
|
||||
floppy_type_names,
|
||||
BX_EJECTED,
|
||||
BX_EJECTED);
|
||||
bx_options.floppyb.Opath = new bx_param_string_c (BXP_FLOPPYB_PATH,
|
||||
"floppyb:path",
|
||||
"Pathname of second floppy image file or device.",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.floppyb.Otype = new bx_param_enum_c (BXP_FLOPPYB_TYPE,
|
||||
"floppyb:type",
|
||||
"Type of floppy disk",
|
||||
floppy_type_names,
|
||||
BX_FLOPPY_NONE,
|
||||
BX_FLOPPY_NONE);
|
||||
bx_options.floppyb.Oinitial_status = new bx_param_enum_c (BXP_FLOPPYA_STATUS,
|
||||
"floppyb:status",
|
||||
"Inserted or ejected",
|
||||
floppy_type_names,
|
||||
BX_EJECTED,
|
||||
BX_EJECTED);
|
||||
|
||||
// diskc options
|
||||
bx_options.diskc.Opresent = new bx_param_bool_c (BXP_DISKC_PRESENT,
|
||||
"diskc:present",
|
||||
"Controls whether diskc is installed or not",
|
||||
0);
|
||||
bx_options.diskc.Opath = new bx_param_string_c (BXP_DISKC_PATH,
|
||||
"diskc:path",
|
||||
"Pathname of the hard drive image",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.diskc.Ocylinders = new bx_param_num_c (BXP_DISKC_CYLINDERS,
|
||||
"diskc:cylinders",
|
||||
"Number of cylinders",
|
||||
1, 65535,
|
||||
0);
|
||||
bx_options.diskc.Oheads = new bx_param_num_c (BXP_DISKC_HEADS,
|
||||
"diskc:heads",
|
||||
"Number of heads",
|
||||
1, 65535,
|
||||
0);
|
||||
bx_options.diskc.Ospt = new bx_param_num_c (BXP_DISKC_SPT,
|
||||
"diskc:spt",
|
||||
"Number of sectors per track",
|
||||
1, 65535,
|
||||
0);
|
||||
|
||||
// diskd options
|
||||
bx_options.diskd.Opresent = new bx_param_bool_c (BXP_DISKD_PRESENT,
|
||||
"diskd:present",
|
||||
"Controls whether diskd is installed or not",
|
||||
0);
|
||||
bx_options.diskd.Opath = new bx_param_string_c (BXP_DISKD_PATH,
|
||||
"diskd:path",
|
||||
"Pathname of the hard drive image",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.diskd.Ocylinders = new bx_param_num_c (BXP_DISKD_CYLINDERS,
|
||||
"diskd:cylinders",
|
||||
"Number of cylinders",
|
||||
1, 65535,
|
||||
0);
|
||||
bx_options.diskd.Oheads = new bx_param_num_c (BXP_DISKD_HEADS,
|
||||
"diskd:heads",
|
||||
"Number of heads",
|
||||
1, 65535,
|
||||
0);
|
||||
bx_options.diskd.Ospt = new bx_param_num_c (BXP_DISKD_SPT,
|
||||
"diskd:spt",
|
||||
"Number of sectors per track",
|
||||
1, 65535,
|
||||
0);
|
||||
|
||||
// cdrom options
|
||||
bx_options.cdromd.Opresent = new bx_param_bool_c (BXP_CDROM_PRESENT,
|
||||
"cdrom:present",
|
||||
"Controls whether cdromd is installed or not",
|
||||
0);
|
||||
bx_options.cdromd.Opath = new bx_param_string_c (BXP_CDROM_PATH,
|
||||
"cdrom:path",
|
||||
"Pathname of the cdrom device or image",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.cdromd.Oinserted = new bx_param_bool_c (BXP_CDROM_PRESENT,
|
||||
"cdrom:present",
|
||||
"Controls whether cdromd is installed or not",
|
||||
0);
|
||||
|
||||
// memory options menu
|
||||
bx_options.memory.size = new bx_param_num_c (BXP_MEM_SIZE,
|
||||
bx_options.memory.Osize = new bx_param_num_c (BXP_MEM_SIZE,
|
||||
"megs",
|
||||
"Amount of RAM in megabytes",
|
||||
1, 1<<31,
|
||||
1, BX_MAX_INT,
|
||||
BX_DEFAULT_MEM_MEGS);
|
||||
bx_options.memory.size->set_format ("Memory size in megabytes: %d");
|
||||
bx_options.memory.size->set_ask_format ("Enter memory size (MB): [%d] ");
|
||||
bx_options.rom.path = new bx_param_string_c (BXP_ROM_PATH,
|
||||
bx_options.memory.Osize->set_format ("Memory size in megabytes: %d");
|
||||
bx_options.memory.Osize->set_ask_format ("Enter memory size (MB): [%d] ");
|
||||
bx_options.rom.Opath = new bx_param_string_c (BXP_ROM_PATH,
|
||||
"romimage",
|
||||
"Pathname of ROM image to load",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.rom.path->set_format ("Name of ROM BIOS image: %s");
|
||||
bx_options.rom.address = new bx_param_num_c (BXP_ROM_ADDRESS,
|
||||
bx_options.rom.Opath->set_format ("Name of ROM BIOS image: %s");
|
||||
bx_options.rom.Oaddress = new bx_param_num_c (BXP_ROM_ADDRESS,
|
||||
"romaddr",
|
||||
"The address at which the ROM image should be loaded",
|
||||
0, 1<<31,
|
||||
0, BX_MAX_INT,
|
||||
0);
|
||||
bx_options.rom.address->set_format ("ROM BIOS address: 0x%05x");
|
||||
bx_options.rom.address->set_base (16);
|
||||
bx_options.vgarom.path = new bx_param_string_c (BXP_VGA_ROM_PATH,
|
||||
bx_options.rom.Oaddress->set_format ("ROM BIOS address: 0x%05x");
|
||||
bx_options.rom.Oaddress->set_base (16);
|
||||
bx_options.vgarom.Opath = new bx_param_string_c (BXP_VGA_ROM_PATH,
|
||||
"vgaromimage",
|
||||
"Pathname of VGA ROM image to load",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.vgarom.path->set_format ("Name of VGA BIOS image: %s");
|
||||
bx_options.vgarom.Opath->set_format ("Name of VGA BIOS image: %s");
|
||||
bx_param_c *init_list[] = {
|
||||
bx_options.memory.size,
|
||||
bx_options.vgarom.path,
|
||||
bx_options.rom.path,
|
||||
bx_options.rom.address,
|
||||
bx_options.memory.Osize,
|
||||
bx_options.vgarom.Opath,
|
||||
bx_options.rom.Opath,
|
||||
bx_options.rom.Oaddress,
|
||||
NULL
|
||||
};
|
||||
bx_list_c *menu = new bx_list_c (BXP_MEMORY_OPTIONS_MENU, init_list);
|
||||
@ -155,23 +250,83 @@ void bx_init_options ()
|
||||
|
||||
|
||||
|
||||
bx_options.ips = new bx_param_num_c (BXP_IPS,
|
||||
bx_options.Oips = new bx_param_num_c (BXP_IPS,
|
||||
"ips",
|
||||
"Emulated instructions per second, used to calibrate bochs emulated\ntime with wall clock time.",
|
||||
1, 1<<31,
|
||||
1, BX_MAX_INT,
|
||||
500000);
|
||||
bx_options.vga_update_interval = new bx_param_num_c (BXP_VGA_UPDATE_INTERVAL,
|
||||
bx_options.Ovga_update_interval = new bx_param_num_c (BXP_VGA_UPDATE_INTERVAL,
|
||||
"vga_update_interval",
|
||||
"Number of microseconds between VGA updates",
|
||||
1, 1<<31,
|
||||
1, BX_MAX_INT,
|
||||
30000);
|
||||
bx_options.vga_update_interval->set_handler (bx_param_handler);
|
||||
bx_options.mouse_enabled = new bx_param_num_c (BXP_MOUSE_ENABLED,
|
||||
bx_options.Ovga_update_interval->set_handler (bx_param_handler);
|
||||
bx_options.Okeyboard_serial_delay = new bx_param_num_c (BXP_KBD_SERIAL_DELAY,
|
||||
"keyboard_serial_delay",
|
||||
"Approximate time in microseconds that it takes one character to be transfered from the keyboard to controller over the serial path.",
|
||||
1, BX_MAX_INT,
|
||||
20000);
|
||||
bx_options.Ofloppy_command_delay = new bx_param_num_c (BXP_FLOPPY_CMD_DELAY,
|
||||
"floppy_command_delay",
|
||||
"Time in microseconds to wait before completing some floppy commands such as read/write/seek/etc, which normally have a delay associated. This used to be hardwired to 50,000 before.",
|
||||
1, BX_MAX_INT,
|
||||
50000);
|
||||
bx_options.Omouse_enabled = new bx_param_bool_c (BXP_MOUSE_ENABLED,
|
||||
"mouse_enabled",
|
||||
"Controls whether the mouse sends events to bochs",
|
||||
0, 1,
|
||||
0);
|
||||
bx_options.mouse_enabled->set_handler (bx_param_handler);
|
||||
bx_options.Omouse_enabled->set_handler (bx_param_handler);
|
||||
bx_options.Oprivate_colormap = new bx_param_bool_c (BXP_PRIVATE_COLORMAP,
|
||||
"private_colormap",
|
||||
"Request that the GUI create and use it's own non-shared colormap. This colormap will be used when in the bochs window. If not enabled, a shared colormap scheme may be used. Not implemented on all GUI's.",
|
||||
0);
|
||||
bx_options.Oi440FXSupport = new bx_param_bool_c (BXP_I440FX_SUPPORT,
|
||||
"i440FXSupport",
|
||||
"Controls whether to emulate PCI I440FX",
|
||||
0);
|
||||
bx_options.OnewHardDriveSupport = new bx_param_bool_c (BXP_NEWHARDDRIVESUPPORT,
|
||||
"newharddrivesupport",
|
||||
"Enables new features found on newer hard drives.",
|
||||
1);
|
||||
bx_options.log.Ofilename = new bx_param_string_c (BXP_LOG_FILENAME,
|
||||
"log:filename",
|
||||
"Pathname of bochs log file",
|
||||
"-", BX_PATHNAME_LEN);
|
||||
bx_options.cmos.Opath = new bx_param_string_c (BXP_CMOS_PATH,
|
||||
"cmos:path",
|
||||
"Pathname of CMOS image",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.cmos.OcmosImage = new bx_param_bool_c (BXP_CMOS_IMAGE,
|
||||
"cmos:image",
|
||||
"Whether to use a CMOS image or not",
|
||||
0);
|
||||
bx_options.cmos.Otime0 = new bx_param_num_c (BXP_CMOS_TIME0,
|
||||
"cmos:time0",
|
||||
"Start time for Bochs CMOS clock, used if you really want two runs to be identical (cosimulation)",
|
||||
1, BX_MAX_INT,
|
||||
0);
|
||||
bx_options.load32bitOSImage.OwhichOS = new bx_param_num_c (BXP_LOAD32BITOS_WHICH,
|
||||
"load32bitOS:which",
|
||||
"Which OS to boot",
|
||||
0, Load32bitOSLast,
|
||||
0);
|
||||
bx_options.load32bitOSImage.Opath = new bx_param_string_c (BXP_LOAD32BITOS_PATH,
|
||||
"load32bitOS:path",
|
||||
"Pathname of OS to load",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.load32bitOSImage.Oiolog = new bx_param_string_c (BXP_LOAD32BITOS_IOLOG,
|
||||
"load32bitOS:iolog",
|
||||
"I/O Log",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.load32bitOSImage.Oinitrd = new bx_param_string_c (BXP_LOAD32BITOS_INITRD,
|
||||
"load32bitOS:initrd",
|
||||
"Initrd",
|
||||
"", BX_PATHNAME_LEN);
|
||||
bx_options.Obootdrive = new bx_param_num_c (BXP_BOOTDRIVE,
|
||||
"bootdrive",
|
||||
"Boot A or C",
|
||||
BX_BOOT_FLOPPYA, BX_BOOT_DISKC,
|
||||
BX_BOOT_FLOPPYA);
|
||||
}
|
||||
|
||||
void bx_print_header(void);
|
||||
@ -189,7 +344,6 @@ void bx_print_header ()
|
||||
fprintf (stderr, "%s\n", divider);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@ -256,7 +410,7 @@ main(int argc, char *argv[])
|
||||
|
||||
bx_init_hardware();
|
||||
|
||||
if (bx_options.load32bitOSImage.whichOS) {
|
||||
if (bx_options.load32bitOSImage.OwhichOS->get ()) {
|
||||
void bx_load32bitOSimagehack(void);
|
||||
bx_load32bitOSimagehack();
|
||||
}
|
||||
@ -322,11 +476,11 @@ bx_init_hardware()
|
||||
for (int level=0; level<N_LOGLEV; level++)
|
||||
io->set_log_action (level, bx_options.log.actions[level]);
|
||||
|
||||
bx_pc_system.init_ips(bx_options.ips->get ());
|
||||
bx_pc_system.init_ips(bx_options.Oips->get ());
|
||||
|
||||
if(bx_options.log.filename[0]!='-') {
|
||||
BX_INFO (("using log file %s", bx_options.log.filename));
|
||||
io->init_log(bx_options.log.filename);
|
||||
if(bx_options.log.Ofilename->getptr()[0]!='-') {
|
||||
BX_INFO (("using log file %s", bx_options.log.Ofilename->getptr ()));
|
||||
io->init_log(bx_options.log.Ofilename->getptr ());
|
||||
}
|
||||
|
||||
// set up memory and CPU objects
|
||||
@ -335,17 +489,17 @@ bx_init_hardware()
|
||||
#endif
|
||||
|
||||
#if BX_SMP_PROCESSORS==1
|
||||
BX_MEM(0)->init_memory(bx_options.memory.size->get () * 1024*1024);
|
||||
BX_MEM(0)->load_ROM(bx_options.rom.path->getptr (), bx_options.rom.address->get ());
|
||||
BX_MEM(0)->load_ROM(bx_options.vgarom.path->getptr (), 0xc0000);
|
||||
BX_MEM(0)->init_memory(bx_options.memory.Osize->get () * 1024*1024);
|
||||
BX_MEM(0)->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get ());
|
||||
BX_MEM(0)->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000);
|
||||
BX_CPU(0)->init (BX_MEM(0));
|
||||
BX_CPU(0)->reset(BX_RESET_HARDWARE);
|
||||
#else
|
||||
// SMP initialization
|
||||
bx_mem_array[0] = new BX_MEM_C ();
|
||||
bx_mem_array[0]->init_memory(bx_options.memory.size->get () * 1024*1024);
|
||||
bx_mem_array[0]->load_ROM(bx_options.rom.path->getptr (), bx_options.rom.address->get ());
|
||||
bx_mem_array[0]->load_ROM(bx_options.vgarom.path, 0xc0000);
|
||||
bx_mem_array[0]->init_memory(bx_options.memory.Osize->get () * 1024*1024);
|
||||
bx_mem_array[0]->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.address->get ());
|
||||
bx_mem_array[0]->load_ROM(bx_options.vgarom.Opath, 0xc0000);
|
||||
for (int i=0; i<BX_SMP_PROCESSORS; i++) {
|
||||
BX_CPU(i) = new BX_CPU_C ();
|
||||
BX_CPU(i)->init (bx_mem_array[0]);
|
||||
@ -435,7 +589,7 @@ bx_atexit(void)
|
||||
#endif
|
||||
|
||||
#if BX_PCI_SUPPORT
|
||||
if (bx_options.i440FXSupport) {
|
||||
if (bx_options.Oi440FXSupport->get ()) {
|
||||
bx_devices.pci->print_i440fx_state();
|
||||
}
|
||||
#endif
|
||||
@ -565,26 +719,26 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
else if (!strcmp(params[0], "floppya")) {
|
||||
for (i=1; i<num_params; i++) {
|
||||
if (!strncmp(params[i], "2_88=", 5)) {
|
||||
strcpy(bx_options.floppya.path, ¶ms[i][5]);
|
||||
bx_options.floppya.type = BX_FLOPPY_2_88;
|
||||
bx_options.floppya.Opath->set (¶ms[i][5]);
|
||||
bx_options.floppya.Otype->set (BX_FLOPPY_2_88);
|
||||
}
|
||||
else if (!strncmp(params[i], "1_44=", 5)) {
|
||||
strcpy(bx_options.floppya.path, ¶ms[i][5]);
|
||||
bx_options.floppya.type = BX_FLOPPY_1_44;
|
||||
bx_options.floppya.Opath->set (¶ms[i][5]);
|
||||
bx_options.floppya.Otype->set (BX_FLOPPY_1_44);
|
||||
}
|
||||
else if (!strncmp(params[i], "1_2=", 4)) {
|
||||
strcpy(bx_options.floppya.path, ¶ms[i][4]);
|
||||
bx_options.floppya.type = BX_FLOPPY_1_2;
|
||||
bx_options.floppya.Opath->set (¶ms[i][4]);
|
||||
bx_options.floppya.Otype->set (BX_FLOPPY_1_2);
|
||||
}
|
||||
else if (!strncmp(params[i], "720k=", 5)) {
|
||||
strcpy(bx_options.floppya.path, ¶ms[i][5]);
|
||||
bx_options.floppya.type = BX_FLOPPY_720K;
|
||||
bx_options.floppya.Opath->set (¶ms[i][5]);
|
||||
bx_options.floppya.Otype->set (BX_FLOPPY_720K);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=ejected", 14)) {
|
||||
bx_options.floppya.initial_status = BX_EJECTED;
|
||||
bx_options.floppya.Oinitial_status->set (BX_EJECTED);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=inserted", 15)) {
|
||||
bx_options.floppya.initial_status = BX_INSERTED;
|
||||
bx_options.floppya.Oinitial_status->set (BX_INSERTED);
|
||||
}
|
||||
else {
|
||||
BX_PANIC(("%s: floppya attribute '%s' not understood.", context,
|
||||
@ -596,26 +750,26 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
else if (!strcmp(params[0], "floppyb")) {
|
||||
for (i=1; i<num_params; i++) {
|
||||
if (!strncmp(params[i], "2_88=", 5)) {
|
||||
strcpy(bx_options.floppyb.path, ¶ms[i][5]);
|
||||
bx_options.floppyb.type = BX_FLOPPY_2_88;
|
||||
bx_options.floppyb.Opath->set (¶ms[i][5]);
|
||||
bx_options.floppyb.Otype->set (BX_FLOPPY_2_88);
|
||||
}
|
||||
else if (!strncmp(params[i], "1_44=", 5)) {
|
||||
strcpy(bx_options.floppyb.path, ¶ms[i][5]);
|
||||
bx_options.floppyb.type = BX_FLOPPY_1_44;
|
||||
bx_options.floppyb.Opath->set (¶ms[i][5]);
|
||||
bx_options.floppyb.Otype->set (BX_FLOPPY_1_44);
|
||||
}
|
||||
else if (!strncmp(params[i], "1_2=", 4)) {
|
||||
strcpy(bx_options.floppyb.path, ¶ms[i][4]);
|
||||
bx_options.floppyb.type = BX_FLOPPY_1_2;
|
||||
bx_options.floppyb.Opath->set (¶ms[i][4]);
|
||||
bx_options.floppyb.Otype->set (BX_FLOPPY_1_2);
|
||||
}
|
||||
else if (!strncmp(params[i], "720k=", 5)) {
|
||||
strcpy(bx_options.floppyb.path, ¶ms[i][5]);
|
||||
bx_options.floppyb.type = BX_FLOPPY_720K;
|
||||
bx_options.floppyb.Opath->set (¶ms[i][5]);
|
||||
bx_options.floppyb.Otype->set (BX_FLOPPY_720K);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=ejected", 14)) {
|
||||
bx_options.floppyb.initial_status = BX_EJECTED;
|
||||
bx_options.floppyb.Oinitial_status->set (BX_EJECTED);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=inserted", 15)) {
|
||||
bx_options.floppyb.initial_status = BX_INSERTED;
|
||||
bx_options.floppyb.Oinitial_status->set (BX_INSERTED);
|
||||
}
|
||||
else {
|
||||
BX_PANIC(("%s: floppyb attribute '%s' not understood.", context,
|
||||
@ -634,11 +788,11 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
strncmp(params[4], "spt=", 4)) {
|
||||
BX_PANIC(("%s: diskc directive malformed.", context));
|
||||
}
|
||||
strcpy(bx_options.diskc.path, ¶ms[1][5]);
|
||||
bx_options.diskc.cylinders = atol( ¶ms[2][4] );
|
||||
bx_options.diskc.heads = atol( ¶ms[3][6] );
|
||||
bx_options.diskc.spt = atol( ¶ms[4][4] );
|
||||
bx_options.diskc.present = 1;
|
||||
bx_options.diskc.Opath->set (¶ms[1][5]);
|
||||
bx_options.diskc.Ocylinders->set (atol(¶ms[2][4]));
|
||||
bx_options.diskc.Oheads->set (atol(¶ms[3][6]));
|
||||
bx_options.diskc.Ospt->set (atol(¶ms[4][4]));
|
||||
bx_options.diskc.Opresent->set (1);
|
||||
}
|
||||
else if (!strcmp(params[0], "diskd")) {
|
||||
if (num_params != 5) {
|
||||
@ -650,11 +804,11 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
strncmp(params[4], "spt=", 4)) {
|
||||
BX_PANIC(("%s: diskd directive malformed.", context));
|
||||
}
|
||||
strcpy(bx_options.diskd.path, ¶ms[1][5]);
|
||||
bx_options.diskd.cylinders = atol( ¶ms[2][4] );
|
||||
bx_options.diskd.heads = atol( ¶ms[3][6] );
|
||||
bx_options.diskd.spt = atol( ¶ms[4][4] );
|
||||
bx_options.diskd.present = 1;
|
||||
bx_options.diskd.Opath->set (¶ms[1][5]);
|
||||
bx_options.diskd.Ocylinders->set (atol( ¶ms[2][4]));
|
||||
bx_options.diskd.Oheads->set (atol( ¶ms[3][6] ));
|
||||
bx_options.diskd.Ospt->set (atol( ¶ms[4][4] ));
|
||||
bx_options.diskd.Opresent->set (1);
|
||||
}
|
||||
|
||||
else if (!strcmp(params[0], "cdromd")) {
|
||||
@ -664,23 +818,23 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (strncmp(params[1], "dev=", 4) || strncmp(params[2], "status=", 7)) {
|
||||
BX_PANIC(("%s: cdromd directive malformed.", context));
|
||||
}
|
||||
strcpy(bx_options.cdromd.dev, ¶ms[1][4]);
|
||||
bx_options.cdromd.Opath->set (¶ms[1][4]);
|
||||
if (!strcmp(params[2], "status=inserted"))
|
||||
bx_options.cdromd.inserted = 1;
|
||||
bx_options.cdromd.Oinserted->set (1);
|
||||
else if (!strcmp(params[2], "status=ejected"))
|
||||
bx_options.cdromd.inserted = 0;
|
||||
bx_options.cdromd.Oinserted->set (0);
|
||||
else {
|
||||
BX_PANIC(("%s: cdromd directive malformed.", context));
|
||||
}
|
||||
bx_options.cdromd.present = 1;
|
||||
bx_options.cdromd.Opresent->set (1);
|
||||
}
|
||||
|
||||
else if (!strcmp(params[0], "boot")) {
|
||||
if (!strcmp(params[1], "a") ||
|
||||
!strcmp(params[1], "c")) {
|
||||
strcpy(bx_options.bootdrive, params[1]);
|
||||
}
|
||||
else {
|
||||
if (!strcmp(params[1], "a")) {
|
||||
bx_options.Obootdrive->set (BX_BOOT_FLOPPYA);
|
||||
} else if (!strcmp(params[1], "c")) {
|
||||
bx_options.Obootdrive->set (BX_BOOT_DISKC);
|
||||
} else {
|
||||
BX_PANIC(("%s: boot directive with unknown boot device '%s'. use 'a' or 'c'.", context, params[1]));
|
||||
}
|
||||
}
|
||||
@ -688,7 +842,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: log directive has wrong # args.", context));
|
||||
}
|
||||
strcpy(bx_options.log.filename, params[1]);
|
||||
bx_options.log.Ofilename->set (params[1]);
|
||||
}
|
||||
else if (!strcmp(params[0], "panic")) {
|
||||
if (num_params != 2) {
|
||||
@ -780,24 +934,24 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (strncmp(params[2], "address=", 8)) {
|
||||
BX_PANIC(("%s: romimage directive malformed.", context));
|
||||
}
|
||||
bx_options.rom.path->set (¶ms[1][5]);
|
||||
bx_options.rom.Opath->set (¶ms[1][5]);
|
||||
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
|
||||
bx_options.rom.address->set (strtoul (¶ms[2][8], NULL, 16));
|
||||
bx_options.rom.Oaddress->set (strtoul (¶ms[2][8], NULL, 16));
|
||||
else
|
||||
bx_options.rom.address->set (strtoul (¶ms[2][8], NULL, 10));
|
||||
bx_options.rom.Oaddress->set (strtoul (¶ms[2][8], NULL, 10));
|
||||
}
|
||||
else if (!strcmp(params[0], "vgaromimage")) {
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: vgaromimage directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.vgarom.path->set (params[1]);
|
||||
bx_options.vgarom.Opath->set (params[1]);
|
||||
}
|
||||
else if (!strcmp(params[0], "vga_update_interval")) {
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: vga_update_interval directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.vga_update_interval->set (atol(params[1]));
|
||||
if (bx_options.vga_update_interval->get () < 50000) {
|
||||
bx_options.Ovga_update_interval->set (atol(params[1]));
|
||||
if (bx_options.Ovga_update_interval->get () < 50000) {
|
||||
BX_INFO(("%s: vga_update_interval seems awfully small!", context));
|
||||
}
|
||||
}
|
||||
@ -805,23 +959,23 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: keyboard_serial_delay directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.keyboard_serial_delay = atol(params[1]);
|
||||
if (bx_options.keyboard_serial_delay < 5) {
|
||||
BX_PANIC(("%s: keyboard_serial_delay not big enough!", context));
|
||||
bx_options.Okeyboard_serial_delay->set (atol(params[1]));
|
||||
if (bx_options.Okeyboard_serial_delay->get () < 5) {
|
||||
BX_ERROR (("%s: keyboard_serial_delay not big enough!", context));
|
||||
}
|
||||
}
|
||||
else if (!strcmp(params[0], "megs")) {
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: megs directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.memory.size->set (atol(params[1]));
|
||||
bx_options.memory.Osize->set (atol(params[1]));
|
||||
}
|
||||
else if (!strcmp(params[0], "floppy_command_delay")) {
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: floppy_command_delay directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.floppy_command_delay = atol(params[1]);
|
||||
if (bx_options.floppy_command_delay < 100) {
|
||||
bx_options.Ofloppy_command_delay->set (atol(params[1]));
|
||||
if (bx_options.Ofloppy_command_delay->get () < 100) {
|
||||
BX_PANIC(("%s: floppy_command_delay not big enough!", context));
|
||||
}
|
||||
}
|
||||
@ -829,9 +983,9 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: ips directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.ips->set (atol(params[1]));
|
||||
if (bx_options.ips->get () < 200000) {
|
||||
BX_INFO(("%s: WARNING: ips is AWFULLY low!", context));
|
||||
bx_options.Oips->set (atol(params[1]));
|
||||
if (bx_options.Oips->get () < 200000) {
|
||||
BX_ERROR(("%s: WARNING: ips is AWFULLY low!", context));
|
||||
}
|
||||
}
|
||||
|
||||
@ -843,7 +997,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
BX_PANIC(("%s: mouse directive malformed.", context));
|
||||
}
|
||||
if (params[1][8] == '0' || params[1][8] == '1')
|
||||
bx_options.mouse_enabled->set (params[1][8] - '0');
|
||||
bx_options.Omouse_enabled->set (params[1][8] - '0');
|
||||
else
|
||||
BX_PANIC(("%s: mouse directive malformed.", context));
|
||||
}
|
||||
@ -854,10 +1008,8 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (strncmp(params[1], "enabled=", 8)) {
|
||||
BX_PANIC(("%s: private_colormap directive malformed.", context));
|
||||
}
|
||||
if (params[1][8] == '0')
|
||||
bx_options.private_colormap = 0;
|
||||
else if (params[1][8] == '1')
|
||||
bx_options.private_colormap = 1;
|
||||
if (params[1][8] == '0' || params[1][8] == '1')
|
||||
bx_options.Oprivate_colormap->set (params[1][8] - '0');
|
||||
else {
|
||||
BX_PANIC(("%s: private_colormap directive malformed.", context));
|
||||
}
|
||||
@ -898,9 +1050,9 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
BX_PANIC(("%s: i440FXSupport directive malformed.", context));
|
||||
}
|
||||
if (params[1][8] == '0')
|
||||
bx_options.i440FXSupport = 0;
|
||||
bx_options.Oi440FXSupport->set (0);
|
||||
else if (params[1][8] == '1')
|
||||
bx_options.i440FXSupport = 1;
|
||||
bx_options.Oi440FXSupport->set (1);
|
||||
else {
|
||||
BX_PANIC(("%s: i440FXSupport directive malformed.", context));
|
||||
}
|
||||
@ -913,9 +1065,9 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
BX_PANIC(("%s: newharddrivesupport directive malformed.", context));
|
||||
}
|
||||
if (params[1][8] == '0')
|
||||
bx_options.newHardDriveSupport = 0;
|
||||
bx_options.OnewHardDriveSupport->set (0);
|
||||
else if (params[1][8] == '1')
|
||||
bx_options.newHardDriveSupport = 1;
|
||||
bx_options.OnewHardDriveSupport->set (1);
|
||||
else {
|
||||
BX_PANIC(("%s: newharddrivesupport directive malformed.", context));
|
||||
}
|
||||
@ -924,14 +1076,14 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: cmosimage directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.cmos.path = strdup(params[1]);
|
||||
bx_options.cmos.cmosImage = 1; // CMOS Image is true
|
||||
bx_options.cmos.Opath->set (strdup(params[1]));
|
||||
bx_options.cmos.OcmosImage->set (1); // CMOS Image is true
|
||||
}
|
||||
else if (!strcmp(params[0], "time0")) {
|
||||
if (num_params != 2) {
|
||||
BX_PANIC(("%s: time0 directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.cmos.time0 = atoi(params[1]);
|
||||
bx_options.cmos.Otime0->set (atoi(params[1]));
|
||||
}
|
||||
#ifdef MAGIC_BREAKPOINT
|
||||
else if (!strcmp(params[0], "magic_break")) {
|
||||
@ -1009,10 +1161,10 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
BX_PANIC(("%s: load32bitOSImage: directive malformed.", context));
|
||||
}
|
||||
if (!strcmp(¶ms[1][3], "nullkernel")) {
|
||||
bx_options.load32bitOSImage.whichOS = Load32bitOSNullKernel;
|
||||
bx_options.load32bitOSImage.OwhichOS->set (Load32bitOSNullKernel);
|
||||
}
|
||||
else if (!strcmp(¶ms[1][3], "linux")) {
|
||||
bx_options.load32bitOSImage.whichOS = Load32bitOSLinux;
|
||||
bx_options.load32bitOSImage.OwhichOS->set (Load32bitOSLinux);
|
||||
}
|
||||
else {
|
||||
BX_PANIC(("%s: load32bitOSImage: unsupported OS.", context));
|
||||
@ -1023,13 +1175,13 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (strncmp(params[3], "iolog=", 6)) {
|
||||
BX_PANIC(("%s: load32bitOSImage: directive malformed.", context));
|
||||
}
|
||||
bx_options.load32bitOSImage.path = strdup(¶ms[2][5]);
|
||||
bx_options.load32bitOSImage.iolog = strdup(¶ms[3][6]);
|
||||
bx_options.load32bitOSImage.Opath->set (strdup(¶ms[2][5]));
|
||||
bx_options.load32bitOSImage.Oiolog->set (strdup(¶ms[3][6]));
|
||||
if (num_params == 5) {
|
||||
if (strncmp(params[4], "initrd=", 7)) {
|
||||
BX_PANIC(("%s: load32bitOSImage: directive malformed.", context));
|
||||
}
|
||||
bx_options.load32bitOSImage.initrd = strdup(¶ms[4][7]);
|
||||
bx_options.load32bitOSImage.Oinitrd->set (strdup(¶ms[4][7]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1037,7 +1189,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
BX_PANIC(( "%s: directive '%s' not understood", context, params[0]));
|
||||
}
|
||||
|
||||
if (bx_options.diskd.present && bx_options.cdromd.present)
|
||||
if (bx_options.diskd.Opresent->get () && bx_options.cdromd.Opresent->get ())
|
||||
BX_PANIC(("At present, using both diskd and cdromd at once is not supported."));
|
||||
}
|
||||
|
||||
@ -1049,32 +1201,32 @@ int
|
||||
bx_write_floppy_options (FILE *fp, int drive, bx_floppy_options *opt)
|
||||
{
|
||||
BX_ASSERT (drive==0 || drive==1);
|
||||
if (opt->type == BX_FLOPPY_NONE) {
|
||||
if (opt->Otype->get () == BX_FLOPPY_NONE) {
|
||||
fprintf (fp, "# no floppy%c\n", (char)'a'+drive);
|
||||
return 0;
|
||||
}
|
||||
BX_ASSERT (opt->type > BX_FLOPPY_NONE && opt->type <= BX_FLOPPY_LAST);
|
||||
fprintf (fp, "floppy%c: %s=%s, status=%s\n",
|
||||
BX_ASSERT (opt->Otype->get () > BX_FLOPPY_NONE && opt->Otype->get () <= BX_FLOPPY_LAST);
|
||||
fprintf (fp, "floppy%c: %s=\"%s\", status=%s\n",
|
||||
(char)'a'+drive,
|
||||
fdtypes[opt->type - BX_FLOPPY_NONE],
|
||||
opt->path,
|
||||
opt->initial_status==BX_EJECTED ? "ejected" : "inserted");
|
||||
fdtypes[opt->Otype->get () - BX_FLOPPY_NONE],
|
||||
opt->Opath->getptr (),
|
||||
opt->Oinitial_status->get ()==BX_EJECTED ? "ejected" : "inserted");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_write_disk_options (FILE *fp, int drive, bx_disk_options *opt)
|
||||
{
|
||||
if (!opt->present) {
|
||||
if (!opt->Opresent->get ()) {
|
||||
fprintf (fp, "# no disk%c\n", (char)'c'+drive);
|
||||
return 0;
|
||||
}
|
||||
fprintf (fp, "disk%c: file=\"%s\", cyl=%d, heads=%d, spt=%d\n",
|
||||
(char)'c'+drive,
|
||||
opt->path,
|
||||
opt->cylinders,
|
||||
opt->heads,
|
||||
opt->spt);
|
||||
opt->Opath->getptr (),
|
||||
opt->Ocylinders->get (),
|
||||
opt->Oheads->get (),
|
||||
opt->Ospt->get ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1082,13 +1234,13 @@ int
|
||||
bx_write_cdrom_options (FILE *fp, int drive, bx_cdrom_options *opt)
|
||||
{
|
||||
BX_ASSERT (drive == 0);
|
||||
if (!opt->present) {
|
||||
if (!opt->Opresent->get ()) {
|
||||
fprintf (fp, "# no cdromd\n");
|
||||
return 0;
|
||||
}
|
||||
fprintf (fp, "cdromd: dev=%s, status=%s\n",
|
||||
opt->dev,
|
||||
opt->inserted ? "inserted" : "ejected");
|
||||
opt->Opath->getptr (),
|
||||
opt->Oinserted ? "inserted" : "ejected");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1127,23 +1279,23 @@ bx_write_ne2k_options (FILE *fp, bx_ne2k_options *opt)
|
||||
int
|
||||
bx_write_loader_options (FILE *fp, bx_load32bitOSImage_t *opt)
|
||||
{
|
||||
if (opt->whichOS == 0) {
|
||||
if (opt->OwhichOS->get () == 0) {
|
||||
fprintf (fp, "# no loader\n");
|
||||
return 0;
|
||||
}
|
||||
BX_ASSERT(opt->whichOS == Load32bitOSLinux || opt->whichOS == Load32bitOSNullKernel);
|
||||
BX_ASSERT(opt->OwhichOS->get () == Load32bitOSLinux || opt->OwhichOS->get () == Load32bitOSNullKernel);
|
||||
fprintf (fp, "load32bitOSImage: os=%s, path=%s, iolog=%s, initrd=%s\n",
|
||||
(opt->whichOS == Load32bitOSLinux) ? "linux" : "nullkernel",
|
||||
opt->path,
|
||||
opt->iolog,
|
||||
opt->initrd);
|
||||
(opt->OwhichOS->get () == Load32bitOSLinux) ? "linux" : "nullkernel",
|
||||
opt->Opath->getptr (),
|
||||
opt->Oiolog->getptr (),
|
||||
opt->Oinitrd->getptr ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bx_write_log_options (FILE *fp, bx_log_options *opt)
|
||||
{
|
||||
fprintf (fp, "log: %s\n", opt->filename);
|
||||
fprintf (fp, "log: %s\n", opt->Ofilename->getptr ());
|
||||
// no syntax to describe all the possible action settings for every
|
||||
// device. Instead, take a vote and record the most popular action
|
||||
// for each level of event.
|
||||
@ -1207,27 +1359,28 @@ bx_write_configuration (char *rc, int overwrite)
|
||||
bx_write_disk_options (fp, 0, &bx_options.diskc);
|
||||
bx_write_disk_options (fp, 1, &bx_options.diskd);
|
||||
bx_write_cdrom_options (fp, 0, &bx_options.cdromd);
|
||||
if (strlen (bx_options.rom.path->getptr ()) < 1)
|
||||
fprintf (fp, "romimage: file=%s, address=0x%05x\n", bx_options.rom.path->getptr(), (unsigned int)bx_options.rom.address);
|
||||
if (strlen (bx_options.rom.Opath->getptr ()) > 0)
|
||||
fprintf (fp, "romimage: file=%s, address=0x%05x\n", bx_options.rom.Opath->getptr(), (unsigned int)bx_options.rom.Oaddress->get ());
|
||||
else
|
||||
fprintf (fp, "# no romimage\n");
|
||||
if (strlen (bx_options.vgarom.path->getptr ()) < 1)
|
||||
fprintf (fp, "vgaromimage: %s\n", bx_options.vgarom.path->getptr ());
|
||||
if (strlen (bx_options.vgarom.Opath->getptr ()) > 0)
|
||||
fprintf (fp, "vgaromimage: %s\n", bx_options.vgarom.Opath->getptr ());
|
||||
else
|
||||
fprintf (fp, "# no vgaromimage\n");
|
||||
fprintf (fp, "megs: %d\n", bx_options.memory.size->get ());
|
||||
fprintf (fp, "megs: %d\n", bx_options.memory.Osize->get ());
|
||||
bx_write_sb16_options (fp, &bx_options.sb16);
|
||||
fprintf (fp, "boot: %s\n", bx_options.bootdrive);
|
||||
fprintf (fp, "vga_update_interval: %lu\n", bx_options.vga_update_interval->get ());
|
||||
fprintf (fp, "keyboard_serial_delay: %lu\n", bx_options.keyboard_serial_delay);
|
||||
fprintf (fp, "floppy_command_delay: %lu\n", bx_options.floppy_command_delay);
|
||||
fprintf (fp, "ips: %lu\n", bx_options.ips->get ());
|
||||
fprintf (fp, "mouse: enabled=%d\n", bx_options.mouse_enabled->get ());
|
||||
fprintf (fp, "private_colormap: enabled=%d\n", bx_options.private_colormap);
|
||||
fprintf (fp, "i440fxsupport: enabled=%d\n", bx_options.i440FXSupport);
|
||||
fprintf (fp, "time0: %u\n", bx_options.cmos.time0);
|
||||
int bootdrive = bx_options.Obootdrive->get ();
|
||||
fprintf (fp, "boot: %c\n", (bootdrive==BX_BOOT_FLOPPYA) ? 'a' : 'c');
|
||||
fprintf (fp, "vga_update_interval: %lu\n", bx_options.Ovga_update_interval->get ());
|
||||
fprintf (fp, "keyboard_serial_delay: %lu\n", bx_options.Okeyboard_serial_delay->get ());
|
||||
fprintf (fp, "floppy_command_delay: %lu\n", bx_options.Ofloppy_command_delay->get ());
|
||||
fprintf (fp, "ips: %lu\n", bx_options.Oips->get ());
|
||||
fprintf (fp, "mouse: enabled=%d\n", bx_options.Omouse_enabled->get ());
|
||||
fprintf (fp, "private_colormap: enabled=%d\n", bx_options.Oprivate_colormap->get ());
|
||||
fprintf (fp, "i440fxsupport: enabled=%d\n", bx_options.Oi440FXSupport->get ());
|
||||
fprintf (fp, "time0: %u\n", bx_options.cmos.Otime0->get ());
|
||||
bx_write_ne2k_options (fp, &bx_options.ne2k);
|
||||
fprintf (fp, "newharddrivesupport: enabled=%d\n", bx_options.newHardDriveSupport);
|
||||
fprintf (fp, "newharddrivesupport: enabled=%d\n", bx_options.OnewHardDriveSupport->get ());
|
||||
bx_write_loader_options (fp, &bx_options.load32bitOSImage);
|
||||
bx_write_log_options (fp, &bx_options.log);
|
||||
fclose (fp);
|
||||
|
Loading…
Reference in New Issue
Block a user