Hard disc controllers can now be selected on all machines.

Added device configuration for hard disc controller to Wx GUI.
This commit is contained in:
SarahW 2017-10-01 15:42:32 +01:00
commit 06f7cd3c6c
10 changed files with 3759 additions and 3574 deletions

View file

@ -1,3 +1,6 @@
#ifndef _DEVICE_H_
#define _DEVICE_H_
#define CONFIG_STRING 0
#define CONFIG_INT 1
#define CONFIG_BINARY 2
@ -54,3 +57,5 @@ enum
int model_get_config_int(char *s);
char *model_get_config_string(char *s);
#endif

View file

@ -4,6 +4,7 @@
#include "esdi_at.h"
#include "hdd_esdi.h"
#include "ide.h"
#include "mfm_at.h"
#include "mfm_xebec.h"
#include "xtide.h"
@ -20,17 +21,19 @@ static struct
char internal_name[16];
device_t *device;
int is_mfm;
int is_ide;
} hdd_controllers[] =
{
{"None", "none", &null_hdd_device, 0},
{"[MFM] AT Fixed Disk Adapter", "mfm_at", &mfm_at_device, 1},
{"[MFM] DTC 5150X", "dtc5150x", &dtc_5150x_device, 1},
{"[MFM] Fixed Disk Adapter (Xebec)", "mfm_xebec", &mfm_xebec_device, 1},
{"[ESDI] IBM ESDI Fixed Disk Controller", "esdi_mca", &hdd_esdi_device, 1},
{"[ESDI] Western Digital WD1007V-SE1", "wd1007vse1", &wd1007vse1_device, 0},
{"[IDE] XTIDE", "xtide", &xtide_device, 0},
{"[IDE] XTIDE (AT)", "xtide_at", &xtide_at_device, 0},
{"", "", NULL, 0}
{"None", "none", &null_hdd_device, 0, 0},
{"[MFM] AT Fixed Disk Adapter", "mfm_at", &mfm_at_device, 1, 0},
{"[MFM] DTC 5150X", "dtc5150x", &dtc_5150x_device, 1, 0},
{"[MFM] Fixed Disk Adapter (Xebec)", "mfm_xebec", &mfm_xebec_device, 1, 0},
{"[ESDI] IBM ESDI Fixed Disk Controller", "esdi_mca", &hdd_esdi_device, 1, 0},
{"[ESDI] Western Digital WD1007V-SE1", "wd1007vse1", &wd1007vse1_device, 0, 0},
{"[IDE] Standard IDE", "ide", &ide_device, 0, 1},
{"[IDE] XTIDE", "xtide", &xtide_device, 0, 1},
{"[IDE] XTIDE (AT)", "xtide_at", &xtide_at_device, 0, 1},
{"", "", NULL, 0, 0}
};
char *hdd_controller_get_name(int hdd)
@ -53,7 +56,7 @@ int hdd_controller_available(int hdd)
return device_available(hdd_controllers[hdd].device);
}
int hdd_controller_is_mfm(char* internal_name)
int hdd_controller_is_mfm(char *internal_name)
{
int c = 0;
@ -70,11 +73,67 @@ int hdd_controller_is_mfm(char* internal_name)
return 0;
}
int hdd_controller_is_ide(char *internal_name)
{
int c = 0;
while (hdd_controllers[c].device)
{
if (!strcmp(internal_name, hdd_controllers[c].internal_name))
{
hdd_controller_current = c;
if (strcmp(internal_name, "none"))
return hdd_controllers[c].is_ide;
}
c++;
}
return 0;
}
int hdd_controller_has_config(char *internal_name)
{
int c = 0;
while (hdd_controllers[c].device)
{
if (!strcmp(internal_name, hdd_controllers[c].internal_name))
{
hdd_controller_current = c;
if (strcmp(internal_name, "none"))
return hdd_controllers[c].device->config ? 1 : 0;
}
c++;
}
return 0;
}
device_t *hdd_controller_get_device(char *internal_name)
{
int c = 0;
while (hdd_controllers[c].device)
{
if (!strcmp(internal_name, hdd_controllers[c].internal_name))
{
hdd_controller_current = c;
if (strcmp(internal_name, "none"))
return hdd_controllers[c].device;
}
c++;
}
return NULL;
}
int hdd_controller_current_is_mfm()
{
return hdd_controller_is_mfm(hdd_controller_name);
}
int hdd_controller_current_is_ide()
{
return hdd_controller_is_ide(hdd_controller_name);
}
void hdd_controller_init(char *internal_name)
{

View file

@ -1,9 +1,14 @@
#include "device.h"
char *hdd_controller_get_name(int hdd);
char *hdd_controller_get_internal_name(int hdd);
int hdd_controller_get_flags(int hdd);
int hdd_controller_available(int hdd);
int hdd_controller_is_mfm(char* internal_name);
int hdd_controller_has_config(char *internal_name);
device_t *hdd_controller_get_device(char *internal_name);
int hdd_controller_current_is_mfm();
int hdd_controller_current_is_ide();
void hdd_controller_init(char *internal_name);
extern char hdd_controller_name[16];

View file

@ -20,6 +20,7 @@
#include "arm.h"
#else
#include "ibm.h"
#include "hdd.h"
#include "io.h"
#include "pic.h"
#include "timer.h"
@ -708,29 +709,31 @@ void resetide(void)
memset(mode_pages_in[GPMODE_CDROM_AUDIO_PAGE], 0, 256); /* Clear the page itself. */
idecallback[0]=idecallback[1]=0;
if (hdd_controller_current_is_ide())
{
#ifdef RPCEMU_IDE
loadhd(&ide_drives[0], 0, "hd4.hdf");
if (!config.cdromenabled) {
loadhd(&ide_drives[1], 1, "hd5.hdf");
}
else
ide_drives[1].type = IDE_CDROM;
loadhd(&ide_drives[0], 0, "hd4.hdf");
if (!config.cdromenabled)
loadhd(&ide_drives[1], 1, "hd5.hdf");
else
ide_drives[1].type = IDE_CDROM;
#else
for (d = 0; d < 4; d++)
{
ide_drives[d].drive = d;
ide_drives[d].packetstatus = 0xFF;
for (d = 0; d < 4; d++)
{
ide_drives[d].drive = d;
ide_drives[d].packetstatus = 0xFF;
if ((cdrom_channel == d) && cdrom_enabled)
{
ide_drives[d].type = IDE_CDROM;
}
else
{
loadhd(&ide_drives[d], d, ide_fn[d]);
}
if ((cdrom_channel == d) && cdrom_enabled)
{
ide_drives[d].type = IDE_CDROM;
}
else
{
loadhd(&ide_drives[d], d, ide_fn[d]);
}
ide_set_signature(&ide_drives[d]);
ide_set_signature(&ide_drives[d]);
}
}
#endif
@ -2850,7 +2853,7 @@ void ide_sec_disable()
io_removehandler(0x0376, 0x0001, ide_read_sec, NULL, NULL, ide_write_sec, NULL, NULL , NULL);
}
void ide_init()
static void *ide_init()
{
ide_pri_enable();
ide_sec_enable();
@ -2858,6 +2861,12 @@ void ide_init()
timer_add(ide_callback_pri, &idecallback[0], &idecallback[0], NULL);
timer_add(ide_callback_sec, &idecallback[1], &idecallback[1], NULL);
return (void *)-1;
}
static void ide_close(void *p)
{
}
void ide_set_bus_master(int (*read_sector)(int channel, uint8_t *data), int (*write_sector)(int channel, uint8_t *data), void (*set_irq)(int channel))
@ -2866,3 +2875,16 @@ void ide_set_bus_master(int (*read_sector)(int channel, uint8_t *data), int (*wr
ide_bus_master_write_sector = write_sector;
ide_bus_master_set_irq = set_irq;
}
device_t ide_device =
{
"Standard IDE",
DEVICE_AT,
ide_init,
ide_close,
NULL,
NULL,
NULL,
NULL,
NULL
};

View file

@ -1,6 +1,8 @@
#ifndef __IDE__
#define __IDE__
#include "device.h"
struct IDE;
extern void writeide(int ide_board, uint16_t addr, uint8_t val);
@ -9,7 +11,6 @@ extern uint8_t readide(int ide_board, uint16_t addr);
extern uint16_t readidew(int ide_board);
extern void callbackide(int ide_board);
extern void resetide(void);
extern void ide_init();
extern void ide_pri_enable();
extern void ide_sec_enable();
extern void ide_pri_disable();
@ -58,4 +59,6 @@ uint32_t atapi_get_cd_volume(int channel);
#define CDROM_IMAGE 200
extern device_t ide_device;
#endif //__IDE__

View file

@ -67,7 +67,6 @@ void europc_init();
void olim24_init();
void at_init();
void ibm_at_init();
void at_ide_init();
void at_cbm_init();
void dells200_init();
void deskpro386_init();
@ -328,16 +327,9 @@ void ibm_at_init()
mem_remap_top_384k();
}
void at_ide_init()
{
at_init();
ide_init();
mem_remap_top_384k();
}
void at_cbm_init()
{
at_ide_init();
at_init();
cbm_io_init();
}
@ -360,7 +352,6 @@ void ps1_common_init()
mem_add_bios();
pit_set_out_func(&pit, 1, pit_refresh_timer_at);
dma16_init();
ide_init();
keyboard_at_init();
nvr_init();
pic2_init();
@ -391,7 +382,6 @@ void ps2_m30_286_init()
mem_add_bios();
pit_set_out_func(&pit, 1, pit_refresh_timer_at);
dma16_init();
ide_init();
keyboard_at_init();
// mouse_ps2_init();
nvr_init();
@ -407,7 +397,6 @@ static void ps2_common_init()
mem_add_bios();
dma16_init();
ps2_dma_init();
ide_init();
keyboard_at_init();
keyboard_at_init_ps2();
// mouse_ps2_init();
@ -438,56 +427,48 @@ void ps2_model_80_init()
void at_neat_init()
{
at_init();
ide_init();
neat_init();
}
void at_scat_init()
{
at_init();
ide_init();
scat_init();
}
void at_acer386sx_init()
{
at_init();
ide_init();
acer386sx_init();
}
void at_wd76c10_init()
{
at_init();
ide_init();
wd76c10_init();
}
void at_headland_init()
{
at_init();
ide_init();
headland_init();
}
void at_opti495_init()
{
at_init();
ide_init();
opti495_init();
}
void at_ali1429_init()
{
at_init();
ide_init();
ali1429_init();
}
void at_sis496_init()
{
at_init();
ide_init();
pci_init(PCI_CONFIG_TYPE_1);
pci_slot(0xb);
pci_slot(0xd);
@ -498,7 +479,6 @@ void at_sis496_init()
void at_batman_init()
{
at_init();
ide_init();
pci_init(PCI_CONFIG_TYPE_2);
pci_slot(0xc);
pci_slot(0xe);
@ -512,7 +492,6 @@ void at_batman_init()
void at_endeavor_init()
{
at_init();
ide_init();
pci_init(PCI_CONFIG_TYPE_1);
pci_slot(0xd);
pci_slot(0xe);
@ -528,7 +507,6 @@ void at_endeavor_init()
void at_i430vx_init()
{
at_init();
ide_init();
pci_init(PCI_CONFIG_TYPE_1);
pci_slot(0x11);
pci_slot(0x12);

View file

@ -964,7 +964,7 @@
<border>0</border>
<object class="wxFlexGridSizer">
<rows>0</rows>
<cols>2</cols>
<cols>3</cols>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>1</growablecols>
@ -998,6 +998,15 @@
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL</flag>
<border>5</border>
<object class="wxBitmapButton" name="IDC_CONFIGUREHDD">
<bitmap>icons/16x16/setting_tools.png</bitmap>
<default>0</default>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL | wxALIGN_CENTER_VERTICAL</flag>
@ -1027,6 +1036,12 @@
</object>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALL | wxALIGN_CENTER_VERTICAL</flag>
@ -1056,6 +1071,12 @@
</object>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
</object>
</object>
<object class="sizeritem">

View file

@ -45,6 +45,9 @@ extern void deviceconfig_open(void* hwnd, device_t *device);
extern int hdconf_init(void* hdlg);
extern int hdconf_update(void* hdlg);
static int hdd_controller_selected_has_config(void *hdlg);
static device_t *hdd_controller_selected_get_device(void *hdlg);
static int mouse_valid(int type, int model)
{
if (((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_PS2)
@ -142,72 +145,75 @@ static void recalc_snd_list(void* hdlg, int model)
wx_sendmessage(h, WX_CB_SETCURSEL, settings_sound_to_list[sound_card_current], 0);
}
static void recalc_hdd_list(void* hdlg, int model, int use_selected_hdd)
static void recalc_hdd_list(void* hdlg, int model, int use_selected_hdd, int force_ide)
{
void* h;
char *s;
int valid = 0;
char old_name[16];
int c, d;
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBOHDD"));
if (models[model].flags & MODEL_HAS_IDE)
if (force_ide)
strcpy(old_name, "ide");
else if (use_selected_hdd)
{
wx_sendmessage(h, WX_CB_RESETCONTENT, 0, 0);
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)"Internal IDE");
wx_enablewindow(h, FALSE);
wx_sendmessage(h, WX_CB_SETCURSEL, 0, 0);
c = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0);
if (c != -1 && hdd_names[c])
strncpy(old_name, hdd_names[c], sizeof(old_name)-1);
else
{
if (models[model].flags & MODEL_HAS_IDE)
strcpy(old_name, "none");
else
strcpy(old_name, "ide");
}
}
else
{
char *s;
int valid = 0;
char old_name[16];
int c, d;
if (use_selected_hdd)
{
c = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0);
if (c != -1 && hdd_names[c])
strncpy(old_name, hdd_names[c], sizeof(old_name)-1);
else
strcpy(old_name, "none");
}
else
strncpy(old_name, hdd_controller_name, sizeof(old_name)-1);
wx_sendmessage(h, WX_CB_RESETCONTENT, 0, 0);
c = d = 0;
while (1)
{
s = hdd_controller_get_name(c);
if (s[0] == 0)
wx_sendmessage(h, WX_CB_RESETCONTENT, 0, 0);
c = d = 0;
while (1)
{
s = hdd_controller_get_name(c);
if (s[0] == 0)
break;
if ((((hdd_controller_get_flags(c) & DEVICE_AT) && !(models[model].flags & MODEL_AT)) ||
(hdd_controller_get_flags(c) & DEVICE_MCA) != (models[model].flags & MODEL_MCA)) && c)
{
c++;
continue;
}
if (!hdd_controller_available(c))
{
c++;
continue;
}
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)s);
hdd_names[d] = hdd_controller_get_internal_name(c);
if (!strcmp(old_name, hdd_names[d]))
{
wx_sendmessage(h, WX_CB_SETCURSEL, d, 0);
valid = 1;
}
if ((((hdd_controller_get_flags(c) & DEVICE_AT) && !(models[model].flags & MODEL_AT)) ||
(hdd_controller_get_flags(c) & DEVICE_MCA) != (models[model].flags & MODEL_MCA)) && c)
{
c++;
d++;
continue;
}
if (!hdd_controller_available(c))
{
c++;
continue;
}
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)s);
hdd_names[d] = hdd_controller_get_internal_name(c);
if (!valid)
if (!strcmp(old_name, hdd_names[d]))
{
wx_sendmessage(h, WX_CB_SETCURSEL, d, 0);
valid = 1;
}
c++;
d++;
}
if (!valid)
wx_sendmessage(h, WX_CB_SETCURSEL, 0, 0);
wx_enablewindow(h, TRUE);
h = wx_getdlgitem(hdlg, WX_ID("IDC_CONFIGUREHDD"));
if (hdd_controller_selected_has_config(hdlg))
wx_enablewindow(h, TRUE);
}
else
wx_enablewindow(h, FALSE);
}
#ifdef USE_NETWORKING
@ -469,6 +475,7 @@ int config_dlgsave(void* hdlg)
return TRUE;
}
static int prev_model;
int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
{
char temp_str[256];
@ -510,6 +517,7 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
c++;
}
wx_sendmessage(h, WX_CB_SETCURSEL, modeltolist[model], 0);
prev_model = model;
recalc_vid_list(hdlg, romstomodel[romset]);
@ -711,7 +719,7 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
}
wx_sendmessage(h, WX_CB_SETCURSEL, d, 0);
recalc_hdd_list(hdlg, romstomodel[romset], 0);
recalc_hdd_list(hdlg, romstomodel[romset], 0, 0);
hd_changed = 0;
new_cdrom_channel = cdrom_channel;
@ -735,8 +743,15 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
{
if (wParam == WX_ID("IDC_COMBO1"))
{
int force_ide = 0;
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO1"));
temp_model = listtomodel[wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0)];
if ((models[temp_model].flags & MODEL_HAS_IDE) && !(models[prev_model].flags & MODEL_HAS_IDE))
force_ide = 1;
prev_model = temp_model;
/*Rebuild manufacturer list*/
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBOCPUM"));
@ -851,7 +866,7 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
recalc_vid_list(hdlg, temp_model);
recalc_hdd_list(hdlg, temp_model, 1);
recalc_hdd_list(hdlg, temp_model, 1, force_ide);
recalc_snd_list(hdlg, temp_model);
#ifdef USE_NETWORKING
@ -989,6 +1004,10 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
{
hdconf_update(hdlg);
}
else if (wParam == WX_ID("IDC_CONFIGUREHDD"))
{
deviceconfig_open(hdlg, (void *)hdd_controller_selected_get_device(hdlg));
}
#ifdef USE_NETWORKING
else if (wParam == WX_ID("IDC_COMBO_NETCARD"))
{
@ -1088,6 +1107,22 @@ static int hdd_controller_selected_is_mfm(void* hdlg)
return hdd_controller_is_mfm(hdd_names[c]);
return 0;
}
static int hdd_controller_selected_has_config(void* hdlg)
{
void* h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBOHDD"));
int c = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0);
if (hdd_names[c])
return hdd_controller_has_config(hdd_names[c]);
return 0;
}
static device_t *hdd_controller_selected_get_device(void *hdlg)
{
void* h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBOHDD"));
int c = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0);
if (hdd_names[c])
return hdd_controller_get_device(hdd_names[c]);
return NULL;
}
static void check_hd_type(void* hdlg, off64_t sz)
{
@ -1521,6 +1556,7 @@ int hdconf_init(void* hdlg)
int hdconf_update(void* hdlg)
{
char s[260];
void *h;
int is_mfm = hdd_controller_selected_is_mfm(hdlg);
@ -1561,6 +1597,12 @@ int hdconf_update(void* hdlg)
}
}
h = wx_getdlgitem(hdlg, WX_ID("IDC_CONFIGUREHDD"));
if (hdd_controller_selected_has_config(hdlg))
wx_enablewindow(h, TRUE);
else
wx_enablewindow(h, FALSE);
return TRUE;
}

File diff suppressed because it is too large Load diff

View file

@ -71,7 +71,7 @@ static void *xtide_init()
memset(xtide, 0, sizeof(xtide_t));
rom_init(&xtide->bios_rom, "ide_xt.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL);
ide_init();
device_add(&ide_device);
ide_pri_disable();
ide_sec_disable();
io_sethandler(0x0300, 0x0010, xtide_read, NULL, NULL, xtide_write, NULL, NULL, xtide);
@ -85,7 +85,7 @@ static void *xtide_at_init()
memset(xtide, 0, sizeof(xtide_t));
rom_init(&xtide->bios_rom, "ide_at.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL);
ide_init();
device_add(&ide_device);
return xtide;
}