From 7b9456a0f6646b1d11800d4c0aa866dff760f751 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 28 Feb 2026 12:26:20 +0100 Subject: [PATCH] Fix the WIN_SPECIFY command on both IDE and AT MFM to not ignore the parameters when executed on an already initialized drive, fixes the IDE issues on the Philips P3345, also implemented the C&T P82C604 super I/O chip used by the Philips P3345 to control the serial and parallel ports, and gave the machine the IDE flag and on-board IDE again, fixes #6859. --- src/disk/hdc_ide.c | 10 ++++------ src/disk/hdc_st506_at.c | 19 +++++++------------ src/include/86box/sio.h | 2 ++ src/machine/m_at_386sx.c | 3 ++- src/machine/machine_table.c | 2 +- src/sio/CMakeLists.txt | 1 + 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 8b955c315..08a6cfeb1 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -2609,13 +2609,11 @@ ide_callback(void *priv) if (ide->type == IDE_ATAPI) err = ABRT_ERR; else { - /* Only accept after RESET or DIAG. */ - if (!ide->params_specified) { - ide->cfg_spt = (ide->tf->secount == 0) ? 256 : ide->tf->secount; - ide->cfg_hpc = ide->tf->head + 1; + ide->cfg_spt = (ide->tf->secount == 0) ? 256 : ide->tf->secount; + ide->cfg_hpc = ide->tf->head + 1; + + ide->params_specified = 1; - ide->params_specified = 1; - } ide->command = 0x00; ide->tf->atastat = DRDY_STAT | DSC_STAT; ide->tf->error = 1; diff --git a/src/disk/hdc_st506_at.c b/src/disk/hdc_st506_at.c index 5e50c44f0..d09fb7c23 100644 --- a/src/disk/hdc_st506_at.c +++ b/src/disk/hdc_st506_at.c @@ -690,18 +690,13 @@ write_error: * * We SHOULD check that here!! --FvK */ - if (drive->cfg_spt == 0) { - /* Only accept after RESET or DIAG. */ - drive->cfg_spt = mfm->secount; - drive->cfg_hpc = mfm->head + 1; - st506_at_log("WD1003(%d) parameters: tracks=%d, spt=%i, hpc=%i\n", - mfm->drvsel, drive->tracks, - drive->cfg_spt, drive->cfg_hpc); - } else { - st506_at_log("WD1003(%d) parameters: tracks=%d,spt=%i,hpc=%i (IGNORED)\n", - mfm->drvsel, drive->tracks, - drive->cfg_spt, drive->cfg_hpc); - } + drive->cfg_spt = mfm->secount; + drive->cfg_hpc = mfm->head + 1; + + st506_at_log("WD1003(%d) parameters: tracks=%d, spt=%i, hpc=%i\n", + mfm->drvsel, drive->tracks, + drive->cfg_spt, drive->cfg_hpc); + mfm->command = 0x00; mfm->status = STAT_READY | STAT_DSC; mfm->error = 1; diff --git a/src/include/86box/sio.h b/src/include/86box/sio.h index 9a6f3ac79..850c9d46e 100644 --- a/src/include/86box/sio.h +++ b/src/include/86box/sio.h @@ -27,6 +27,8 @@ extern const device_t f82c606_device; extern const device_t f82c710_device; extern const device_t f82c710_pc5086_device; +extern const device_t p82c604_device; + /* Commodore */ extern const device_t cbm_io_device; diff --git a/src/machine/m_at_386sx.c b/src/machine/m_at_386sx.c index 190443770..76fed2756 100644 --- a/src/machine/m_at_386sx.c +++ b/src/machine/m_at_386sx.c @@ -505,11 +505,12 @@ machine_at_p3345_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_common_init(model); + machine_at_common_ide_init(model); device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params); device_add(&neat_device); + device_add(&p82c604_device); if (fdc_current[0] == FDC_INTERNAL) device_add(&fdc_at_device); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index d6bbb0ee7..de3d2a88c 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -6184,7 +6184,7 @@ const machine_t machines[] = { .max_multi = 0 }, .bus_flags = MACHINE_AT, - .flags = 0, + .flags = MACHINE_IDE, .ram = { .min = 2048, .max = 8192, diff --git a/src/sio/CMakeLists.txt b/src/sio/CMakeLists.txt index b2ca643cf..84dbb1e04 100644 --- a/src/sio/CMakeLists.txt +++ b/src/sio/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(sio OBJECT sio_fdc37c93x.c sio_fdc37m60x.c sio_it86x1f.c + sio_p82c604.c sio_pc87310.c sio_pc873xx.c sio_pc87306.c