- presence of floppy drive now depends on the devtype parameter instead of a

non-empty path
- floppy devtype parameter now uses CMOS values and drive type names
- related changes in the floppy code
- simplified floppy parameter handlers
- some floppy parameter label changes
- added enable handler for the floppy path parameter
- update dependent params after setting the dependent bitmap of enum parameter
This commit is contained in:
Volker Ruppert 2009-03-23 19:05:16 +00:00
parent 85cdc96a49
commit af3dfa73d7
8 changed files with 127 additions and 209 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.167 2009-03-22 20:18:16 vruppert Exp $
// $Id: config.cc,v 1.168 2009-03-23 19:05:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -92,46 +92,25 @@ static Bit64s bx_param_handler(bx_param_c *param, int set, Bit64s val)
}
} else {
param->get_param_path(pname, BX_PATHNAME_LEN);
if (!strcmp(pname, BXPN_FLOPPYA_TYPE)) {
if ((!strcmp(pname, BXPN_FLOPPYA_TYPE)) ||
(!strcmp(pname, BXPN_FLOPPYB_TYPE))) {
if (set) {
if (val == BX_FLOPPY_AUTO) {
val = get_floppy_type_from_image(SIM->get_param_string(BXPN_FLOPPYA_PATH)->getptr());
SIM->get_param_enum(BXPN_FLOPPYA_TYPE)->set(val);
} else if (!SIM->get_init_done()) {
val = get_floppy_type_from_image(SIM->get_param_string("path", base)->getptr());
SIM->get_param_enum("type", base)->set(val);
} else if (!SIM->get_init_done() && (val != BX_FLOPPY_NONE)) {
switch (val) {
case BX_FLOPPY_1_2:
case BX_FLOPPY_1_44:
case BX_FLOPPY_2_88:
device = val;
device = BX_FDD_350ED;
break;
case BX_FLOPPY_720K:
device = BX_FLOPPY_1_44;
break;
default:
device = BX_FLOPPY_1_2;
}
SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->set(device);
}
}
} else if (!strcmp(pname, BXPN_FLOPPYB_TYPE)) {
if (set) {
if (val == BX_FLOPPY_AUTO) {
val = get_floppy_type_from_image(SIM->get_param_string(BXPN_FLOPPYB_PATH)->getptr());
SIM->get_param_enum(BXPN_FLOPPYB_TYPE)->set(val);
} else if (!SIM->get_init_done()) {
switch (val) {
case BX_FLOPPY_1_2:
case BX_FLOPPY_1_44:
case BX_FLOPPY_2_88:
device = val;
break;
case BX_FLOPPY_720K:
device = BX_FLOPPY_1_44;
device = BX_FDD_350HD;
break;
default:
device = BX_FLOPPY_1_2;
device = BX_FDD_525HD;
}
SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->set(device);
SIM->get_param_enum("devtype", base)->set(device);
}
}
} else if (!strcmp(pname, BXPN_FLOPPYA_STATUS)) {
@ -210,50 +189,29 @@ const char *bx_param_string_handler(bx_param_string_c *param, int set,
if (set==1) {
BX_INFO(("Screen mode changed to %s", val));
}
} else if (!strcmp(pname, BXPN_FLOPPYA_PATH)) {
} else if ((!strcmp(pname, BXPN_FLOPPYA_PATH)) ||
(!strcmp(pname, BXPN_FLOPPYB_PATH))) {
if (set==1) {
device = !strcmp(pname, BXPN_FLOPPYB_PATH);
if (SIM->get_init_done()) {
if (empty) {
DEV_floppy_set_media_status(0, 0);
DEV_floppy_set_media_status(device, 0);
bx_gui->update_drive_status_buttons();
} else {
if (!SIM->get_param_num(BXPN_FLOPPYA_TYPE)->get_enabled()) {
if (SIM->get_param_enum("devtype", base)->get() == BX_FDD_NONE) {
BX_ERROR(("Cannot add a floppy drive at runtime"));
SIM->get_param_string(BXPN_FLOPPYA_PATH)->set("none");
SIM->get_param_string("path", base)->set("none");
}
}
if ((DEV_floppy_present()) &&
(SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->get() == BX_INSERTED)) {
(SIM->get_param_enum("status", base)->get() == BX_INSERTED)) {
// tell the device model that we removed, then inserted the disk
DEV_floppy_set_media_status(0, 0);
DEV_floppy_set_media_status(0, 1);
DEV_floppy_set_media_status(device, 0);
DEV_floppy_set_media_status(device, 1);
}
} else {
SIM->get_param_enum(BXPN_FLOPPYA_TYPE)->set_enabled(!empty);
SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->set_enabled(!empty);
}
}
} else if (!strcmp(pname, BXPN_FLOPPYB_PATH)) {
if (set==1) {
if (SIM->get_init_done()) {
if (empty) {
DEV_floppy_set_media_status(1, 0);
bx_gui->update_drive_status_buttons();
} else {
if (!SIM->get_param_num(BXPN_FLOPPYB_TYPE)->get_enabled()) {
BX_ERROR(("Cannot add a floppy drive at runtime"));
SIM->get_param_string(BXPN_FLOPPYB_PATH)->set("none");
}
}
if ((DEV_floppy_present()) &&
(SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->get() == BX_INSERTED)) {
// tell the device model that we removed, then inserted the disk
DEV_floppy_set_media_status(1, 0);
DEV_floppy_set_media_status(1, 1);
}
} else {
SIM->get_param_enum(BXPN_FLOPPYB_TYPE)->set_enabled(!empty);
SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->set_enabled(!empty);
SIM->get_param_enum("type", base)->set_enabled(!empty);
SIM->get_param_enum("status", base)->set_enabled(!empty);
}
}
#if BX_PLUGINS
@ -272,6 +230,26 @@ const char *bx_param_string_handler(bx_param_string_c *param, int set,
return val;
}
static int bx_param_enable_handler(bx_param_c *param, int val)
{
char pname[BX_PATHNAME_LEN];
bx_param_string_c *sparam;
bx_bool empty;
bx_list_c *base = (bx_list_c*) param->get_parent();
param->get_param_path(pname, BX_PATHNAME_LEN);
if ((!strcmp(pname, BXPN_FLOPPYA_PATH)) ||
(!strcmp(pname, BXPN_FLOPPYB_PATH))) {
sparam = (bx_param_string_c*)param;
empty = (strlen(sparam->getptr()) < 1) || !strcmp(sparam->getptr(), "none");
SIM->get_param_enum("type", base)->set_enabled(val && !empty);
SIM->get_param_enum("status", base)->set_enabled(val && !empty);
} else {
BX_PANIC(("bx_param_enable_handler called with unknown parameter '%s'", pname));
}
return val;
}
void bx_init_options()
{
int i;
@ -883,41 +861,43 @@ void bx_init_options()
// floppy subtree
bx_list_c *floppy = new bx_list_c(root_param, "floppy", "Floppy Options");
bx_list_c *floppya = new bx_list_c(floppy, "0", "Floppy Disk 0");
bx_list_c *floppyb = new bx_list_c(floppy, "1", "Floppy Disk 1");
bx_list_c *floppya = new bx_list_c(floppy, "0", "First Floppy Drive");
bx_list_c *floppyb = new bx_list_c(floppy, "1", "Second Floppy Drive");
bx_param_enum_c *devtype;
// floppy options
devtype = new bx_param_enum_c(floppya,
"devtype",
"Type of floppy drive",
"Type of floppy drive",
floppy_devtype_names,
BX_FDD_NONE,
BX_FDD_NONE);
devtype->set_ask_format("What type of floppy drive? [%s] ");
path = new bx_param_filename_c(floppya,
"path",
"First floppy image/device",
"Pathname of first floppy image file or device. If you're booting from floppy, this should be a bootable floppy.",
"", BX_PATHNAME_LEN);
path->set_ask_format("Enter new filename, or 'none' for no disk: [%s] ");
path->set_enable_handler(bx_param_enable_handler);
path->set_extension("img");
path->set_runtime_param(1);
devtype = new bx_param_enum_c(floppya,
"devtype",
"Type of floppy drive",
"Type of floppy drive",
floppy_type_names,
BX_FLOPPY_NONE,
BX_FLOPPY_NONE);
devtype->set_enabled(0); // hide devtype parameter
type = new bx_param_enum_c(floppya,
"type",
"Type of floppy disk",
"Type of floppy disk",
"Type of floppy media",
"Type of floppy media",
floppy_type_names,
BX_FLOPPY_NONE,
BX_FLOPPY_NONE);
type->set_ask_format("What type of floppy disk? (auto=detect) [%s] ");
type->set_ask_format("What type of floppy media? (auto=detect) [%s] ");
type->set_runtime_param(1);
status = new bx_param_enum_c(floppya,
"status",
"Is floppya inserted",
"Media status",
"Inserted or ejected",
floppy_status_names,
BX_INSERTED,
@ -925,11 +905,24 @@ void bx_init_options()
status->set_ask_format("Is the floppy inserted or ejected? [%s] ");
status->set_runtime_param(1);
deplist = new bx_list_c(NULL, 1);
deplist->add(path);
devtype->set_dependent_list(deplist, 1);
devtype->set_dependent_bitmap(BX_FDD_NONE, 0);
path->set_handler(bx_param_string_handler);
type->set_handler(bx_param_handler);
status->set_handler(bx_param_handler);
path->set_initial_val("none");
floppya->set_options(floppya->SERIES_ASK);
floppya->set_options(floppya->SERIES_ASK | floppya->USE_BOX_TITLE);
devtype = new bx_param_enum_c(floppyb,
"devtype",
"Type of floppy drive",
"Type of floppy drive",
floppy_devtype_names,
BX_FDD_NONE,
BX_FDD_NONE);
devtype->set_ask_format("What type of floppy drive? [%s] ");
path = new bx_param_filename_c(floppyb,
"path",
@ -937,30 +930,23 @@ void bx_init_options()
"Pathname of second floppy image file or device.",
"", BX_PATHNAME_LEN);
path->set_ask_format("Enter new filename, or 'none' for no disk: [%s] ");
path->set_enable_handler(bx_param_enable_handler);
path->set_extension("img");
path->set_runtime_param(1);
devtype = new bx_param_enum_c(floppyb,
"devtype",
"Type of floppy drive",
"Type of floppy drive",
floppy_type_names,
BX_FLOPPY_NONE,
BX_FLOPPY_NONE);
devtype->set_enabled(0); // hide devtype parameter
type = new bx_param_enum_c(floppyb,
"type",
"Type of floppy disk",
"Type of floppy disk",
"Type of floppy media",
"Type of floppy media",
floppy_type_names,
BX_FLOPPY_NONE,
BX_FLOPPY_NONE);
type->set_ask_format("What type of floppy disk? (auto=detect) [%s] ");
type->set_ask_format("What type of floppy media? (auto=detect) [%s] ");
type->set_runtime_param(1);
status = new bx_param_enum_c(floppyb,
"status",
"Is floppyb inserted",
"Media status",
"Inserted or ejected",
floppy_status_names,
BX_INSERTED,
@ -968,11 +954,15 @@ void bx_init_options()
status->set_ask_format("Is the floppy inserted or ejected? [%s] ");
status->set_runtime_param(1);
deplist = new bx_list_c(NULL, 1);
deplist->add(path);
devtype->set_dependent_list(deplist, 1);
devtype->set_dependent_bitmap(BX_FDD_NONE, 0);
path->set_handler(bx_param_string_handler);
type->set_handler(bx_param_handler);
status->set_handler(bx_param_handler);
path->set_initial_val("none");
floppyb->set_options(floppyb->SERIES_ASK);
floppyb->set_options(floppyb->SERIES_ASK | floppyb->USE_BOX_TITLE);
floppy->set_options(floppy->SHOW_PARENT);
// ATA/ATAPI subtree

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.109 2009-02-23 11:06:53 vruppert Exp $
// $Id: gui.cc,v 1.110 2009-03-23 19:05:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -283,7 +283,7 @@ void bx_gui_c::update_drive_status_buttons(void)
void bx_gui_c::floppyA_handler(void)
{
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() == BX_FLOPPY_NONE)
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() == BX_FDD_NONE)
return; // no primary floppy device present
if (BX_GUI_THIS dialog_caps & BX_GUI_DLG_FLOPPY) {
// instead of just toggling the status, call win32dialog to bring up
@ -301,7 +301,7 @@ void bx_gui_c::floppyA_handler(void)
void bx_gui_c::floppyB_handler(void)
{
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() == BX_FLOPPY_NONE)
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() == BX_FDD_NONE)
return; // no secondary floppy device present
if (BX_GUI_THIS dialog_caps & BX_GUI_DLG_FLOPPY) {
// instead of just toggling the status, call win32dialog to bring up

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.201 2009-03-22 20:18:17 vruppert Exp $
// $Id: siminterface.cc,v 1.202 2009-03-23 19:05:16 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -464,6 +464,7 @@ int bx_real_sim_c::get_cdrom_options(int level, bx_list_c **out, int *where)
const char *bochs_start_names[] = { "quick", "load", "edit", "run" };
const char *floppy_devtype_names[] = { "none", "5.25\" 360K", "5.25\" 1.2M", "3.5\" 720K", "3.5\" 1.44M", "3.5\" 2.88M", NULL };
const char *floppy_type_names[] = { "none", "1.2M", "1.44M", "2.88M", "720K", "360K", "160K", "180K", "320K", "auto", NULL };
int floppy_type_n_sectors[] = { -1, 80*2*15, 80*2*18, 80*2*36, 80*2*9, 40*2*9, 40*1*8, 40*1*9, 40*2*8, -1 };
const char *floppy_status_names[] = { "ejected", "inserted", NULL };
@ -1830,6 +1831,7 @@ void bx_param_enum_c::set_dependent_bitmap(Bit64s value, Bit64u bitmap)
if (deps_bitmap != NULL) {
deps_bitmap[value - min] = bitmap;
}
update_dependents();
}
Bit64u bx_param_enum_c::get_dependent_bitmap(Bit64s value)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.235 2009-03-22 20:18:17 vruppert Exp $
// $Id: siminterface.h,v 1.236 2009-03-23 19:05:16 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -1034,7 +1034,14 @@ enum {
BX_MOUSE_TYPE_SERIAL_MSYS
};
#define BX_FLOPPY_NONE 10 // floppy not present
#define BX_FDD_NONE 0 // floppy not present
#define BX_FDD_525DD 1 // 360K 5.25"
#define BX_FDD_525HD 2 // 1.2M 5.25"
#define BX_FDD_350DD 3 // 720K 3.5"
#define BX_FDD_350HD 4 // 1.44M 3.5"
#define BX_FDD_350ED 5 // 2.88M 3.5"
#define BX_FLOPPY_NONE 10 // media 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"
@ -1087,6 +1094,7 @@ enum {
#define BX_CLOCK_TIME0_UTC 2
BOCHSAPI extern const char *bochs_start_names[];
BOCHSAPI extern const char *floppy_devtype_names[];
BOCHSAPI extern const char *floppy_type_names[];
BOCHSAPI extern int floppy_type_n_sectors[];
BOCHSAPI extern const char *floppy_status_names[];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: textconfig.cc,v 1.77 2009-03-22 20:18:17 vruppert Exp $
// $Id: textconfig.cc,v 1.78 2009-03-23 19:05:16 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -349,7 +349,7 @@ void build_runtime_options_prompt(const char *format, char *buf, int size)
for (int i=0; i<2; i++) {
sprintf(pname, "floppy.%d", i);
floppyop = (bx_list_c*) SIM->get_param(pname);
if (SIM->get_param_enum("devtype", floppyop)->get() == BX_FLOPPY_NONE)
if (SIM->get_param_enum("devtype", floppyop)->get() == BX_FDD_NONE)
strcpy(buffer[i], "(not present)");
else {
sprintf(buffer[i], "%s, size=%s, %s", SIM->get_param_string("path", floppyop)->getptr(),
@ -517,10 +517,10 @@ int bx_config_interface(int menu)
#endif
switch (choice) {
case BX_CI_RT_FLOPPYA:
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYA);
if (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get() != BX_FDD_NONE) do_menu(BXPN_FLOPPYA);
break;
case BX_CI_RT_FLOPPYB:
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FLOPPY_NONE) do_menu(BXPN_FLOPPYB);
if (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get() != BX_FDD_NONE) do_menu(BXPN_FLOPPYB);
break;
case BX_CI_RT_CDROM1:
case BX_CI_RT_CDROM2:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.80 2009-03-22 20:18:17 vruppert Exp $
// $Id: win32dialog.cc,v 1.81 2009-03-23 19:05:16 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -229,7 +229,7 @@ static BOOL CALLBACK FloppyDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
mediatype = SIM->get_param_enum(BXPN_FLOPPYB_TYPE);
}
cap = devtype->get() - (int)devtype->get_min();
SetWindowText(GetDlgItem(hDlg, IDDEVTYPE), floppy_type_names[cap]);
SetWindowText(GetDlgItem(hDlg, IDDEVTYPE), floppy_devtype_names[cap]);
i = 0;
while (floppy_type_names[i] != NULL) {
SendMessage(GetDlgItem(hDlg, IDMEDIATYPE), CB_ADDSTRING, 0, (LPARAM)floppy_type_names[i]);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.cc,v 1.159 2009-03-15 21:16:16 vruppert Exp $
// $Id: wxmain.cc,v 1.160 2009-03-23 19:05:16 vruppert Exp $
/////////////////////////////////////////////////////////////////
//
// wxmain.cc implements the wxWidgets frame, toolbar, menus, and dialogs.
@ -662,7 +662,7 @@ void MyFrame::OnEditBoot(wxCommandEvent& WXUNUSED(event))
{
int bootDevices = 0;
bx_param_enum_c *floppy = SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE);
if (floppy->get() != BX_FLOPPY_NONE) {
if (floppy->get() != BX_FDD_NONE) {
bootDevices++;
}
bx_param_c *firsthd = SIM->get_first_hd();
@ -993,11 +993,11 @@ void MyFrame::simStatusChanged(StatusChange change, bx_bool popupNotify) {
// only be edited if it was enabled at boot time.
Bit64u value;
value = SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get();
menuEdit->Enable(ID_Edit_FD_0, canConfigure || (value != BX_FLOPPY_NONE));
bxToolBar->EnableTool(ID_Edit_FD_0, canConfigure || (value != BX_FLOPPY_NONE));
menuEdit->Enable(ID_Edit_FD_0, canConfigure || (value != BX_FDD_NONE));
bxToolBar->EnableTool(ID_Edit_FD_0, canConfigure || (value != BX_FDD_NONE));
value = SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get();
menuEdit->Enable(ID_Edit_FD_1, canConfigure || (value != BX_FLOPPY_NONE));
bxToolBar->EnableTool(ID_Edit_FD_1, canConfigure || (value != BX_FLOPPY_NONE));
menuEdit->Enable(ID_Edit_FD_1, canConfigure || (value != BX_FDD_NONE));
bxToolBar->EnableTool(ID_Edit_FD_1, canConfigure || (value != BX_FDD_NONE));
bxToolBar->EnableTool(ID_Edit_Cdrom, canConfigure || (SIM->get_first_cdrom() != NULL));
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: floppy.cc,v 1.117 2009-03-08 08:22:23 vruppert Exp $
// $Id: floppy.cc,v 1.118 2009-03-23 19:05:16 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -83,8 +83,8 @@ bx_floppy_ctrl_c *theFloppyController;
#define FDRIVE_NONE 0x00
#define FDRIVE_525DD 0x01
#define FDRIVE_350DD 0x02
#define FDRIVE_525HD 0x04
#define FDRIVE_525HD 0x02
#define FDRIVE_350DD 0x04
#define FDRIVE_350HD 0x08
#define FDRIVE_350ED 0x10
@ -98,12 +98,12 @@ typedef struct {
} floppy_type_t;
static floppy_type_t floppy_type[8] = {
{BX_FLOPPY_160K, 40, 1, 8, 320, 0x05},
{BX_FLOPPY_180K, 40, 1, 9, 360, 0x05},
{BX_FLOPPY_320K, 40, 2, 8, 640, 0x05},
{BX_FLOPPY_360K, 40, 2, 9, 720, 0x05},
{BX_FLOPPY_160K, 40, 1, 8, 320, 0x03},
{BX_FLOPPY_180K, 40, 1, 9, 360, 0x03},
{BX_FLOPPY_320K, 40, 2, 8, 640, 0x03},
{BX_FLOPPY_360K, 40, 2, 9, 720, 0x03},
{BX_FLOPPY_720K, 80, 2, 9, 1440, 0x1f},
{BX_FLOPPY_1_2, 80, 2, 15, 2400, 0x04},
{BX_FLOPPY_1_2, 80, 2, 15, 2400, 0x02},
{BX_FLOPPY_1_44, 80, 2, 18, 2880, 0x18},
{BX_FLOPPY_2_88, 80, 2, 36, 5760, 0x10}
};
@ -139,9 +139,9 @@ bx_floppy_ctrl_c::~bx_floppy_ctrl_c()
void bx_floppy_ctrl_c::init(void)
{
Bit8u i, cmos_value;
Bit8u i, devtype, cmos_value;
BX_DEBUG(("Init $Id: floppy.cc,v 1.117 2009-03-08 08:22:23 vruppert Exp $"));
BX_DEBUG(("Init $Id: floppy.cc,v 1.118 2009-03-23 19:05:16 vruppert Exp $"));
DEV_dma_register_8bit_channel(2, dma_read, dma_write, "Floppy Drive");
DEV_register_irq(6, "Floppy Drive");
for (unsigned addr=0x03F2; addr<=0x03F7; addr++) {
@ -169,51 +169,10 @@ void bx_floppy_ctrl_c::init(void)
// Floppy A setup
//
switch (SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get()) {
case BX_FLOPPY_NONE:
break;
case BX_FLOPPY_360K:
cmos_value = 0x10;
BX_FD_THIS s.device_type[0] = FDRIVE_525DD;
break;
case BX_FLOPPY_1_2:
cmos_value = 0x20;
BX_FD_THIS s.device_type[0] = FDRIVE_525HD;
break;
case BX_FLOPPY_720K:
cmos_value = 0x30;
BX_FD_THIS s.device_type[0] = FDRIVE_350DD;
break;
case BX_FLOPPY_1_44:
cmos_value = 0x40;
BX_FD_THIS s.device_type[0] = FDRIVE_350HD;
break;
case BX_FLOPPY_2_88:
cmos_value = 0x50;
BX_FD_THIS s.device_type[0] = FDRIVE_350ED;
break;
// use CMOS reserved types
case BX_FLOPPY_160K:
cmos_value = 0x60;
BX_INFO(("WARNING: 1st floppy uses of reserved CMOS floppy drive type 6"));
BX_FD_THIS s.device_type[0] = FDRIVE_525DD;
break;
case BX_FLOPPY_180K:
cmos_value = 0x70;
BX_INFO(("WARNING: 1st floppy uses of reserved CMOS floppy drive type 7"));
BX_FD_THIS s.device_type[0] = FDRIVE_525DD;
break;
case BX_FLOPPY_320K:
cmos_value = 0x80;
BX_INFO(("WARNING: 1st floppy uses of reserved CMOS floppy drive type 8"));
BX_FD_THIS s.device_type[0] = FDRIVE_525DD;
break;
default:
BX_PANIC(("unknown floppya type"));
}
if (BX_FD_THIS s.device_type[0] != FDRIVE_NONE) {
devtype = SIM->get_param_enum(BXPN_FLOPPYA_DEVTYPE)->get();
cmos_value = (devtype << 4);
if (devtype != BX_FDD_NONE) {
BX_FD_THIS s.device_type[0] = 1 << (devtype - 1);
BX_FD_THIS s.num_supported_floppies++;
BX_FD_THIS s.statusbar_id[0] = bx_gui->register_statusitem(" A: ");
} else {
@ -240,51 +199,10 @@ void bx_floppy_ctrl_c::init(void)
// Floppy B setup
//
switch (SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get()) {
case BX_FLOPPY_NONE:
break;
case BX_FLOPPY_360K:
cmos_value |= 0x01;
BX_FD_THIS s.device_type[1] = FDRIVE_525DD;
break;
case BX_FLOPPY_1_2:
cmos_value |= 0x02;
BX_FD_THIS s.device_type[1] = FDRIVE_525HD;
break;
case BX_FLOPPY_720K:
cmos_value |= 0x03;
BX_FD_THIS s.device_type[1] = FDRIVE_350DD;
break;
case BX_FLOPPY_1_44:
cmos_value |= 0x04;
BX_FD_THIS s.device_type[1] = FDRIVE_350HD;
break;
case BX_FLOPPY_2_88:
cmos_value |= 0x05;
BX_FD_THIS s.device_type[1] = FDRIVE_350ED;
break;
// use CMOS reserved types
case BX_FLOPPY_160K:
cmos_value |= 0x06;
BX_INFO(("WARNING: 2nd floppy uses of reserved CMOS floppy drive type 6"));
BX_FD_THIS s.device_type[1] = FDRIVE_525DD;
break;
case BX_FLOPPY_180K:
cmos_value |= 0x07;
BX_INFO(("WARNING: 2nd floppy uses of reserved CMOS floppy drive type 7"));
BX_FD_THIS s.device_type[1] = FDRIVE_525DD;
break;
case BX_FLOPPY_320K:
cmos_value |= 0x08;
BX_INFO(("WARNING: 2nd floppy uses of reserved CMOS floppy drive type 8"));
BX_FD_THIS s.device_type[1] = FDRIVE_525DD;
break;
default:
BX_PANIC(("unknown floppyb type"));
}
if (BX_FD_THIS s.device_type[1] != FDRIVE_NONE) {
devtype = SIM->get_param_enum(BXPN_FLOPPYB_DEVTYPE)->get();
cmos_value |= devtype;
if (devtype != BX_FDD_NONE) {
BX_FD_THIS s.device_type[1] = 1 << (devtype - 1);
BX_FD_THIS s.num_supported_floppies++;
BX_FD_THIS s.statusbar_id[1] = bx_gui->register_statusitem(" B: ");
} else {