z80dart: add priority and irq vector for 8274 (nw)

This commit is contained in:
cracyc 2013-12-29 23:36:53 +00:00
parent 48b7ef9836
commit 0e95be33ee
3 changed files with 60 additions and 11 deletions

View File

@ -359,16 +359,58 @@ void z80dart_device::reset_interrupts()
void z80dart_device::trigger_interrupt(int index, int state)
{
UINT8 vector = m_chanB->m_wr[2];
int priority = (index << 2) | state;
int priority;
if((m_variant == TYPE_I8274) || (m_variant == TYPE_UPD7201))
{
int prio_level = 0;
switch(state)
{
case z80dart_channel::INT_TRANSMIT:
prio_level = 1;
break;
case z80dart_channel::INT_RECEIVE:
case z80dart_channel::INT_SPECIAL:
prio_level = 0;
break;
case z80dart_channel::INT_EXTERNAL:
prio_level = 2;
break;
}
if(m_chanA->m_wr[2] & z80dart_channel::WR2_PRIORITY)
{
priority = (prio_level * 2) + index;
}
else
{
priority = (prio_level == 2) ? index + 4 : ((index * 2) + prio_level);
}
if ((index == CHANNEL_B) && (m_chanB->m_wr[1] & z80dart_channel::WR1_STATUS_VECTOR))
{
vector = (!index << 2) | state;
if((m_chanA->m_wr[1] & 0x18) == z80dart_channel::WR2_MODE_8086_8088)
{
vector = (m_chanB->m_wr[2] & 0xf8) | vector;
}
else
{
vector = (m_chanB->m_wr[2] & 0xe3) | (vector << 2);
}
}
}
else
{
priority = (index << 2) | state;
if ((index == CHANNEL_B) && (m_chanB->m_wr[1] & z80dart_channel::WR1_STATUS_VECTOR))
{
// status affects vector
vector = (m_chanB->m_wr[2] & 0xf1) | (!index << 3) | (state << 1);
}
}
LOG(("Z80DART \"%s\" Channel %c : Interrupt Request %u\n", tag(), 'A' + index, state));
if ((index == CHANNEL_B) && (m_chanB->m_wr[1] & z80dart_channel::WR1_STATUS_VECTOR))
{
// status affects vector
vector = (m_chanB->m_wr[2] & 0xf1) | (!index << 3) | (state << 1);
}
// update vector register
m_chanB->m_rr[2] = vector;

View File

@ -51,6 +51,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(lpt_ack);
DECLARE_WRITE_LINE_MEMBER(isbc86_tmr2_w);
DECLARE_WRITE_LINE_MEMBER(isbc286_tmr2_w);
DECLARE_WRITE_LINE_MEMBER(isbc_uart8274_irq);
DECLARE_READ8_MEMBER(get_slave_ack);
DECLARE_READ8_MEMBER(ppi_b_r);
DECLARE_WRITE8_MEMBER(ppi_c_w);
@ -245,13 +246,19 @@ static I8274_INTERFACE(isbc_uart8274_interface)
DEVCB_NULL,
DEVCB_NULL,
DEVCB_DEVICE_LINE_MEMBER("pic_0", pic8259_device, ir6_w),
DEVCB_DRIVER_LINE_MEMBER(isbc_state, isbc_uart8274_irq),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL
};
WRITE_LINE_MEMBER(isbc_state::isbc_uart8274_irq)
{
m_uart8274->m1_r(); // always set
m_pic_0->ir6_w(state);
}
static const i8251_interface isbc_uart8251_interface =
{
DEVCB_DEVICE_LINE_MEMBER("terminal", serial_terminal_device, rx_w),

View File

@ -54,8 +54,8 @@ void isbc_215g_device::find_sector()
UINT16 isbc_215g_device::read_sector()
{
UINT16 bps = 64 << ((m_idcompare[0] >> 4) & 3);
if(m_secoffset >= bps)
UINT16 wps = 64 << ((m_idcompare[0] >> 4) & 3);
if(m_secoffset >= wps)
return 0;
return m_sector[m_secoffset++];
}
@ -314,7 +314,7 @@ WRITE8_MEMBER(isbc_215g_device::write)
if(!offset)
{
if(!data && (m_reset == 2))
m_dmac->reset();
m_dmac->reset();
m_out_irq_func(0);
m_dmac->ca_w(data != 2);
m_dmac->ca_w(0);