mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 18:08:20 -07:00
Merge remote-tracking branch 'upstream/master' into feature/ich2
This commit is contained in:
33
src/device.c
33
src/device.c
@@ -347,6 +347,39 @@ device_available(const device_t *d)
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
device_get_bios_file(const device_t *d, const char *internal_name, int file_no)
|
||||
{
|
||||
device_config_t *config = NULL;
|
||||
device_config_bios_t *bios = NULL;
|
||||
|
||||
if (d != NULL) {
|
||||
config = (device_config_t *) d->config;
|
||||
if (config != NULL) {
|
||||
while (config->type != -1) {
|
||||
if (config->type == CONFIG_BIOS) {
|
||||
bios = (device_config_bios_t *) config->bios;
|
||||
|
||||
/* Go through the ROM's in the device configuration. */
|
||||
while (bios->files_no != 0) {
|
||||
if (!strcmp(internal_name, bios->internal_name)) {
|
||||
if (file_no < bios->files_no)
|
||||
return bios->files[file_no];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
bios++;
|
||||
}
|
||||
}
|
||||
config++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A NULL device is never available. */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
int
|
||||
device_has_config(const device_t *d)
|
||||
{
|
||||
|
||||
@@ -84,6 +84,7 @@ static const struct {
|
||||
{ &hdc_none_device },
|
||||
{ &hdc_internal_device },
|
||||
{ &st506_xt_xebec_device },
|
||||
{ &st506_xt_wdxt_gen_device },
|
||||
{ &st506_xt_dtc5150x_device },
|
||||
{ &st506_xt_st11_m_device },
|
||||
{ &st506_xt_wd1002a_wx1_device },
|
||||
@@ -103,6 +104,7 @@ static const struct {
|
||||
{ &xta_wdxt150_device },
|
||||
{ &xtide_acculogic_device },
|
||||
{ &xtide_device },
|
||||
{ &xtide_plus_device },
|
||||
{ &esdi_ps2_device },
|
||||
{ &ide_pci_device },
|
||||
{ &ide_pci_2ch_device },
|
||||
|
||||
@@ -88,7 +88,8 @@
|
||||
#include <86box/hdd.h>
|
||||
|
||||
#define ST506_XT_TYPE_XEBEC 0
|
||||
#define ST506_XT_TYPE_DTC_5150X 1
|
||||
#define ST506_XT_TYPE_WDXT_GEN 1
|
||||
#define ST506_XT_TYPE_DTC_5150X 2
|
||||
#define ST506_XT_TYPE_ST11M 11
|
||||
#define ST506_XT_TYPE_ST11R 12
|
||||
#define ST506_XT_TYPE_WD1002A_WX1 21
|
||||
@@ -101,6 +102,7 @@
|
||||
#define ST506_XT_TYPE_TOSHIBA_T1200 28
|
||||
|
||||
#define XEBEC_BIOS_FILE "roms/hdd/st506/ibm_xebec_62x0822_1985.bin"
|
||||
#define WDXT_GEN_BIOS_FILE "roms/hdd/st506/wdxt-gen/62-000128-000.bin"
|
||||
#define DTC_BIOS_FILE "roms/hdd/st506/dtc_cxd21a.bin"
|
||||
#define ST11_BIOS_FILE_OLD "roms/hdd/st506/st11_bios_vers_1.7.bin"
|
||||
#define ST11_BIOS_FILE_NEW "roms/hdd/st506/st11_bios_vers_2.0.bin"
|
||||
@@ -1335,6 +1337,15 @@ mem_read(uint32_t addr, void *priv)
|
||||
}
|
||||
break;
|
||||
|
||||
case ST506_XT_TYPE_WDXT_GEN: /* WDXT-GEN */
|
||||
if (addr >= 0x002000) {
|
||||
#ifdef ENABLE_ST506_XT_LOG
|
||||
st506_xt_log("ST506: WDXT-GEN ROM access(0x%06lx)\n", addr);
|
||||
#endif
|
||||
return 0xff;
|
||||
}
|
||||
break;
|
||||
|
||||
case ST506_XT_TYPE_DTC_5150X: /* DTC */
|
||||
default:
|
||||
if (addr >= 0x002000) {
|
||||
@@ -1519,6 +1530,10 @@ st506_init(const device_t *info)
|
||||
fn = XEBEC_BIOS_FILE;
|
||||
break;
|
||||
|
||||
case ST506_XT_TYPE_WDXT_GEN: /* WDXT-GEN (MFM) */
|
||||
fn = WDXT_GEN_BIOS_FILE;
|
||||
break;
|
||||
|
||||
case ST506_XT_TYPE_DTC_5150X: /* DTC5150 (MFM) */
|
||||
fn = DTC_BIOS_FILE;
|
||||
dev->switches = 0xff;
|
||||
@@ -2124,6 +2139,20 @@ const device_t st506_xt_xebec_device = {
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t st506_xt_wdxt_gen_device = {
|
||||
.name = "Western Digital WDXT-GEN (MFM)",
|
||||
.internal_name = "st506_xt",
|
||||
.flags = DEVICE_ISA,
|
||||
.local = (HDD_BUS_MFM << 8) | ST506_XT_TYPE_WDXT_GEN,
|
||||
.init = st506_init,
|
||||
.close = st506_close,
|
||||
.reset = NULL,
|
||||
{ .available = xebec_available },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t st506_xt_dtc5150x_device = {
|
||||
.name = "DTC 5150X MFM Fixed Disk Adapter",
|
||||
.internal_name = "st506_xt_dtc5150x",
|
||||
|
||||
@@ -104,7 +104,8 @@
|
||||
|
||||
#define HDC_TIME (50 * TIMER_USEC)
|
||||
|
||||
#define WD_BIOS_FILE "roms/hdd/xta/idexywd2.bin"
|
||||
#define WD_REV_1_BIOS_FILE "roms/hdd/xta/idexywd2.bin"
|
||||
#define WD_REV_2_BIOS_FILE "roms/hdd/xta/infowdbios.rom"
|
||||
|
||||
enum {
|
||||
STATE_IDLE = 0,
|
||||
@@ -962,16 +963,11 @@ hdc_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
xta_available(void)
|
||||
{
|
||||
return (rom_present(WD_BIOS_FILE));
|
||||
}
|
||||
|
||||
static void *
|
||||
xta_init(const device_t *info)
|
||||
{
|
||||
drive_t *drive;
|
||||
char *bios_rev = NULL;
|
||||
char *fn = NULL;
|
||||
hdc_t *dev;
|
||||
int c, i;
|
||||
@@ -990,7 +986,8 @@ xta_init(const device_t *info)
|
||||
dev->irq = device_get_config_int("irq");
|
||||
dev->rom_addr = device_get_config_hex20("bios_addr");
|
||||
dev->dma = 3;
|
||||
fn = WD_BIOS_FILE;
|
||||
bios_rev = (char *) device_get_config_bios("bios_rev");
|
||||
fn = (char *) device_get_bios_file(info, (const char *) bios_rev, 0);
|
||||
max = 1;
|
||||
break;
|
||||
|
||||
@@ -1123,6 +1120,22 @@ static const device_config_t wdxt150_config[] = {
|
||||
{ .description = "" }
|
||||
},
|
||||
},
|
||||
{
|
||||
.name = "bios_rev",
|
||||
.description = "BIOS Revision",
|
||||
.type = CONFIG_BIOS,
|
||||
.default_string = "rev_1",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 }, /*W1*/
|
||||
.bios = {
|
||||
{ .name = "Revision 1.0", .internal_name = "rev_1", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 8192, .files = { WD_REV_1_BIOS_FILE, "" } },
|
||||
{ .name = "Revision 2.0", .internal_name = "rev_2", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 8192, .files = { WD_REV_2_BIOS_FILE, "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format off
|
||||
};
|
||||
@@ -1135,7 +1148,7 @@ const device_t xta_wdxt150_device = {
|
||||
.init = xta_init,
|
||||
.close = xta_close,
|
||||
.reset = NULL,
|
||||
{ .available = xta_available },
|
||||
{ .available = NULL /*xta_available*/ },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = wdxt150_config
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <86box/hdc_ide.h>
|
||||
|
||||
#define ROM_PATH_XT "roms/hdd/xtide/ide_xt.bin"
|
||||
#define ROM_PATH_XTP "roms/hdd/xtide/ide_xtp.bin"
|
||||
#define ROM_PATH_AT "roms/hdd/xtide/ide_at.bin"
|
||||
#define ROM_PATH_PS2 "roms/hdd/xtide/SIDE1V12.BIN"
|
||||
#define ROM_PATH_PS2AT "roms/hdd/xtide/ide_at_1_1_5.bin"
|
||||
@@ -130,8 +131,13 @@ xtide_init(const device_t *info)
|
||||
|
||||
memset(xtide, 0x00, sizeof(xtide_t));
|
||||
|
||||
rom_init(&xtide->bios_rom, ROM_PATH_XT,
|
||||
0xc8000, 0x2000, 0x1fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
if (info->local == 1) {
|
||||
rom_init(&xtide->bios_rom, ROM_PATH_XTP,
|
||||
0xc8000, 0x2000, 0x1fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
} else {
|
||||
rom_init(&xtide->bios_rom, ROM_PATH_XT,
|
||||
0xc8000, 0x2000, 0x1fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
}
|
||||
|
||||
xtide->ide_board = ide_xtide_init();
|
||||
|
||||
@@ -148,6 +154,12 @@ xtide_available(void)
|
||||
return (rom_present(ROM_PATH_XT));
|
||||
}
|
||||
|
||||
static int
|
||||
xtide_plus_available(void)
|
||||
{
|
||||
return (rom_present(ROM_PATH_XTP));
|
||||
}
|
||||
|
||||
static void *
|
||||
xtide_at_init(const device_t *info)
|
||||
{
|
||||
@@ -258,6 +270,20 @@ const device_t xtide_device = {
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t xtide_plus_device = {
|
||||
.name = "PC/XT XTIDE (V20/V30/8018x)",
|
||||
.internal_name = "xtide_plus",
|
||||
.flags = DEVICE_ISA,
|
||||
.local = 1,
|
||||
.init = xtide_init,
|
||||
.close = xtide_close,
|
||||
.reset = NULL,
|
||||
{ .available = xtide_plus_available },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t xtide_at_device = {
|
||||
.name = "PC/AT XTIDE",
|
||||
.internal_name = "xtide_at",
|
||||
|
||||
@@ -135,6 +135,7 @@ static fdc_cards_t fdc_cards[] = {
|
||||
{ &fdc_b215_device },
|
||||
{ &fdc_pii151b_device },
|
||||
{ &fdc_pii158b_device },
|
||||
{ &fdc_monster_device },
|
||||
{ NULL }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <86box/fdc_ext.h>
|
||||
|
||||
#define BIOS_ADDR (uint32_t)(device_get_config_hex20("bios_addr") & 0x000fffff)
|
||||
#define ROM_MONSTER_FDC "roms/floppy/monster-fdc/floppy_bios.rom"
|
||||
#define ROM_MONSTER_FDC "roms/floppy/monster-fdc/floppy_bios.bin"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ typedef struct {
|
||||
int files_no;
|
||||
uint32_t local, size;
|
||||
void *dev1, *dev2;
|
||||
const char **files;
|
||||
const char *files[9];
|
||||
} device_config_bios_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -108,7 +108,7 @@ typedef struct {
|
||||
const char *file_filter;
|
||||
const device_config_spinner_t spinner;
|
||||
const device_config_selection_t selection[16];
|
||||
const device_config_bios_t *bios;
|
||||
const device_config_bios_t bios[32];
|
||||
} device_config_t;
|
||||
|
||||
typedef struct _device_ {
|
||||
@@ -164,6 +164,7 @@ extern void device_speed_changed(void);
|
||||
extern void device_force_redraw(void);
|
||||
extern void device_get_name(const device_t *d, int bus, char *name);
|
||||
extern int device_has_config(const device_t *d);
|
||||
extern const char *device_get_bios_file(const device_t *d, const char *internal_name, int file_no);
|
||||
|
||||
extern int device_is_valid(const device_t *, int m);
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ extern const device_t fdc_b215_device;
|
||||
extern const device_t fdc_pii151b_device;
|
||||
extern const device_t fdc_pii158b_device;
|
||||
|
||||
extern const device_t fdc_monster_device;
|
||||
|
||||
extern void fdc_card_init(void);
|
||||
|
||||
extern char *fdc_card_get_internal_name(int card);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
extern int hdc_current;
|
||||
|
||||
extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */
|
||||
extern const device_t st506_xt_wdxt_gen_device; /* st506_xt_wdxt_gen */
|
||||
extern const device_t st506_xt_dtc5150x_device; /* st506_xt_dtc */
|
||||
extern const device_t st506_xt_st11_m_device; /* st506_xt_st11_m */
|
||||
extern const device_t st506_xt_st11_r_device; /* st506_xt_st11_m */
|
||||
@@ -79,6 +80,7 @@ extern const device_t xta_wdxt150_device; /* xta_wdxt150 */
|
||||
extern const device_t xta_hd20_device; /* EuroPC internal */
|
||||
|
||||
extern const device_t xtide_device; /* xtide_xt */
|
||||
extern const device_t xtide_plus_device; /* xtide_xt_plus */
|
||||
extern const device_t xtide_at_device; /* xtide_at */
|
||||
extern const device_t xtide_at_386_device; /* xtide_at_386 */
|
||||
extern const device_t xtide_acculogic_device; /* xtide_ps2 */
|
||||
|
||||
@@ -1958,7 +1958,7 @@ generate_es1371_filter(void)
|
||||
for (n = 0; n < ES1371_NCoef; n++)
|
||||
gain += low_fir_es1371_coef[n] / (float) N;
|
||||
|
||||
gain /= 0.95;
|
||||
gain /= 0.65;
|
||||
|
||||
/* Normalise filter, to produce unity gain */
|
||||
for (n = 0; n < ES1371_NCoef; n++)
|
||||
|
||||
@@ -876,8 +876,6 @@ gd54xx_out(uint16_t addr, uint8_t val, void *p)
|
||||
svga_recalctimings(svga);
|
||||
} else {
|
||||
switch (svga->gdcaddr) {
|
||||
case 0x09:
|
||||
case 0x0a:
|
||||
case 0x0b:
|
||||
svga->adv_flags = 0;
|
||||
if (svga->gdcreg[0xb] & 0x01)
|
||||
@@ -888,20 +886,24 @@ gd54xx_out(uint16_t addr, uint8_t val, void *p)
|
||||
svga->adv_flags |= FLAG_EXT_WRITE;
|
||||
if (svga->gdcreg[0xb] & 0x08)
|
||||
svga->adv_flags |= FLAG_LATCH8;
|
||||
if (svga->gdcreg[0xb] & 0x10)
|
||||
if ((svga->gdcreg[0xb] & 0x10) && (svga->adv_flags & FLAG_EXT_WRITE))
|
||||
svga->adv_flags |= FLAG_ADDR_BY16;
|
||||
if (svga->gdcreg[0xb] & 0x04)
|
||||
svga->writemode = svga->gdcreg[5] & 7;
|
||||
else {
|
||||
else if (o & 0x4) {
|
||||
svga->gdcreg[5] &= ~0x04;
|
||||
svga->writemode = svga->gdcreg[5] & 3;
|
||||
svga->adv_flags = 0;
|
||||
svga->gdcreg[0] &= 0x0f;
|
||||
gd543x_mmio_write(0xb8000, svga->gdcreg[0], gd54xx);
|
||||
svga->gdcreg[1] &= 0x0f;
|
||||
gd543x_mmio_write(0xb8004, svga->gdcreg[1], gd54xx);
|
||||
svga->adv_flags &= (FLAG_EXTRA_BANKS | FLAG_ADDR_BY8 | FLAG_LATCH8);
|
||||
if (svga->crtc[0x27] != CIRRUS_ID_CLGD5436) {
|
||||
svga->gdcreg[0] &= 0x0f;
|
||||
gd543x_mmio_write(0xb8000, svga->gdcreg[0], gd54xx);
|
||||
svga->gdcreg[1] &= 0x0f;
|
||||
gd543x_mmio_write(0xb8004, svga->gdcreg[1], gd54xx);
|
||||
}
|
||||
svga->seqregs[2] &= 0x0f;
|
||||
}
|
||||
case 0x09:
|
||||
case 0x0a:
|
||||
gd54xx_recalc_banking(gd54xx);
|
||||
break;
|
||||
|
||||
@@ -1029,6 +1031,8 @@ gd54xx_out(uint16_t addr, uint8_t val, void *p)
|
||||
case 0x3d5:
|
||||
if (((svga->crtcreg == 0x19) || (svga->crtcreg == 0x1a) || (svga->crtcreg == 0x1b) || (svga->crtcreg == 0x1d) || (svga->crtcreg == 0x25) || (svga->crtcreg == 0x27)) && !gd54xx->unlocked)
|
||||
return;
|
||||
if ((svga->crtcreg == 0x25) || (svga->crtcreg == 0x27))
|
||||
return;
|
||||
if ((svga->crtcreg < 7) && (svga->crtc[0x11] & 0x80))
|
||||
return;
|
||||
if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80))
|
||||
|
||||
@@ -108,7 +108,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
c = 0;
|
||||
q = 0;
|
||||
while (bios && bios->name && bios->name[0]) {
|
||||
while (bios && (bios->files_no > 0)) {
|
||||
mbstowcs(lptsTemp, bios->name, strlen(bios->name) + 1);
|
||||
p = 0;
|
||||
for (d = 0; d < bios->files_no; d++)
|
||||
@@ -218,7 +218,6 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (cid == IDOK) {
|
||||
id = IDC_CONFIG_BASE;
|
||||
config = config_device.dev->config;
|
||||
bios = config->bios;
|
||||
changed = 0;
|
||||
char s[512];
|
||||
|
||||
@@ -251,6 +250,8 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
id += 2;
|
||||
break;
|
||||
case CONFIG_BIOS:
|
||||
bios = config->bios;
|
||||
|
||||
val_str = config_get_string((char *) config_device.name,
|
||||
(char *) config->name, (char *) config->default_string);
|
||||
|
||||
@@ -375,6 +376,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
id += 2;
|
||||
break;
|
||||
case CONFIG_BIOS:
|
||||
bios = config->bios;
|
||||
c = combo_to_struct[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||
for (; c > 0; c--)
|
||||
bios++;
|
||||
@@ -551,6 +553,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst)
|
||||
case CONFIG_MIDI_IN:
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX20:
|
||||
case CONFIG_BIOS:
|
||||
/*Combo box*/
|
||||
item = (DLGITEMTEMPLATE *) data;
|
||||
item->x = 70;
|
||||
|
||||
Reference in New Issue
Block a user