PC87309: Actually fix relocation so it's implemented according to the PC87309 datasheet, not the PC87306 one.

This commit is contained in:
OBattler
2025-05-18 20:48:29 +02:00
parent e79b8e1c35
commit a262a519cb

View File

@@ -116,12 +116,16 @@ superio_handler(pc87309_t *dev)
io_removehandler(0x02e, 0x0002,
pc87309_read, NULL, NULL, pc87309_write, NULL, NULL, dev);
switch (dev->baddr) {
case 2:
switch (dev->regs[0x21] & 0x0b) {
case 0x02:
case 0x08:
case 0x0a:
io_sethandler(0x15c, 0x0002,
pc87309_read, NULL, NULL, pc87309_write, NULL, NULL, dev);
break;
case 3:
case 0x03:
case 0x09:
case 0x0b:
io_sethandler(0x02e, 0x0002,
pc87309_read, NULL, NULL, pc87309_write, NULL, NULL, dev);
break;
@@ -218,10 +222,10 @@ pc87309_write(uint16_t port, uint8_t val, void *priv)
case 0x07:
case 0x21:
dev->regs[dev->cur_reg] = val;
superio_handler(dev);
break;
case 0x22:
dev->regs[dev->cur_reg] = val & 0x7f;
superio_handler(dev);
break;
default:
if (dev->cur_reg >= 0x30) {
@@ -403,8 +407,7 @@ pc87309_reset(pc87309_t *dev)
memset(dev->pm, 0x00, 0x08);
dev->regs[0x20] = dev->id;
dev->regs[0x21] = 0x04;
dev->regs[0x22] = dev->baddr;
dev->regs[0x21] = 0x04 | dev->baddr;
dev->ld_regs[0x00][0x01] = 0x01;
dev->ld_regs[0x00][0x30] = 0x03;
@@ -500,7 +503,7 @@ pc87309_init(const device_t *info)
dev->fdc = device_add(&fdc_at_nsc_device);
dev->baddr = (info->local & 0x100) ? 2 : 3;
dev->baddr = (info->local & 0x100) ? 8 : 9;
pc87309_reset(dev);