summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2011-06-01 10:39:43 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2011-06-01 10:39:43 +0000
commite32cd1f5ec0e9b0e807eb2fdd7ecac6fe99ae677 (patch)
treef78a17c87c7e07f1d1b3f6565fa7ffb2d9c19b81
parentd966fe3e0d25f628b38def357e3c8e4b76c2ecdf (diff)
pic8259 - Fixed edge triggering and non-specific EOI [Carl, Miodrag Milanovic]
-rw-r--r--src/emu/machine/pic8259.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/emu/machine/pic8259.c b/src/emu/machine/pic8259.c
index 753ce1a0b4d..5849f243de7 100644
--- a/src/emu/machine/pic8259.c
+++ b/src/emu/machine/pic8259.c
@@ -47,6 +47,7 @@ struct pic8259
UINT8 irr;
UINT8 prio;
UINT8 imr;
+ UINT8 irq_lines;
UINT8 input;
UINT8 ocw3;
@@ -124,6 +125,7 @@ INLINE void pic8259_set_timer(pic8259_t *pic8259)
static void pic8259_set_irq_line(device_t *device, int irq, int state)
{
pic8259_t *pic8259 = get_safe_token(device);
+ UINT8 mask = (1 << irq);
if (state)
{
@@ -131,7 +133,9 @@ static void pic8259_set_irq_line(device_t *device, int irq, int state)
if (LOG_GENERAL)
logerror("pic8259_set_irq_line(): PIC set IRQ line #%d\n", irq);
- pic8259->irr |= 1 << irq;
+ if(pic8259->level_trig_mode || (!pic8259->level_trig_mode && !(pic8259->irq_lines & mask)))
+ pic8259->irr |= mask;
+ pic8259->irq_lines |= mask;
}
else
{
@@ -139,7 +143,8 @@ static void pic8259_set_irq_line(device_t *device, int irq, int state)
if (LOG_GENERAL)
logerror("pic8259_set_irq_line(): PIC cleared IRQ line #%d\n", irq);
- pic8259->irr &= ~(1 << irq);
+ pic8259->irq_lines &= ~mask;
+ pic8259->irr &= ~mask;
}
pic8259_set_timer(pic8259);
@@ -304,6 +309,7 @@ WRITE8_DEVICE_HANDLER( pic8259_w )
if (pic8259->isr & mask)
{
pic8259->isr &= ~mask;
+ pic8259->irr &= ~mask;
break;
}
}
@@ -423,6 +429,7 @@ static DEVICE_RESET( pic8259 ) {
pic8259->state = STATE_READY;
pic8259->isr = 0;
pic8259->irr = 0;
+ pic8259->irq_lines = 0;
pic8259->prio = 0;
pic8259->imr = 0;
pic8259->input = 0;