From 60058283ebaa0e92de398602a110eb9391df7185 Mon Sep 17 00:00:00 2001 From: SarahW Date: Fri, 17 May 2019 20:15:09 +0100 Subject: [PATCH] Disable FDC when enabling W83877TF config registers at 0x3f0, to prevent bus conflicts. Fixes duplicate FDC/COM/LPT ports on VA-503+. --- src/w83877tf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/w83877tf.c b/src/w83877tf.c index 78c2a63..17e80f1 100644 --- a/src/w83877tf.c +++ b/src/w83877tf.c @@ -138,12 +138,21 @@ static void w83877tf_write_3fx(uint16_t port, uint8_t val, void *p) { case 0x3f0: /*Enable/index register*/ if (val == 0xaa) + { + fdc_remove(); + if (w83877tf->enable_regs && w83877tf->regs[0x20] >= 0x40) + fdc_add(); w83877tf->enable_regs = 0; + } else if (!w83877tf->enable_regs) { w83877tf->key[1] = w83877tf->key[0]; w83877tf->key[0] = val; w83877tf->enable_regs = (w83877tf->key[0] == 0x87 && w83877tf->key[1] == 0x87); + /*The FDC conflicts with the 3fx config registers, so disable + it when enabling config registers*/ + if (w83877tf->enable_regs) + fdc_remove(); } else w83877tf->index = val;