From a4301708dac41d681b79cfd9702aa567ce59429e Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 29 Jun 2020 18:44:20 +0200 Subject: [PATCH] Added the OPTi 802G device (the 802G and 895 are register-identical), and added port 23h to the OPTi 8xx'es. --- src/chipset/opti895.c | 36 ++++++++++++++++++++++++++++++++++-- src/include/86box/chipset.h | 1 + 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/chipset/opti895.c b/src/chipset/opti895.c index bcdd43f38..32fd30bac 100644 --- a/src/chipset/opti895.c +++ b/src/chipset/opti895.c @@ -144,7 +144,17 @@ opti895_write(uint16_t addr, uint8_t val, void *priv) case 0x22: dev->idx = val; break; + case 0x23: + if (dev->idx != 0x01) + break; + + dev->regs[dev->idx] = val; + opti895_log("dev->regs[%04x] = %08x\n", dev->idx, val); + break; case 0x24: + if (dev->idx == 0x01) + break; + dev->regs[dev->idx] = val; opti895_log("dev->regs[%04x] = %08x\n", dev->idx, val); @@ -194,7 +204,16 @@ opti895_read(uint16_t addr, void *priv) opti895_t *dev = (opti895_t *) priv; switch (addr) { + case 0x23: + if (dev->idx != 0x01) + break; + + ret = dev->regs[dev->idx]; + break; case 0x24: + if (dev->idx == 0x01) + break; + ret = dev->regs[dev->idx]; if (dev->idx == 0xe0) ret = (ret & 0xf6) | (in_smm ? 0x00 : 0x08) | !!dev->forced_green; @@ -226,11 +245,12 @@ opti895_init(const device_t *info) device_add(&port_92_device); - io_sethandler(0x0022, 0x0001, opti895_read, NULL, NULL, opti895_write, NULL, NULL, dev); - io_sethandler(0x0024, 0x0001, opti895_read, NULL, NULL, opti895_write, NULL, NULL, dev); + io_sethandler(0x0022, 0x0003, opti895_read, NULL, NULL, opti895_write, NULL, NULL, dev); dev->scratch[0] = dev->scratch[1] = 0xff; + dev->regs[0x01] = 0xc0; + dev->regs[0x22] = 0xc4; dev->regs[0x25] = 0x7c; dev->regs[0x26] = 0x10; @@ -241,6 +261,8 @@ opti895_init(const device_t *info) dev->regs[0x2b] = 0x10; dev->regs[0x2d] = 0xc0; + dev->regs[0xe8] = 0x08; + dev->regs[0xe9] = 0x08; dev->regs[0xeb] = 0xff; dev->regs[0xef] = 0x40; @@ -262,6 +284,16 @@ opti895_init(const device_t *info) } +const device_t opti802g_device = { + "OPTi 82C802G", + 0, + 0, + opti895_init, opti895_close, NULL, + NULL, NULL, NULL, + NULL +}; + + const device_t opti895_device = { "OPTi 82C895", 0, diff --git a/src/include/86box/chipset.h b/src/include/86box/chipset.h index 2a0d00f1a..84661e3cb 100644 --- a/src/include/86box/chipset.h +++ b/src/include/86box/chipset.h @@ -61,6 +61,7 @@ extern const device_t ioapic_device; /* OPTi */ extern const device_t opti495_device; +extern const device_t opti802g_device; extern const device_t opti895_device; extern const device_t opti5x7_device;