ESDI/MFM AT changes:

Make sure they IRQ activations are more IDE-like and correct.
This commit is contained in:
TC1995
2024-03-01 19:26:32 +01:00
parent d77fc47408
commit ff6964f73d
2 changed files with 31 additions and 27 deletions

View File

@@ -129,23 +129,24 @@ esdi_at_log(const char *fmt, ...)
static __inline void
irq_raise(esdi_t *esdi)
{
if (!(esdi->fdisk & 2))
picint(1 << 14);
esdi->irqstat = 1;
if (!(esdi->fdisk & 2))
picint_common(1 << 14, PIC_IRQ_EDGE, 1, NULL);
}
static __inline void
irq_lower(UNUSED(esdi_t *esdi))
irq_lower(esdi_t *esdi)
{
picintc(1 << 14);
esdi->irqstat = 0;
if (!(esdi->fdisk & 2))
picint_common(1 << 14, PIC_IRQ_EDGE, 0, NULL);
}
static __inline void
irq_update(UNUSED(esdi_t *esdi))
irq_update(esdi_t *esdi)
{
if (esdi->irqstat && !((pic2.irr | pic2.isr) & 0x40) && !(esdi->fdisk & 2))
picint(1 << 14);
uint8_t set = !(esdi->fdisk & 2) && esdi->irqstat;
picint_common(1 << 14, PIC_IRQ_EDGE, set, NULL);
}
static void
@@ -263,6 +264,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv)
double seek_time;
double xfer_time;
off64_t addr;
uint8_t old;
esdi_at_log("WD1007 write(%04x, %02x)\n", port, val);
@@ -411,15 +413,15 @@ esdi_write(uint16_t port, uint8_t val, void *priv)
esdi_set_callback(esdi, 500 * HDC_TIME);
esdi->reset = 1;
esdi->status = STAT_BUSY;
}
if (val & 0x04) {
} else if (!(esdi->fdisk & 0x04) && (val & 0x04)) {
/* Drive held in reset. */
esdi_set_callback(esdi, 0);
esdi->status = STAT_BUSY;
}
old = esdi->fdisk;
esdi->fdisk = val;
irq_update(esdi);
if (!(val & 0x02) && (old & 0x02))
irq_update(esdi);
break;
default: