Merge pull request #3074 from jriwanek-forks/more-fdc
Add tertiary and quaternary FDC options + improvements to monster FDC
This commit is contained in:
@@ -2280,6 +2280,12 @@ fdc_reset(void *priv)
|
|||||||
} else if (fdc->flags & FDC_FLAG_SEC) {
|
} else if (fdc->flags & FDC_FLAG_SEC) {
|
||||||
fdc->dma = 1;
|
fdc->dma = 1;
|
||||||
fdc->specify[1] = 0;
|
fdc->specify[1] = 0;
|
||||||
|
} else if (fdc->flags & FDC_FLAG_TER) {
|
||||||
|
fdc->dma = 1;
|
||||||
|
fdc->specify[1] = 0;
|
||||||
|
} else if (fdc->flags & FDC_FLAG_QUA) {
|
||||||
|
fdc->dma = 1;
|
||||||
|
fdc->specify[1] = 0;
|
||||||
} else {
|
} else {
|
||||||
fdc->dma = 1;
|
fdc->dma = 1;
|
||||||
fdc->specify[1] = 0;
|
fdc->specify[1] = 0;
|
||||||
@@ -2297,6 +2303,10 @@ fdc_reset(void *priv)
|
|||||||
fdc_remove(fdc);
|
fdc_remove(fdc);
|
||||||
if (fdc->flags & FDC_FLAG_SEC) {
|
if (fdc->flags & FDC_FLAG_SEC) {
|
||||||
fdc_set_base(fdc, FDC_SECONDARY_ADDR);
|
fdc_set_base(fdc, FDC_SECONDARY_ADDR);
|
||||||
|
} else if (fdc->flags & FDC_FLAG_TER) {
|
||||||
|
fdc_set_base(fdc, FDC_TERTIARY_ADDR);
|
||||||
|
} else if (fdc->flags & FDC_FLAG_QUA) {
|
||||||
|
fdc_set_base(fdc, FDC_QUATERNARY_ADDR);
|
||||||
} else {
|
} else {
|
||||||
fdc_set_base(fdc, (fdc->flags & FDC_FLAG_PCJR) ? FDC_PRIMARY_PCJR_ADDR : FDC_PRIMARY_ADDR);
|
fdc_set_base(fdc, (fdc->flags & FDC_FLAG_PCJR) ? FDC_PRIMARY_PCJR_ADDR : FDC_PRIMARY_ADDR);
|
||||||
}
|
}
|
||||||
@@ -2337,6 +2347,10 @@ fdc_init(const device_t *info)
|
|||||||
timer_add(&fdc->watchdog_timer, fdc_watchdog_poll, fdc, 0);
|
timer_add(&fdc->watchdog_timer, fdc_watchdog_poll, fdc, 0);
|
||||||
else if (fdc->flags & FDC_FLAG_SEC)
|
else if (fdc->flags & FDC_FLAG_SEC)
|
||||||
fdc->dma_ch = FDC_SECONDARY_DMA;
|
fdc->dma_ch = FDC_SECONDARY_DMA;
|
||||||
|
else if (fdc->flags & FDC_FLAG_TER)
|
||||||
|
fdc->dma_ch = FDC_TERTIARY_DMA;
|
||||||
|
else if (fdc->flags & FDC_FLAG_QUA)
|
||||||
|
fdc->dma_ch = FDC_QUATERNARY_DMA;
|
||||||
else
|
else
|
||||||
fdc->dma_ch = FDC_PRIMARY_DMA;
|
fdc->dma_ch = FDC_PRIMARY_DMA;
|
||||||
|
|
||||||
@@ -2390,6 +2404,34 @@ const device_t fdc_xt_sec_device = {
|
|||||||
.config = NULL
|
.config = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const device_t fdc_xt_ter_device = {
|
||||||
|
.name = "PC/XT Floppy Drive Controller (Tertiary)",
|
||||||
|
.internal_name = "fdc_xt_ter",
|
||||||
|
.flags = FDC_FLAG_TER,
|
||||||
|
.local = 0,
|
||||||
|
.init = fdc_init,
|
||||||
|
.close = fdc_close,
|
||||||
|
.reset = fdc_reset,
|
||||||
|
{ .available = NULL },
|
||||||
|
.speed_changed = NULL,
|
||||||
|
.force_redraw = NULL,
|
||||||
|
.config = NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
const device_t fdc_xt_qua_device = {
|
||||||
|
.name = "PC/XT Floppy Drive Controller (Quaternary)",
|
||||||
|
.internal_name = "fdc_xt_qua",
|
||||||
|
.flags = FDC_FLAG_QUA,
|
||||||
|
.local = 0,
|
||||||
|
.init = fdc_init,
|
||||||
|
.close = fdc_close,
|
||||||
|
.reset = fdc_reset,
|
||||||
|
{ .available = NULL },
|
||||||
|
.speed_changed = NULL,
|
||||||
|
.force_redraw = NULL,
|
||||||
|
.config = NULL
|
||||||
|
};
|
||||||
|
|
||||||
const device_t fdc_xt_t1x00_device = {
|
const device_t fdc_xt_t1x00_device = {
|
||||||
.name = "PC/XT Floppy Drive Controller (Toshiba)",
|
.name = "PC/XT Floppy Drive Controller (Toshiba)",
|
||||||
.internal_name = "fdc_xt_t1x00",
|
.internal_name = "fdc_xt_t1x00",
|
||||||
@@ -2474,6 +2516,34 @@ const device_t fdc_at_sec_device = {
|
|||||||
.config = NULL
|
.config = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const device_t fdc_at_ter_device = {
|
||||||
|
.name = "PC/AT Floppy Drive Controller (Tertiary)",
|
||||||
|
.internal_name = "fdc_at_ter",
|
||||||
|
.flags = 0,
|
||||||
|
.local = FDC_FLAG_AT | FDC_FLAG_TER,
|
||||||
|
.init = fdc_init,
|
||||||
|
.close = fdc_close,
|
||||||
|
.reset = fdc_reset,
|
||||||
|
{ .available = NULL },
|
||||||
|
.speed_changed = NULL,
|
||||||
|
.force_redraw = NULL,
|
||||||
|
.config = NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
const device_t fdc_at_qua_device = {
|
||||||
|
.name = "PC/AT Floppy Drive Controller (Quaternary)",
|
||||||
|
.internal_name = "fdc_at_qua",
|
||||||
|
.flags = 0,
|
||||||
|
.local = FDC_FLAG_AT | FDC_FLAG_QUA,
|
||||||
|
.init = fdc_init,
|
||||||
|
.close = fdc_close,
|
||||||
|
.reset = fdc_reset,
|
||||||
|
{ .available = NULL },
|
||||||
|
.speed_changed = NULL,
|
||||||
|
.force_redraw = NULL,
|
||||||
|
.config = NULL
|
||||||
|
};
|
||||||
|
|
||||||
const device_t fdc_at_actlow_device = {
|
const device_t fdc_at_actlow_device = {
|
||||||
.name = "PC/AT Floppy Drive Controller (Active low)",
|
.name = "PC/AT Floppy Drive Controller (Active low)",
|
||||||
.internal_name = "fdc_at_actlow",
|
.internal_name = "fdc_at_actlow",
|
||||||
|
@@ -39,6 +39,8 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
rom_t bios_rom;
|
rom_t bios_rom;
|
||||||
|
fdc_t *fdc_pri;
|
||||||
|
fdc_t *fdc_sec;
|
||||||
} monster_fdc_t;
|
} monster_fdc_t;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -57,14 +59,29 @@ monster_fdc_init(const device_t *info)
|
|||||||
dev = (monster_fdc_t *)malloc(sizeof(monster_fdc_t));
|
dev = (monster_fdc_t *)malloc(sizeof(monster_fdc_t));
|
||||||
memset(dev, 0, sizeof(monster_fdc_t));
|
memset(dev, 0, sizeof(monster_fdc_t));
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
uint8_t sec_irq = device_get_config_int("sec_irq");
|
||||||
|
uint8_t sec_dma = device_get_config_int("sec_dma");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (BIOS_ADDR != 0)
|
if (BIOS_ADDR != 0)
|
||||||
rom_init(&dev->bios_rom, ROM_MONSTER_FDC, BIOS_ADDR, 0x2000, 0x1ffff, 0, MEM_MAPPING_EXTERNAL);
|
rom_init(&dev->bios_rom, ROM_MONSTER_FDC, BIOS_ADDR, 0x2000, 0x1ffff, 0, MEM_MAPPING_EXTERNAL);
|
||||||
|
|
||||||
// Primary FDC
|
// Primary FDC
|
||||||
device_add(&fdc_at_device);
|
dev->fdc_pri = device_add(&fdc_at_device);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Secondary FDC
|
// Secondary FDC
|
||||||
// device_add(&fdc_at_sec_device);
|
uint8_t sec_enabled = device_get_config_int("sec_enabled");
|
||||||
|
if (sec_enabled)
|
||||||
|
dev->fdc_sec = device_add(&fdc_at_sec_device);
|
||||||
|
fdc_set_irq(dev->fdc_sec, sec_irq);
|
||||||
|
fdc_set_dma_ch(dev->fdc_sec, sec_dma);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
uint8_t rom_writes_enabled = device_get_config_int("rom_writes_enabled");
|
||||||
|
#endif
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
@@ -76,7 +93,14 @@ static int monster_fdc_available(void)
|
|||||||
|
|
||||||
static const device_config_t monster_fdc_config[] = {
|
static const device_config_t monster_fdc_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
/*
|
#if 0
|
||||||
|
{
|
||||||
|
.name = "sec_enabled",
|
||||||
|
.description = "Enable Secondary Controller",
|
||||||
|
.type = CONFIG_BINARY,
|
||||||
|
.default_string = "",
|
||||||
|
.default_int = 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "sec_irq",
|
.name = "sec_irq",
|
||||||
.description = "Secondary Controller IRQ",
|
.description = "Secondary Controller IRQ",
|
||||||
@@ -137,7 +161,7 @@ static const device_config_t monster_fdc_config[] = {
|
|||||||
{ .description = "" }
|
{ .description = "" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
#endif
|
||||||
{
|
{
|
||||||
.name = "bios_addr",
|
.name = "bios_addr",
|
||||||
.description = "BIOS Address:",
|
.description = "BIOS Address:",
|
||||||
@@ -157,7 +181,7 @@ static const device_config_t monster_fdc_config[] = {
|
|||||||
{ .description = "" }
|
{ .description = "" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*
|
#if 0
|
||||||
{
|
{
|
||||||
.name = "bios_size",
|
.name = "bios_size",
|
||||||
.description = "BIOS Size:",
|
.description = "BIOS Size:",
|
||||||
@@ -172,8 +196,14 @@ static const device_config_t monster_fdc_config[] = {
|
|||||||
{ .description = "" }
|
{ .description = "" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
{
|
||||||
// BIOS extension ROM writes: Enabled/Disabled
|
.name = "rom_writes_enabled",
|
||||||
|
.description = "Enable BIOS extension ROM Writes",
|
||||||
|
.type = CONFIG_BINARY,
|
||||||
|
.default_string = "",
|
||||||
|
.default_int = 0
|
||||||
|
},
|
||||||
|
#endif
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
@@ -53,6 +53,8 @@ extern int fdc_type;
|
|||||||
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
|
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
|
||||||
#define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */
|
#define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */
|
||||||
#define FDC_FLAG_SEC 0x1000 /* Is Secondary */
|
#define FDC_FLAG_SEC 0x1000 /* Is Secondary */
|
||||||
|
#define FDC_FLAG_TER 0x2000 /* Is Tertiary */
|
||||||
|
#define FDC_FLAG_QUA 0x3000 /* Is Quaternary */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t dor, stat, command, processed_cmd, dat, st0, swap, dtl;
|
uint8_t dor, stat, command, processed_cmd, dat, st0, swap, dtl;
|
||||||
@@ -187,12 +189,16 @@ extern uint8_t fdc_get_current_drive(void);
|
|||||||
#ifdef EMU_DEVICE_H
|
#ifdef EMU_DEVICE_H
|
||||||
extern const device_t fdc_xt_device;
|
extern const device_t fdc_xt_device;
|
||||||
extern const device_t fdc_xt_sec_device;
|
extern const device_t fdc_xt_sec_device;
|
||||||
|
extern const device_t fdc_xt_ter_device;
|
||||||
|
extern const device_t fdc_xt_qua_device;
|
||||||
extern const device_t fdc_xt_t1x00_device;
|
extern const device_t fdc_xt_t1x00_device;
|
||||||
extern const device_t fdc_xt_tandy_device;
|
extern const device_t fdc_xt_tandy_device;
|
||||||
extern const device_t fdc_xt_amstrad_device;
|
extern const device_t fdc_xt_amstrad_device;
|
||||||
extern const device_t fdc_pcjr_device;
|
extern const device_t fdc_pcjr_device;
|
||||||
extern const device_t fdc_at_device;
|
extern const device_t fdc_at_device;
|
||||||
extern const device_t fdc_at_sec_device;
|
extern const device_t fdc_at_sec_device;
|
||||||
|
extern const device_t fdc_at_ter_device;
|
||||||
|
extern const device_t fdc_at_qua_device;
|
||||||
extern const device_t fdc_at_actlow_device;
|
extern const device_t fdc_at_actlow_device;
|
||||||
extern const device_t fdc_at_ps1_device;
|
extern const device_t fdc_at_ps1_device;
|
||||||
extern const device_t fdc_at_smc_device;
|
extern const device_t fdc_at_smc_device;
|
||||||
|
Reference in New Issue
Block a user