From fed171ff4d93dd3f8df15e70b8a6e8c9479f0350 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 18 Apr 2024 03:50:48 +0200 Subject: [PATCH] IBM PS/1 Model 2121 FDC fix. --- src/floppy/fdc.c | 16 +++++++++++++++- src/include/86box/fdc.h | 3 +++ src/machine/m_ps1.c | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 491df2f47..1a0aa2f10 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -780,7 +780,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) } return; case 4: - if (!(fdc->flags & FDC_FLAG_PS1)) { + if (!(fdc->flags & FDC_FLAG_NO_DSR_RESET)) { if (!(val & 0x80)) { timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC); fdc->interrupt = -6; @@ -2608,6 +2608,20 @@ const device_t fdc_at_ps1_device = { .config = NULL }; +const device_t fdc_at_ps1_2121_device = { + .name = "PC/AT Floppy Drive Controller (PS/1, PS/2 ISA)", + .internal_name = "fdc_at_ps1", + .flags = 0, + .local = FDC_FLAG_NO_DSR_RESET | FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT | FDC_FLAG_PS1, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + const device_t fdc_at_smc_device = { .name = "PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)", .internal_name = "fdc_at_smc", diff --git a/src/include/86box/fdc.h b/src/include/86box/fdc.h index 00de511f3..9529fde5c 100644 --- a/src/include/86box/fdc.h +++ b/src/include/86box/fdc.h @@ -55,6 +55,8 @@ extern int fdc_type; #define FDC_FLAG_SEC 0x1000 /* Is Secondary */ #define FDC_FLAG_TER 0x2000 /* Is Tertiary */ #define FDC_FLAG_QUA 0x3000 /* Is Quaternary */ +#define FDC_FLAG_CHANNEL 0x3000 /* Channel mask */ +#define FDC_FLAG_NO_DSR_RESET 0x4000 /* Has no DSR reset */ typedef struct fdc_t { uint8_t dor; @@ -251,6 +253,7 @@ 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_ps1_device; +extern const device_t fdc_at_ps1_2121_device; extern const device_t fdc_at_smc_device; extern const device_t fdc_at_ali_device; extern const device_t fdc_at_winbond_device; diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index e0a15126e..34691773f 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -378,7 +378,7 @@ ps1_setup(int model) if (gfxcard[0] == VID_INTERNAL) device_add(&ibm_ps1_2121_device); - device_add(&fdc_at_ps1_device); + device_add(&fdc_at_ps1_2121_device); device_add(&ide_isa_device);