summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/sharc/sharc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/sharc/sharc.cpp')
-rw-r--r--src/devices/cpu/sharc/sharc.cpp53
1 files changed, 46 insertions, 7 deletions
diff --git a/src/devices/cpu/sharc/sharc.cpp b/src/devices/cpu/sharc/sharc.cpp
index ded941af415..e3b965eb25d 100644
--- a/src/devices/cpu/sharc/sharc.cpp
+++ b/src/devices/cpu/sharc/sharc.cpp
@@ -10,8 +10,6 @@
#include "sharcfe.h"
#include "sharcdsm.h"
-#include "debugger.h"
-
#define DISABLE_FAST_REGISTERS 1
@@ -343,7 +341,10 @@ void adsp21062_device::iop_w(offs_t offset, uint32_t data)
case 0x1c:
{
m_core->dma[6].control = data;
- sharc_iop_delayed_w(0x1c, data, 1);
+ if (data & 0x1)
+ {
+ sharc_iop_delayed_w(0x1c, data, 1);
+ }
break;
}
@@ -362,7 +363,10 @@ void adsp21062_device::iop_w(offs_t offset, uint32_t data)
case 0x1d:
{
m_core->dma[7].control = data;
- sharc_iop_delayed_w(0x1d, data, 30);
+ if (data & 0x1)
+ {
+ sharc_iop_delayed_w(0x1d, data, 30);
+ }
break;
}
@@ -576,7 +580,7 @@ void adsp21062_device::device_start()
m_core->cache_dirty = 1;
- m_core->delayed_iop_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adsp21062_device::sharc_iop_delayed_write_callback), this));
+ m_core->delayed_iop_timer = timer_alloc(FUNC(adsp21062_device::sharc_iop_delayed_write_callback), this);
for (auto & elem : m_core->dma_op)
{
@@ -590,7 +594,7 @@ void adsp21062_device::device_start()
elem.pmode = 0;
elem.chained_direction = 0;
elem.active = false;
- elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adsp21062_device::sharc_dma_callback), this));
+ elem.timer = timer_alloc(FUNC(adsp21062_device::sharc_dma_callback), this);
}
for (int i=0; i < 16; i++)
@@ -972,6 +976,19 @@ void adsp21062_device::set_flag_input(int flag_num, int state)
}
}
+void adsp21062_device::write_stall(int state)
+{
+ m_core->write_stalled = (state == 0) ? false : true;
+
+ if (m_enable_drc)
+ {
+ if (m_core->write_stalled)
+ spin_until_trigger(45757);
+ else
+ machine().scheduler().trigger(45757);
+ }
+}
+
void adsp21062_device::check_interrupts()
{
int i;
@@ -1028,8 +1045,24 @@ void adsp21062_device::execute_run()
}
else
{
+ if (m_core->write_stalled)
+ eat_cycles(m_core->icount);
+
if (m_core->idle && m_core->irq_pending == 0)
{
+ int dma_count = m_core->icount;
+
+ // run active DMAs even while idling
+ while (dma_count > 0 && m_core->dma_status & ((1 << 6) | (1 << 7)))
+ {
+ if (!m_core->write_stalled)
+ {
+ dma_run_cycle(6);
+ dma_run_cycle(7);
+ }
+ dma_count--;
+ }
+
m_core->icount = 0;
debugger_instruction_hook(m_core->daddr);
}
@@ -1039,7 +1072,7 @@ void adsp21062_device::execute_run()
m_core->idle = 0;
}
- while (m_core->icount > 0 && !m_core->idle)
+ while (m_core->icount > 0 && !m_core->idle && !m_core->write_stalled)
{
m_core->pc = m_core->daddr;
m_core->daddr = m_core->faddr;
@@ -1126,6 +1159,12 @@ void adsp21062_device::execute_run()
}
}
+ if (!m_core->write_stalled)
+ {
+ dma_run_cycle(6);
+ dma_run_cycle(7);
+ }
+
--m_core->icount;
};
}