i186: make drq level triggered (nw)

This commit is contained in:
cracyc 2019-02-12 19:08:26 -06:00
parent e32118eccb
commit 6f35b941d5
2 changed files with 20 additions and 2 deletions

View File

@ -173,6 +173,22 @@ void i80186_cpu_device::execute_run()
{
while(m_icount > 0 )
{
if((m_dma[0].drq_state && (m_dma[0].control & ST_STOP)) || (m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
{
int channel = m_last_dma ? 0 : 1;
m_last_dma = !m_last_dma;
if(!(m_dma[1].drq_state && (m_dma[1].control & ST_STOP)))
channel = 0;
else if(!(m_dma[0].drq_state && (m_dma[0].control & ST_STOP)))
channel = 1;
else if((m_dma[0].control & CHANNEL_PRIORITY) && !(m_dma[1].control & CHANNEL_PRIORITY))
channel = 0;
else if((m_dma[1].control & CHANNEL_PRIORITY) && !(m_dma[0].control & CHANNEL_PRIORITY))
channel = 1;
m_icount--;
drq_callback(channel);
continue;
}
if ( m_seg_prefix_next )
{
m_seg_prefix = true;
@ -627,6 +643,7 @@ void i80186_cpu_device::device_start()
save_item(NAME(m_mem.middle_size));
save_item(NAME(m_mem.peripheral));
save_item(NAME(m_reloc));
save_item(NAME(m_last_dma));
// zerofill
memset(m_timer, 0, sizeof(m_timer));

View File

@ -22,8 +22,8 @@ public:
auto tmrout1_handler() { return m_out_tmrout1_func.bind(); }
IRQ_CALLBACK_MEMBER(int_callback);
DECLARE_WRITE_LINE_MEMBER(drq0_w) { if(state) drq_callback(0); m_dma[0].drq_state = state; }
DECLARE_WRITE_LINE_MEMBER(drq1_w) { if(state) drq_callback(1); m_dma[1].drq_state = state; }
DECLARE_WRITE_LINE_MEMBER(drq0_w) { m_dma[0].drq_state = state; }
DECLARE_WRITE_LINE_MEMBER(drq1_w) { m_dma[1].drq_state = state; }
DECLARE_WRITE_LINE_MEMBER(tmrin0_w) { if(state && (m_timer[0].control & 0x8004) == 0x8004) { inc_timer(0); } }
DECLARE_WRITE_LINE_MEMBER(tmrin1_w) { if(state && (m_timer[1].control & 0x8004) == 0x8004) { inc_timer(1); } }
DECLARE_WRITE_LINE_MEMBER(int0_w) { external_int(0, state); }
@ -132,6 +132,7 @@ private:
dma_state m_dma[2];
intr_state m_intr;
mem_state m_mem;
bool m_last_dma;
static const device_timer_id TIMER_INT0 = 0;
static const device_timer_id TIMER_INT1 = 1;