From 8fe4decd95092fbb9ec13dacfe154aa9444c1eb3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 29 Apr 2021 07:36:16 +0200 Subject: [PATCH] More PS/1 model 2133 fixes. --- src/include/86box/sio.h | 1 + src/machine/m_ps1.c | 8 +++++--- src/sio/sio_pc87332.c | 20 ++++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/include/86box/sio.h b/src/include/86box/sio.h index ed207aad7..ec94f5404 100644 --- a/src/include/86box/sio.h +++ b/src/include/86box/sio.h @@ -52,6 +52,7 @@ extern const device_t pc87311_ide_device; extern const device_t pc87332_device; extern const device_t pc87332_398_device; extern const device_t pc87332_398_ide_device; +extern const device_t pc87332_398_ide_fdcon_device; extern const device_t pc97307_device; extern const device_t prime3b_device; extern const device_t prime3b_ide_device; diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index 0bf79a221..2d51c5edb 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -460,6 +460,8 @@ ps1_setup(int model) mem_remap_top(384); + device_add(&ps_nvr_device); + if (model == 2011) { rom_init(&ps->high_rom, "roms/machines/ibmps1es/f80000.bin", @@ -511,8 +513,6 @@ ps1_common_init(const machine_t *model) dma16_init(); pic2_init(); - device_add(&ps_nvr_device); - device_add(&keyboard_ps2_ps1_device); /* Audio uses ports 200h and 202-207h, so only initialize gameport on 201h. */ @@ -571,9 +571,11 @@ machine_ps1_m2133_init(const machine_t *model) return ret; ps1_common_init(model); + /* The PS/1 model 2133 expects a NVR without the century register. */ device_add(&ide_isa_device); + device_add(&at_nvr_old_device); + device_add(&pc87332_398_ide_fdcon_device); device_add(&vl82c480_device); - device_add(&pc87332_398_device); nmi_mask = 0x80; diff --git a/src/sio/sio_pc87332.c b/src/sio/sio_pc87332.c index b3fd1d5ca..267de0543 100644 --- a/src/sio/sio_pc87332.c +++ b/src/sio/sio_pc87332.c @@ -37,7 +37,7 @@ typedef struct { uint8_t tries, has_ide, - regs[15]; + fdc_on, regs[15]; int cur_reg; fdc_t *fdc; serial_t *uart[2]; @@ -273,9 +273,9 @@ pc87332_reset(pc87332_t *dev) { memset(dev->regs, 0, 15); - dev->regs[0x00] = 0x07; + dev->regs[0x00] = dev->fdc_on ? 0x4f : 0x07; if (dev->has_ide == 2) - dev->regs[0x00] = 0x87; + dev->regs[0x00] |= 0x80; dev->regs[0x01] = 0x10; dev->regs[0x03] = 0x01; dev->regs[0x05] = 0x0D; @@ -292,7 +292,8 @@ pc87332_reset(pc87332_t *dev) serial_handler(dev, 0); serial_handler(dev, 1); fdc_reset(dev->fdc); - fdc_remove(dev->fdc); + if (!dev->fdc_on) + fdc_remove(dev->fdc); if (dev->has_ide) ide_handler(dev); @@ -320,6 +321,7 @@ pc87332_init(const device_t *info) dev->uart[1] = device_add_inst(&ns16550_device, 2); dev->has_ide = (info->local >> 8) & 0xff; + dev->fdc_on = (info->local >> 16) & 0xff; pc87332_reset(dev); if ((info->local & 0xff) == (0x01)) { @@ -362,3 +364,13 @@ const device_t pc87332_398_ide_device = { { NULL }, NULL, NULL, NULL }; + + +const device_t pc87332_398_ide_fdcon_device = { + "National Semiconductor PC87332 Super I/O (Port 398h) (With IDE and FDC on)", + 0, + 0x10101, + pc87332_init, pc87332_close, NULL, + { NULL }, NULL, NULL, + NULL +};