- separation of floppy device type and media type started. This feature needs
more work in the floppy and bios code. - floppy and cdrom entries in the runtime config menu can be disabled if the drive wasn't defined in bochsrc or start menu - floppy variable "initial_status" and cdrom variable "inserted" renamed to "status" - unused variable *ips in function build_runtime_options_prompt() disabled
This commit is contained in:
parent
16dfd66163
commit
c3cda0a919
@ -1,10 +1,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: control.cc,v 1.51 2002-06-26 14:42:34 cbothamy Exp $
|
||||
// $Id: control.cc,v 1.52 2002-08-04 08:42:34 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/*
|
||||
* gui/control.cc
|
||||
* $Id: control.cc,v 1.51 2002-06-26 14:42:34 cbothamy Exp $
|
||||
* $Id: control.cc,v 1.52 2002-08-04 08:42:34 vruppert 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
|
||||
@ -397,19 +397,26 @@ void build_runtime_options_prompt (char *format, char *buf, int size)
|
||||
{
|
||||
bx_floppy_options floppyop;
|
||||
bx_cdrom_options cdromop;
|
||||
bx_param_num_c *ips = SIM->get_param_num (BXP_IPS);
|
||||
/* bx_param_num_c *ips = SIM->get_param_num (BXP_IPS); */
|
||||
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.Opath->getptr (),
|
||||
SIM->get_floppy_type_name (floppyop.Otype->get ()),
|
||||
(floppyop.Oinitial_status->get () == BX_INSERTED)? "inserted" : "ejected");
|
||||
if (!floppyop.Opath->getptr ()[0]) strcpy (buffer[i], "none");
|
||||
if (floppyop.Odevtype->get () == BX_FLOPPY_NONE)
|
||||
strcpy (buffer[i], "(not present)");
|
||||
else {
|
||||
sprintf (buffer[i], "%s, size=%s, %s", floppyop.Opath->getptr (),
|
||||
SIM->get_floppy_type_name (floppyop.Otype->get ()),
|
||||
(floppyop.Ostatus->get () == BX_INSERTED)? "inserted" : "ejected");
|
||||
if (!floppyop.Opath->getptr ()[0]) strcpy (buffer[i], "none");
|
||||
}
|
||||
}
|
||||
SIM->get_cdrom_options (0, &cdromop);
|
||||
sprintf (buffer[2], "%s, %spresent, %s",
|
||||
cdromop.Opath->getptr (), cdromop.Opresent->get ()?"":"not ",
|
||||
(cdromop.Oinserted->get () == BX_INSERTED)? "inserted" : "ejected");
|
||||
if (!cdromop.Opresent->get ())
|
||||
sprintf (buffer[2], "(not present)");
|
||||
else
|
||||
sprintf (buffer[2], "%s, %s",
|
||||
cdromop.Opath->getptr (),
|
||||
(cdromop.Ostatus->get () == BX_INSERTED)? "inserted" : "ejected");
|
||||
snprintf (buf, size, format, buffer[0], buffer[1], buffer[2],
|
||||
/* ips->get (), */
|
||||
SIM->get_param_num (BXP_VGA_UPDATE_INTERVAL)->get (),
|
||||
@ -501,12 +508,23 @@ int bx_control_panel (int menu)
|
||||
break;
|
||||
case BX_CPANEL_RUNTIME:
|
||||
char prompt[1024];
|
||||
bx_floppy_options floppyop;
|
||||
bx_cdrom_options cdromop;
|
||||
build_runtime_options_prompt (runtime_menu_prompt, prompt, 1024);
|
||||
if (ask_uint (prompt, 1, 12, 11, &choice, 10) < 0) return -1;
|
||||
switch (choice) {
|
||||
case 1: do_menu (BXP_FLOPPYA); break;
|
||||
case 2: do_menu (BXP_FLOPPYB); break;
|
||||
case 3: do_menu (BXP_CDROMD); break;
|
||||
case 1:
|
||||
SIM->get_floppy_options (0, &floppyop);
|
||||
if (floppyop.Odevtype->get () != BX_FLOPPY_NONE) do_menu (BXP_FLOPPYA);
|
||||
break;
|
||||
case 2:
|
||||
SIM->get_floppy_options (1, &floppyop);
|
||||
if (floppyop.Odevtype->get () != BX_FLOPPY_NONE) do_menu (BXP_FLOPPYB);
|
||||
break;
|
||||
case 3:
|
||||
SIM->get_cdrom_options (0, &cdromop);
|
||||
if (cdromop.Opresent->get ()) do_menu (BXP_CDROMD);
|
||||
break;
|
||||
case 4: // not implemented yet because I would have to mess with
|
||||
// resetting timers and pits and everything on the fly.
|
||||
// askparam (BXP_IPS);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.cc,v 1.41 2002-04-18 00:22:19 bdenney Exp $
|
||||
// $Id: gui.cc,v 1.42 2002-08-04 08:42:34 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -153,10 +153,10 @@ void
|
||||
bx_gui_c::update_drive_status_buttons (void) {
|
||||
BX_GUI_THIS floppyA_status =
|
||||
bx_devices.floppy->get_media_status (0)
|
||||
&& bx_options.floppya.Oinitial_status->get ();
|
||||
&& bx_options.floppya.Ostatus->get ();
|
||||
BX_GUI_THIS floppyB_status =
|
||||
bx_devices.floppy->get_media_status (1)
|
||||
&& bx_options.floppyb.Oinitial_status->get ();
|
||||
&& bx_options.floppyb.Ostatus->get ();
|
||||
BX_GUI_THIS cdromD_status =
|
||||
bx_devices.hard_drive->get_cd_media_status()
|
||||
&& bx_options.cdromd.Opresent->get ();
|
||||
|
@ -1,10 +1,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.41 2002-08-01 07:34:59 vruppert Exp $
|
||||
// $Id: siminterface.h,v 1.42 2002-08-04 08:42:34 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/*
|
||||
* gui/siminterface.h
|
||||
* $Id: siminterface.h,v 1.41 2002-08-01 07:34:59 vruppert Exp $
|
||||
* $Id: siminterface.h,v 1.42 2002-08-04 08:42:34 vruppert Exp $
|
||||
*
|
||||
* Interface to the simulator, currently only used by control.cc.
|
||||
* The base class bx_simulator_interface_c, contains only virtual functions
|
||||
@ -73,10 +73,12 @@ typedef enum {
|
||||
BXP_KBD_PASTE_DELAY,
|
||||
BXP_KBD_TYPE,
|
||||
BXP_FLOPPY_CMD_DELAY,
|
||||
BXP_FLOPPYA_DEVTYPE,
|
||||
BXP_FLOPPYA_PATH,
|
||||
BXP_FLOPPYA_TYPE,
|
||||
BXP_FLOPPYA_STATUS,
|
||||
BXP_FLOPPYA,
|
||||
BXP_FLOPPYB_DEVTYPE,
|
||||
BXP_FLOPPYB_PATH,
|
||||
BXP_FLOPPYB_TYPE,
|
||||
BXP_FLOPPYB_STATUS,
|
||||
@ -103,7 +105,7 @@ typedef enum {
|
||||
BXP_COM4_PATH,
|
||||
BXP_CDROM_PRESENT,
|
||||
BXP_CDROM_PATH,
|
||||
BXP_CDROM_INSERTED,
|
||||
BXP_CDROM_STATUS,
|
||||
BXP_CDROMD,
|
||||
BXP_PRIVATE_COLORMAP,
|
||||
BXP_FULLSCREEN,
|
||||
@ -546,9 +548,10 @@ extern char *keyboard_type_names[];
|
||||
extern int n_keyboard_type_names;
|
||||
|
||||
typedef struct {
|
||||
bx_param_enum_c *Odevtype;
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_enum_c *Otype;
|
||||
bx_param_enum_c *Oinitial_status;
|
||||
bx_param_enum_c *Ostatus;
|
||||
} bx_floppy_options;
|
||||
|
||||
typedef struct {
|
||||
@ -568,7 +571,7 @@ struct bx_cdrom_options
|
||||
{
|
||||
bx_param_bool_c *Opresent;
|
||||
bx_param_string_c *Opath;
|
||||
bx_param_enum_c *Oinserted;
|
||||
bx_param_enum_c *Ostatus;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: floppy.cc,v 1.46 2002-08-03 06:58:56 vruppert Exp $
|
||||
// $Id: floppy.cc,v 1.47 2002-08-04 08:42:34 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -89,7 +89,7 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
{
|
||||
Bit8u i;
|
||||
|
||||
BX_DEBUG(("Init $Id: floppy.cc,v 1.46 2002-08-03 06:58:56 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: floppy.cc,v 1.47 2002-08-04 08:42:34 vruppert Exp $"));
|
||||
BX_FD_THIS devices = d;
|
||||
|
||||
BX_REGISTER_DMA8_CHANNEL(2, bx_floppy.dma_read, bx_floppy.dma_write, "Floppy Drive");
|
||||
@ -107,6 +107,7 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_FD_THIS s.num_supported_floppies = 0;
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
BX_FD_THIS s.device_type[i] = BX_FLOPPY_NONE;
|
||||
BX_FD_THIS s.media[i].type = BX_FLOPPY_NONE;
|
||||
}
|
||||
|
||||
@ -119,8 +120,9 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_FD_THIS s.media[0].sectors = 0;
|
||||
BX_FD_THIS s.media[0].fd = -1;
|
||||
BX_FD_THIS s.media_present[0] = 0;
|
||||
BX_FD_THIS s.device_type[0] = bx_options.floppya.Odevtype->get ();
|
||||
|
||||
switch (bx_options.floppya.Otype->get ()) {
|
||||
switch (BX_FD_THIS s.device_type[0]) {
|
||||
case BX_FLOPPY_NONE:
|
||||
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x00;
|
||||
break;
|
||||
@ -142,15 +144,16 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
default:
|
||||
BX_PANIC(("unknown floppya type"));
|
||||
}
|
||||
if (BX_FD_THIS s.device_type[0] != BX_FLOPPY_NONE)
|
||||
BX_FD_THIS s.num_supported_floppies++;
|
||||
|
||||
if (bx_options.floppya.Otype->get () != BX_FLOPPY_NONE) {
|
||||
BX_FD_THIS s.num_supported_floppies++;
|
||||
if ( bx_options.floppya.Oinitial_status->get () == BX_INSERTED) {
|
||||
if ( bx_options.floppya.Ostatus->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;
|
||||
else
|
||||
bx_options.floppya.Oinitial_status->set(BX_EJECTED);
|
||||
bx_options.floppya.Ostatus->set(BX_EJECTED);
|
||||
#define MED (BX_FD_THIS s.media[0])
|
||||
BX_INFO(("fd0: '%s' ro=%d, h=%d,t=%d,spt=%d", bx_options.floppya.Opath->getptr(),
|
||||
MED.write_protected, MED.heads, MED.tracks, MED.sectors_per_track));
|
||||
@ -168,8 +171,9 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
BX_FD_THIS s.media[1].sectors = 0;
|
||||
BX_FD_THIS s.media[1].fd = -1;
|
||||
BX_FD_THIS s.media_present[1] = 0;
|
||||
BX_FD_THIS s.device_type[1] = bx_options.floppyb.Odevtype->get ();
|
||||
|
||||
switch (bx_options.floppyb.Otype->get ()) {
|
||||
switch (BX_FD_THIS s.device_type[1]) {
|
||||
case BX_FLOPPY_NONE:
|
||||
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0xf0) | 0x00;
|
||||
break;
|
||||
@ -191,15 +195,16 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
default:
|
||||
BX_PANIC(("unknown floppyb type"));
|
||||
}
|
||||
if (BX_FD_THIS s.device_type[1] != BX_FLOPPY_NONE)
|
||||
BX_FD_THIS s.num_supported_floppies++;
|
||||
|
||||
if (bx_options.floppyb.Otype->get () != BX_FLOPPY_NONE) {
|
||||
BX_FD_THIS s.num_supported_floppies++;
|
||||
if ( bx_options.floppyb.Oinitial_status->get () == BX_INSERTED) {
|
||||
if ( bx_options.floppyb.Ostatus->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;
|
||||
else
|
||||
bx_options.floppyb.Oinitial_status->set(BX_EJECTED);
|
||||
bx_options.floppyb.Ostatus->set(BX_EJECTED);
|
||||
#define MED (BX_FD_THIS s.media[1])
|
||||
BX_INFO(("fd1: '%s' ro=%d, h=%d,t=%d,spt=%d", bx_options.floppyb.Opath->getptr(),
|
||||
MED.write_protected, MED.heads, MED.tracks, MED.sectors_per_track));
|
||||
@ -443,7 +448,7 @@ bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
(unsigned) normal_operation));
|
||||
BX_DEBUG((" drive_select=%02x",
|
||||
(unsigned) drive_select));
|
||||
if (BX_FD_THIS s.media[drive_select].type == BX_FLOPPY_NONE) {
|
||||
if (BX_FD_THIS s.device_type[drive_select] == BX_FLOPPY_NONE) {
|
||||
BX_DEBUG(("WARNING: not existing drive selected"));
|
||||
}
|
||||
break;
|
||||
@ -725,7 +730,7 @@ bx_floppy_ctrl_c::floppy_command(void)
|
||||
BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
|
||||
return;
|
||||
}
|
||||
if (BX_FD_THIS s.media[drive].type == BX_FLOPPY_NONE)
|
||||
if (BX_FD_THIS s.device_type[drive] == BX_FLOPPY_NONE)
|
||||
BX_PANIC(("floppy_command(): read ID: bad drive #%d", drive));
|
||||
BX_FD_THIS s.result_size = 7;
|
||||
BX_FD_THIS s.result_index = 0;
|
||||
@ -756,7 +761,7 @@ bx_floppy_ctrl_c::floppy_command(void)
|
||||
sector_size = BX_FD_THIS s.command[2];
|
||||
BX_FD_THIS s.format_count = BX_FD_THIS s.command[3];
|
||||
BX_FD_THIS s.format_fillbyte = BX_FD_THIS s.command[5];
|
||||
if (BX_FD_THIS s.media[drive].type == BX_FLOPPY_NONE)
|
||||
if (BX_FD_THIS s.device_type[drive] == BX_FLOPPY_NONE)
|
||||
BX_PANIC(("floppy_command(): format track: bad drive #%d", drive));
|
||||
|
||||
if (sector_size != 0x02) { // 512 bytes
|
||||
@ -837,7 +842,7 @@ bx_floppy_ctrl_c::floppy_command(void)
|
||||
BX_DEBUG((" cylinder = %u", (unsigned) cylinder));
|
||||
BX_DEBUG((" sector = %u", (unsigned) sector));
|
||||
BX_DEBUG((" eot = %u", (unsigned) eot));
|
||||
if (BX_FD_THIS s.media[drive].type == BX_FLOPPY_NONE)
|
||||
if (BX_FD_THIS s.device_type[drive] == BX_FLOPPY_NONE)
|
||||
BX_PANIC(("floppy_command(): read/write: bad drive #%d", drive));
|
||||
|
||||
// check that head number in command[1] bit two matches the head
|
||||
@ -994,7 +999,7 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer,
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (BX_FD_THIS s.media[drive].type == BX_FLOPPY_NONE)
|
||||
if (BX_FD_THIS s.device_type[drive] == BX_FLOPPY_NONE)
|
||||
BX_PANIC(("floppy_xfer: bad drive #%d", drive));
|
||||
|
||||
if (bx_dbg.floppy) {
|
||||
@ -1073,7 +1078,7 @@ bx_floppy_ctrl_c::timer()
|
||||
BX_FD_THIS s.cylinder[drive] = 0;
|
||||
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | (1 << drive);
|
||||
BX_FD_THIS s.status_reg0 = 0x20 | (BX_FD_THIS s.head[drive]<<2) | drive;
|
||||
if (BX_FD_THIS s.media[drive].type == BX_FLOPPY_NONE) {
|
||||
if (BX_FD_THIS s.device_type[drive] == BX_FLOPPY_NONE) {
|
||||
BX_FD_THIS s.status_reg0 |= 0x50;
|
||||
}
|
||||
else if (BX_FD_THIS s.media_present[drive] == 0) {
|
||||
@ -1090,7 +1095,7 @@ bx_floppy_ctrl_c::timer()
|
||||
/* write ready, not busy */
|
||||
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | (1 << drive);
|
||||
BX_FD_THIS s.status_reg0 = 0x20 | (BX_FD_THIS s.head[drive]<<2) | drive;
|
||||
if (BX_FD_THIS s.media[drive].type == BX_FLOPPY_NONE) {
|
||||
if (BX_FD_THIS s.device_type[drive] == BX_FLOPPY_NONE) {
|
||||
BX_FD_THIS s.status_reg0 |= 0x50;
|
||||
}
|
||||
else if (BX_FD_THIS s.media_present[drive] == 0) {
|
||||
@ -1364,8 +1369,14 @@ bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
|
||||
char *path;
|
||||
unsigned type;
|
||||
|
||||
if (drive == 0)
|
||||
type = bx_options.floppya.Otype->get ();
|
||||
else
|
||||
type = bx_options.floppyb.Otype->get ();
|
||||
|
||||
// if setting to the current value, nothing to do
|
||||
if (status == BX_FD_THIS s.media_present[drive])
|
||||
if ((status == BX_FD_THIS s.media_present[drive]) &&
|
||||
((status == 0) || (type == BX_FD_THIS s.media[drive].type)))
|
||||
return(status);
|
||||
|
||||
if (status == 0) {
|
||||
@ -1376,9 +1387,9 @@ bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
|
||||
}
|
||||
BX_FD_THIS s.media_present[drive] = 0;
|
||||
if (drive == 0) {
|
||||
bx_options.floppya.Oinitial_status->set(BX_EJECTED);
|
||||
bx_options.floppya.Ostatus->set(BX_EJECTED);
|
||||
} else {
|
||||
bx_options.floppyb.Oinitial_status->set(BX_EJECTED);
|
||||
bx_options.floppyb.Ostatus->set(BX_EJECTED);
|
||||
}
|
||||
BX_FD_THIS s.DIR |= 0x80; // disk changed line
|
||||
return(0);
|
||||
@ -1387,18 +1398,16 @@ bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
|
||||
// insert floppy
|
||||
if (drive == 0) {
|
||||
path = bx_options.floppya.Opath->getptr ();
|
||||
type = bx_options.floppya.Otype->get ();
|
||||
}
|
||||
else {
|
||||
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;
|
||||
if (drive == 0) {
|
||||
bx_options.floppya.Oinitial_status->set(BX_INSERTED);
|
||||
bx_options.floppya.Ostatus->set(BX_INSERTED);
|
||||
} else {
|
||||
bx_options.floppyb.Oinitial_status->set(BX_INSERTED);
|
||||
bx_options.floppyb.Ostatus->set(BX_INSERTED);
|
||||
}
|
||||
BX_FD_THIS s.DIR |= 0x80; // disk changed line
|
||||
return(1);
|
||||
@ -1406,9 +1415,9 @@ bx_floppy_ctrl_c::set_media_status(unsigned drive, unsigned status)
|
||||
else {
|
||||
BX_FD_THIS s.media_present[drive] = 0;
|
||||
if (drive == 0) {
|
||||
bx_options.floppya.Oinitial_status->set(BX_EJECTED);
|
||||
bx_options.floppya.Ostatus->set(BX_EJECTED);
|
||||
} else {
|
||||
bx_options.floppyb.Oinitial_status->set(BX_EJECTED);
|
||||
bx_options.floppyb.Ostatus->set(BX_EJECTED);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: floppy.h,v 1.9 2002-02-06 18:51:48 vruppert Exp $
|
||||
// $Id: floppy.h,v 1.10 2002-08-04 08:42:34 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -112,6 +112,7 @@ private:
|
||||
unsigned floppy_buffer_index;
|
||||
int floppy_timer_index;
|
||||
Boolean media_present[2];
|
||||
Bit8u device_type[4];
|
||||
Bit8u DIR; // Digital Input Register:
|
||||
// b7: 0=diskette is present and has not been changed
|
||||
// 1=diskette missing or changed
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: harddrv.cc,v 1.64 2002-07-30 09:54:26 vruppert Exp $
|
||||
// $Id: harddrv.cc,v 1.65 2002-08-04 08:42:34 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -128,7 +128,7 @@ bx_hard_drive_c::~bx_hard_drive_c(void)
|
||||
bx_hard_drive_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
{
|
||||
BX_HD_THIS devices = d;
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.64 2002-07-30 09:54:26 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: harddrv.cc,v 1.65 2002-08-04 08:42:34 vruppert Exp $"));
|
||||
|
||||
/* HARD DRIVE 0 */
|
||||
|
||||
@ -200,7 +200,7 @@ bx_hard_drive_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
#endif
|
||||
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
if (bx_options.cdromd.Oinserted->get () == BX_INSERTED) {
|
||||
if (bx_options.cdromd.Ostatus->get () == BX_INSERTED) {
|
||||
if (BX_HD_THIS s[1].cdrom.cd->insert_cdrom()) {
|
||||
BX_INFO(( "Media present in CD-ROM drive"));
|
||||
BX_HD_THIS s[1].cdrom.ready = 1;
|
||||
@ -208,7 +208,7 @@ bx_hard_drive_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
} else {
|
||||
BX_INFO(( "Could not locate CD-ROM, continuing with media not present"));
|
||||
BX_HD_THIS s[1].cdrom.ready = 0;
|
||||
bx_options.cdromd.Oinserted->set(BX_EJECTED);
|
||||
bx_options.cdromd.Ostatus->set(BX_EJECTED);
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
@ -1020,7 +1020,7 @@ BX_DEBUG(("IO write to %04x = %02x", (unsigned) address, (unsigned) value));
|
||||
BX_HD_THIS s[1].cdrom.cd->eject_cdrom();
|
||||
#endif
|
||||
BX_HD_THIS s[1].cdrom.ready = 0;
|
||||
bx_options.cdromd.Oinserted->set(BX_EJECTED);
|
||||
bx_options.cdromd.Ostatus->set(BX_EJECTED);
|
||||
bx_gui.update_drive_status_buttons();
|
||||
}
|
||||
raise_interrupt();
|
||||
@ -2723,7 +2723,7 @@ bx_hard_drive_c::set_cd_media_status(unsigned status)
|
||||
BX_HD_THIS s[1].cdrom.cd->eject_cdrom();
|
||||
#endif
|
||||
BX_HD_THIS s[1].cdrom.ready = 0;
|
||||
bx_options.cdromd.Oinserted->set(BX_EJECTED);
|
||||
bx_options.cdromd.Ostatus->set(BX_EJECTED);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -2733,7 +2733,7 @@ bx_hard_drive_c::set_cd_media_status(unsigned status)
|
||||
BX_INFO(( "Media present in CD-ROM drive"));
|
||||
BX_HD_THIS s[1].cdrom.ready = 1;
|
||||
BX_HD_THIS s[1].cdrom.capacity = BX_HD_THIS s[1].cdrom.cd->capacity();
|
||||
bx_options.cdromd.Oinserted->set(BX_INSERTED);
|
||||
bx_options.cdromd.Ostatus->set(BX_INSERTED);
|
||||
BX_SELECTED_HD.sense.sense_key = SENSE_UNIT_ATTENTION;
|
||||
BX_SELECTED_HD.sense.asc = 0;
|
||||
BX_SELECTED_HD.sense.ascq = 0;
|
||||
@ -2743,7 +2743,7 @@ bx_hard_drive_c::set_cd_media_status(unsigned status)
|
||||
#endif
|
||||
BX_INFO(( "Could not locate CD-ROM, continuing with media not present"));
|
||||
BX_HD_THIS s[1].cdrom.ready = 0;
|
||||
bx_options.cdromd.Oinserted->set(BX_EJECTED);
|
||||
bx_options.cdromd.Ostatus->set(BX_EJECTED);
|
||||
#ifdef LOWLEVEL_CDROM
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.109 2002-08-01 12:19:00 vruppert Exp $
|
||||
// $Id: main.cc,v 1.110 2002-08-04 08:42:34 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -68,8 +68,8 @@ class state_file state_stuff("state_file.out", "options");
|
||||
bx_debug_t bx_dbg;
|
||||
|
||||
bx_options_t bx_options = {
|
||||
{ NULL, NULL, NULL }, // floppya
|
||||
{ NULL, NULL, NULL }, // floppyb
|
||||
{ NULL, NULL, NULL, NULL }, // floppya
|
||||
{ NULL, NULL, NULL, NULL }, // floppyb
|
||||
{ 0, NULL, 0, 0, 0 }, // diskc
|
||||
{ 0, NULL, 0, 0, 0 }, // diskd
|
||||
{ 0, NULL}, // com1
|
||||
@ -185,18 +185,28 @@ bx_param_handler (bx_param_c *param, int set, Bit32s val)
|
||||
case BXP_CMOS_IMAGE:
|
||||
SIM->get_param (BXP_CMOS_PATH)->set_enabled (val);
|
||||
break;
|
||||
case BXP_CDROM_INSERTED:
|
||||
case BXP_CDROM_STATUS:
|
||||
if ((set) && (SIM->get_init_done ())) {
|
||||
bx_devices.hard_drive->set_cd_media_status(val == BX_INSERTED);
|
||||
bx_gui.update_drive_status_buttons ();
|
||||
}
|
||||
break;
|
||||
case BXP_FLOPPYA_TYPE:
|
||||
if ((set) && (!SIM->get_init_done ())) {
|
||||
bx_options.floppya.Odevtype->set (val);
|
||||
}
|
||||
break;
|
||||
case BXP_FLOPPYA_STATUS:
|
||||
if ((set) && (SIM->get_init_done ())) {
|
||||
bx_devices.floppy->set_media_status(0, val == BX_INSERTED);
|
||||
bx_gui.update_drive_status_buttons ();
|
||||
}
|
||||
break;
|
||||
case BXP_FLOPPYB_TYPE:
|
||||
if ((set) && (!SIM->get_init_done ())) {
|
||||
bx_options.floppyb.Odevtype->set (val);
|
||||
}
|
||||
break;
|
||||
case BXP_FLOPPYB_STATUS:
|
||||
if ((set) && (SIM->get_init_done ())) {
|
||||
bx_devices.floppy->set_media_status(1, val == BX_INSERTED);
|
||||
@ -240,6 +250,7 @@ char *bx_param_string_handler (bx_param_string_c *param, int set, char *val, int
|
||||
bx_devices.floppy->set_media_status(0, 1);
|
||||
}
|
||||
} else {
|
||||
SIM->get_param_num(BXP_FLOPPYA_DEVTYPE)->set_enabled (!empty);
|
||||
SIM->get_param_num(BXP_FLOPPYA_TYPE)->set_enabled (!empty);
|
||||
SIM->get_param_num(BXP_FLOPPYA_STATUS)->set_enabled (!empty);
|
||||
}
|
||||
@ -264,6 +275,7 @@ char *bx_param_string_handler (bx_param_string_c *param, int set, char *val, int
|
||||
bx_devices.floppy->set_media_status(1, 1);
|
||||
}
|
||||
} else {
|
||||
SIM->get_param_num(BXP_FLOPPYB_DEVTYPE)->set_enabled (!empty);
|
||||
SIM->get_param_num(BXP_FLOPPYB_TYPE)->set_enabled (!empty);
|
||||
SIM->get_param_num(BXP_FLOPPYB_STATUS)->set_enabled (!empty);
|
||||
}
|
||||
@ -298,14 +310,14 @@ char *bx_param_string_handler (bx_param_string_c *param, int set, char *val, int
|
||||
}
|
||||
}
|
||||
if ((bx_devices.hard_drive) &&
|
||||
(SIM->get_param_num(BXP_CDROM_INSERTED)->get () == BX_INSERTED)) {
|
||||
(SIM->get_param_num(BXP_CDROM_STATUS)->get () == BX_INSERTED)) {
|
||||
// tell the device model that we removed, then inserted the cd
|
||||
bx_devices.hard_drive->set_cd_media_status(0);
|
||||
bx_devices.hard_drive->set_cd_media_status(1);
|
||||
}
|
||||
} else {
|
||||
SIM->get_param_num(BXP_CDROM_PRESENT)->set (!empty);
|
||||
SIM->get_param_num(BXP_CDROM_INSERTED)->set_enabled (!empty);
|
||||
SIM->get_param_num(BXP_CDROM_STATUS)->set_enabled (!empty);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -335,6 +347,12 @@ void bx_init_options ()
|
||||
#else
|
||||
bx_options.floppya.Opath->set_ask_format ("Enter new filename, or 'none' for no disk: [%s] ");
|
||||
#endif
|
||||
bx_options.floppya.Odevtype = new bx_param_enum_c (BXP_FLOPPYA_DEVTYPE,
|
||||
"floppya:devtype",
|
||||
"Type of floppy drive",
|
||||
floppy_type_names,
|
||||
BX_FLOPPY_NONE,
|
||||
BX_FLOPPY_NONE);
|
||||
bx_options.floppya.Otype = new bx_param_enum_c (BXP_FLOPPYA_TYPE,
|
||||
"floppya:type",
|
||||
"Type of floppy disk",
|
||||
@ -342,27 +360,28 @@ void bx_init_options ()
|
||||
BX_FLOPPY_NONE,
|
||||
BX_FLOPPY_NONE);
|
||||
bx_options.floppya.Otype->set_ask_format ("What type of floppy disk? [%s] ");
|
||||
bx_options.floppya.Oinitial_status = new bx_param_enum_c (BXP_FLOPPYA_STATUS,
|
||||
bx_options.floppya.Ostatus = new bx_param_enum_c (BXP_FLOPPYA_STATUS,
|
||||
"Is floppya inserted",
|
||||
"Inserted or ejected",
|
||||
floppy_status_names,
|
||||
BX_INSERTED,
|
||||
BX_EJECTED);
|
||||
bx_options.floppya.Oinitial_status->set_ask_format ("Is the floppy inserted or ejected? [%s] ");
|
||||
bx_options.floppya.Ostatus->set_ask_format ("Is the floppy inserted or ejected? [%s] ");
|
||||
bx_options.floppya.Opath->set_format ("%s");
|
||||
bx_options.floppya.Otype->set_format (", size=%s, ");
|
||||
bx_options.floppya.Oinitial_status->set_format ("%s");
|
||||
bx_options.floppya.Ostatus->set_format ("%s");
|
||||
bx_param_c *floppya_init_list[] = {
|
||||
bx_options.floppya.Opath,
|
||||
bx_options.floppya.Otype,
|
||||
bx_options.floppya.Oinitial_status,
|
||||
bx_options.floppya.Ostatus,
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c (BXP_FLOPPYA, "Floppy Disk 0", "All options for first floppy disk", floppya_init_list);
|
||||
menu->get_options ()->set (menu->BX_SERIES_ASK);
|
||||
bx_options.floppya.Opath->set_handler (bx_param_string_handler);
|
||||
bx_options.floppya.Opath->set ("none");
|
||||
bx_options.floppya.Oinitial_status->set_handler (bx_param_handler);
|
||||
bx_options.floppya.Otype->set_handler (bx_param_handler);
|
||||
bx_options.floppya.Ostatus->set_handler (bx_param_handler);
|
||||
|
||||
bx_options.floppyb.Opath = new bx_param_filename_c (BXP_FLOPPYB_PATH,
|
||||
"floppyb:path",
|
||||
@ -373,6 +392,12 @@ void bx_init_options ()
|
||||
#else
|
||||
bx_options.floppyb.Opath->set_ask_format ("Enter new filename, or 'none' for no disk: [%s] ");
|
||||
#endif
|
||||
bx_options.floppyb.Odevtype = new bx_param_enum_c (BXP_FLOPPYB_DEVTYPE,
|
||||
"floppyb:devtype",
|
||||
"Type of floppy drive",
|
||||
floppy_type_names,
|
||||
BX_FLOPPY_NONE,
|
||||
BX_FLOPPY_NONE);
|
||||
bx_options.floppyb.Otype = new bx_param_enum_c (BXP_FLOPPYB_TYPE,
|
||||
"floppyb:type",
|
||||
"Type of floppy disk",
|
||||
@ -380,28 +405,29 @@ void bx_init_options ()
|
||||
BX_FLOPPY_NONE,
|
||||
BX_FLOPPY_NONE);
|
||||
bx_options.floppyb.Otype->set_ask_format ("What type of floppy disk? [%s] ");
|
||||
bx_options.floppyb.Oinitial_status = new bx_param_enum_c (BXP_FLOPPYB_STATUS,
|
||||
bx_options.floppyb.Ostatus = new bx_param_enum_c (BXP_FLOPPYB_STATUS,
|
||||
"Is floppyb inserted",
|
||||
"Inserted or ejected",
|
||||
floppy_status_names,
|
||||
BX_INSERTED,
|
||||
BX_EJECTED);
|
||||
bx_options.floppyb.Oinitial_status->set_ask_format ("Is the floppy inserted or ejected? [%s] ");
|
||||
bx_options.floppyb.Oinitial_status->set_format ("%s");
|
||||
bx_options.floppyb.Ostatus->set_ask_format ("Is the floppy inserted or ejected? [%s] ");
|
||||
bx_options.floppyb.Ostatus->set_format ("%s");
|
||||
bx_options.floppyb.Opath->set_format ("%s");
|
||||
bx_options.floppyb.Otype->set_format (", size=%s, ");
|
||||
bx_options.floppyb.Oinitial_status->set_format ("%s");
|
||||
bx_options.floppyb.Ostatus->set_format ("%s");
|
||||
bx_param_c *floppyb_init_list[] = {
|
||||
bx_options.floppyb.Opath,
|
||||
bx_options.floppyb.Otype,
|
||||
bx_options.floppyb.Oinitial_status,
|
||||
bx_options.floppyb.Ostatus,
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c (BXP_FLOPPYB, "Floppy Disk 1", "All options for second floppy disk", floppyb_init_list);
|
||||
menu->get_options ()->set (menu->BX_SERIES_ASK);
|
||||
bx_options.floppyb.Opath->set_handler (bx_param_string_handler);
|
||||
bx_options.floppyb.Opath->set ("none");
|
||||
bx_options.floppyb.Oinitial_status->set_handler (bx_param_handler);
|
||||
bx_options.floppyb.Otype->set_handler (bx_param_handler);
|
||||
bx_options.floppyb.Ostatus->set_handler (bx_param_handler);
|
||||
|
||||
// diskc options
|
||||
bx_options.diskc.Opresent = new bx_param_bool_c (BXP_DISKC_PRESENT,
|
||||
@ -553,24 +579,24 @@ void bx_init_options ()
|
||||
#if BX_UI_TEXT
|
||||
bx_options.cdromd.Opath->set_ask_format ("Enter new filename, or 'none' for no CDROM: [%s] ");
|
||||
#endif
|
||||
bx_options.cdromd.Oinserted = new bx_param_enum_c (BXP_CDROM_INSERTED,
|
||||
bx_options.cdromd.Ostatus = new bx_param_enum_c (BXP_CDROM_STATUS,
|
||||
"Is the CDROM inserted or ejected",
|
||||
"Inserted or ejected",
|
||||
floppy_status_names,
|
||||
BX_INSERTED,
|
||||
BX_EJECTED);
|
||||
bx_options.cdromd.Oinserted->set_format (", %s");
|
||||
bx_options.cdromd.Oinserted->set_ask_format ("Is the CDROM inserted or ejected? [%s] ");
|
||||
bx_options.cdromd.Ostatus->set_format (", %s");
|
||||
bx_options.cdromd.Ostatus->set_ask_format ("Is the CDROM inserted or ejected? [%s] ");
|
||||
bx_param_c *cdromd_init_list[] = {
|
||||
bx_options.cdromd.Opath,
|
||||
bx_options.cdromd.Oinserted,
|
||||
bx_options.cdromd.Ostatus,
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c (BXP_CDROMD, "CDROM", "Options for the CDROM", cdromd_init_list);
|
||||
menu->get_options ()->set (menu->BX_SERIES_ASK);
|
||||
bx_options.cdromd.Opath->set_handler (bx_param_string_handler);
|
||||
bx_options.cdromd.Opath->set ("none");
|
||||
bx_options.cdromd.Oinserted->set_handler (bx_param_handler);
|
||||
bx_options.cdromd.Ostatus->set_handler (bx_param_handler);
|
||||
|
||||
bx_options.OnewHardDriveSupport = new bx_param_bool_c (BXP_NEWHARDDRIVESUPPORT,
|
||||
"New Hard Drive Support",
|
||||
@ -1638,10 +1664,10 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
bx_options.floppya.Otype->set (BX_FLOPPY_360K);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=ejected", 14)) {
|
||||
bx_options.floppya.Oinitial_status->set (BX_EJECTED);
|
||||
bx_options.floppya.Ostatus->set (BX_EJECTED);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=inserted", 15)) {
|
||||
bx_options.floppya.Oinitial_status->set (BX_INSERTED);
|
||||
bx_options.floppya.Ostatus->set (BX_INSERTED);
|
||||
}
|
||||
else {
|
||||
BX_PANIC(("%s: floppya attribute '%s' not understood.", context,
|
||||
@ -1673,10 +1699,10 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
bx_options.floppyb.Otype->set (BX_FLOPPY_360K);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=ejected", 14)) {
|
||||
bx_options.floppyb.Oinitial_status->set (BX_EJECTED);
|
||||
bx_options.floppyb.Ostatus->set (BX_EJECTED);
|
||||
}
|
||||
else if (!strncmp(params[i], "status=inserted", 15)) {
|
||||
bx_options.floppyb.Oinitial_status->set (BX_INSERTED);
|
||||
bx_options.floppyb.Ostatus->set (BX_INSERTED);
|
||||
}
|
||||
else {
|
||||
BX_PANIC(("%s: floppyb attribute '%s' not understood.", context,
|
||||
@ -1768,9 +1794,9 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
}
|
||||
bx_options.cdromd.Opath->set (¶ms[1][4]);
|
||||
if (!strcmp(params[2], "status=inserted"))
|
||||
bx_options.cdromd.Oinserted->set (BX_INSERTED);
|
||||
bx_options.cdromd.Ostatus->set (BX_INSERTED);
|
||||
else if (!strcmp(params[2], "status=ejected"))
|
||||
bx_options.cdromd.Oinserted->set (BX_EJECTED);
|
||||
bx_options.cdromd.Ostatus->set (BX_EJECTED);
|
||||
else {
|
||||
BX_PANIC(("%s: cdromd directive malformed.", context));
|
||||
}
|
||||
@ -2360,7 +2386,7 @@ bx_write_floppy_options (FILE *fp, int drive, bx_floppy_options *opt)
|
||||
(char)'a'+drive,
|
||||
fdtypes[opt->Otype->get () - BX_FLOPPY_NONE],
|
||||
opt->Opath->getptr (),
|
||||
opt->Oinitial_status->get ()==BX_EJECTED ? "ejected" : "inserted");
|
||||
opt->Ostatus->get ()==BX_EJECTED ? "ejected" : "inserted");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2390,7 +2416,7 @@ bx_write_cdrom_options (FILE *fp, int drive, bx_cdrom_options *opt)
|
||||
}
|
||||
fprintf (fp, "cdromd: dev=%s, status=%s\n",
|
||||
opt->Opath->getptr (),
|
||||
opt->Oinserted->get ()==BX_INSERTED ? "inserted" : "ejected");
|
||||
opt->Ostatus->get ()==BX_INSERTED ? "inserted" : "ejected");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user