diff --git a/src/include/86box/sio.h b/src/include/86box/sio.h index b66b600de..a06c95cdb 100644 --- a/src/include/86box/sio.h +++ b/src/include/86box/sio.h @@ -30,6 +30,7 @@ extern const device_t i82091aa_device; extern const device_t i82091aa_ide_device; extern const device_t pc87306_device; extern const device_t pc87307_device; +extern const device_t pc87307_15c_device; extern const device_t pc87309_device; extern const device_t pc87332_device; extern const device_t pc87332_ps1_device; diff --git a/src/sio/sio_pc87307.c b/src/sio/sio_pc87307.c index 0a1578c76..787a540f2 100644 --- a/src/sio/sio_pc87307.c +++ b/src/sio/sio_pc87307.c @@ -157,7 +157,7 @@ fdc_handler(pc87307_t *dev) addr = ((dev->ld_regs[0x03][0x30] << 8) | dev->ld_regs[0x03][0x31]) - 0x0002; irq = (dev->ld_regs[0x03][0x40] & 0x0f); - if (active && (addr <= 0xfff2)) { + if (active && (addr <= 0xfff8)) { fdc_set_base(dev->fdc, addr); fdc_set_irq(dev->fdc, irq); } @@ -322,7 +322,7 @@ pc87307_write(uint16_t port, uint8_t val, void *priv) dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfb; break; case 0x03: - dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfa; + dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = (val & 0xfa) | 0x02; fdc_handler(dev); break; case 0x04: @@ -542,8 +542,13 @@ pc87307_init(const device_t *info) pc87307_reset(dev); - io_sethandler(0x02e, 0x0002, - pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev); + if (info->local & 0x100) { + io_sethandler(0x15c, 0x0002, + pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev); + } else { + io_sethandler(0x02e, 0x0002, + pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev); + } return dev; } @@ -559,6 +564,16 @@ const device_t pc87307_device = { }; +const device_t pc87307_15c_device = { + "National Semiconductor PC87307 Super I/O (Port 15Ch)", + 0, + 0x1c0, + pc87307_init, pc87307_close, NULL, + NULL, NULL, NULL, + NULL +}; + + const device_t pc97307_device = { "National Semiconductor PC97307 Super I/O", 0, diff --git a/src/sio/sio_pc87309.c b/src/sio/sio_pc87309.c index 0b55b9655..42dfb4f8c 100644 --- a/src/sio/sio_pc87309.c +++ b/src/sio/sio_pc87309.c @@ -255,7 +255,7 @@ pc87309_write(uint16_t port, uint8_t val, void *priv) case 0x61: switch (dev->regs[0x07]) { case 0x00: - dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfa; + dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = (val & 0xfa) | 0x02; fdc_handler(dev); break; case 0x01: