From 2b655f7c86a9e9b84757bf81ab31d907eda6823d Mon Sep 17 00:00:00 2001 From: cracyc Date: Sat, 10 Feb 2018 15:44:31 -0600 Subject: am9519: fix a bit (nw) --- src/devices/machine/am9519.cpp | 24 +++++++++++++----------- src/mame/drivers/olyboss.cpp | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/devices/machine/am9519.cpp b/src/devices/machine/am9519.cpp index 99fde6fc1c1..47799ff0480 100644 --- a/src/devices/machine/am9519.cpp +++ b/src/devices/machine/am9519.cpp @@ -1,6 +1,8 @@ // license:BSD-3-Clause // copyright-holders:Wilbert Pol,Carl +//TODO: rotating priority, cascade + #include "emu.h" #include "machine/am9519.h" @@ -19,20 +21,18 @@ void am9519_device::device_timer(emu_timer &timer, device_timer_id id, int param { u8 mask = 1 << irq; - /* is this IRQ in service and not cascading and sfnm? */ + /* is this IRQ in service */ if(m_isr & mask) { - LOG("am9519_timerproc(): PIC IRQ #%d still in service\n", irq); + LOG("am9519_timerproc(): UIC IRQ #%d still in service\n", irq); break; } - bool active = !(BIT(m_mode, 4) ^ BIT(m_irr, irq)); - /* is this IRQ pending and enabled? */ - if(active && !(m_imr & mask)) + if((m_irr & mask) && !(m_imr & mask)) { - LOG("am9519_timerproc(): PIC triggering IRQ #%d\n", irq); - if(BIT(m_mode, 4)) + LOG("am9519_timerproc(): UIC triggering IRQ #%d\n", irq); + if(!BIT(m_mode, 2)) m_out_int_func(1); return; } @@ -44,11 +44,12 @@ void am9519_device::device_timer(emu_timer &timer, device_timer_id id, int param void am9519_device::set_irq_line(int irq, int state) { u8 mask = (1 << irq); + bool active = !((state == ASSERT_LINE ? 1 : 0) ^ BIT(m_mode, 4)); - if(state) + if(active) { /* setting IRQ line */ - LOG("am9519_set_irq_line(): PIC set IRQ line #%d\n", irq); + LOG("am9519_set_irq_line(): UIC set IRQ line #%d\n", irq); if(!(m_irq_lines & mask)) // edge trig only m_irr |= mask; @@ -57,7 +58,7 @@ void am9519_device::set_irq_line(int irq, int state) else { /* clearing IRQ line */ - LOG("am9519_device::set_irq_line(): PIC cleared IRQ line #%d\n", irq); + LOG("am9519_device::set_irq_line(): UIC cleared IRQ line #%d\n", irq); m_irq_lines &= ~mask; m_irr &= ~mask; @@ -75,11 +76,12 @@ u32 am9519_device::acknowledge() /* is this IRQ pending and enabled? */ if((m_irr & mask) && !(m_imr & mask)) { - LOG("am9519_acknowledge(): PIC acknowledge IRQ #%d\n", irq); + LOG("am9519_acknowledge(): UIC acknowledge IRQ #%d\n", irq); if(!(mask & m_aclear)) m_isr |= mask; + m_irr &= ~mask; set_timer(); u32 ret = 0; diff --git a/src/mame/drivers/olyboss.cpp b/src/mame/drivers/olyboss.cpp index 843bb2d08cc..396c9f08e51 100644 --- a/src/mame/drivers/olyboss.cpp +++ b/src/mame/drivers/olyboss.cpp @@ -313,6 +313,7 @@ MACHINE_CONFIG_START( olyboss_state::olybossd ) MCFG_UPD3301_CHARACTER_WIDTH(8) MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(olyboss_state, olyboss_display_pixels) MCFG_UPD3301_DRQ_CALLBACK(DEVWRITELINE(I8257_TAG, i8257_device, dreq2_w)) + MCFG_UPD3301_INT_CALLBACK(DEVWRITELINE("uic", am9519_device, ireq0_w)) MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) /* keyboard */ -- cgit v1.2.3