summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/cosmac/cosmac.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/cosmac/cosmac.cpp')
-rw-r--r--src/devices/cpu/cosmac/cosmac.cpp54
1 files changed, 40 insertions, 14 deletions
diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp
index 6b9c866c92e..eb1b73397ac 100644
--- a/src/devices/cpu/cosmac/cosmac.cpp
+++ b/src/devices/cpu/cosmac/cosmac.cpp
@@ -365,6 +365,9 @@ cosmac_device::cosmac_device(const machine_config &mconfig, device_type type, co
m_io_config("io", ENDIANNESS_LITTLE, 8, 3),
m_read_wait(*this, 0),
m_read_clear(*this, 0),
+ m_read_int(*this, 0),
+ m_read_dma_in(*this, 0),
+ m_read_dma_out(*this, 0),
m_read_ef(*this, 0),
m_write_q(*this),
m_read_dma(*this, 0),
@@ -740,17 +743,6 @@ uint32_t cosmac_device::execute_max_cycles() const noexcept
//-------------------------------------------------
-// execute_input_lines - return the number of
-// input/interrupt lines
-//-------------------------------------------------
-
-uint32_t cosmac_device::execute_input_lines() const noexcept
-{
- return 7;
-}
-
-
-//-------------------------------------------------
// execute_set_input -
//-------------------------------------------------
@@ -807,7 +799,7 @@ void cosmac_device::execute_run()
// execute initialization cycle
m_state = cosmac_state::STATE_1_INIT;
- run();
+ run_state();
// next state is IDLE
m_state = cosmac_state::STATE_1_EXECUTE;
@@ -823,11 +815,13 @@ void cosmac_device::execute_run()
break;
case cosmac_mode::RESET:
+ debugger_wait_hook();
reset_state();
m_icount--;
break;
case cosmac_mode::PAUSE:
+ debugger_wait_hook();
m_icount--;
break;
@@ -917,7 +911,7 @@ inline void cosmac_device::run_state()
inline void cosmac_device::debug()
{
- if ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) && m_state == cosmac_state::STATE_0_FETCH)
+ if (debugger_enabled() && m_state == cosmac_state::STATE_0_FETCH)
{
debugger_instruction_hook(R[P]);
}
@@ -939,6 +933,28 @@ inline void cosmac_device::sample_wait_clear()
//-------------------------------------------------
+// sample_interrupt - sample interrupt line
+//-------------------------------------------------
+
+bool cosmac_device::sample_interrupt()
+{
+ if (!m_read_int.isunset()) m_irq = m_read_int();
+ return bool(m_irq);
+}
+
+
+//-------------------------------------------------
+// sample_dma_io - sample dma in/out lines
+//-------------------------------------------------
+
+inline void cosmac_device::sample_dma_io()
+{
+ if (!m_read_dma_in.isunset()) m_dmain = m_read_dma_in();
+ if (!m_read_dma_out.isunset()) m_dmaout = m_read_dma_out();
+}
+
+
+//-------------------------------------------------
// sample_ef_lines - sample EF input lines
//-------------------------------------------------
@@ -1111,6 +1127,8 @@ inline void cosmac_device::initialize()
m_icount -= CLOCKS_INIT;
+ sample_dma_io();
+
if (m_dmain)
{
m_state = cosmac_state::STATE_2_DMA_IN;
@@ -1139,6 +1157,8 @@ inline void cosmac_device::execute_instruction()
m_icount -= CLOCKS_EXECUTE;
+ sample_dma_io();
+
if (m_state == cosmac_state::STATE_1_EXECUTE && (m_op >> 4) == 0xc) // "long" opcodes
{
m_state = cosmac_state::STATE_1_EXECUTE_2ND;
@@ -1175,6 +1195,8 @@ inline void cosmac_device::dma_input()
m_icount -= CLOCKS_DMA;
+ sample_dma_io();
+
if (m_dmain)
{
m_state = cosmac_state::STATE_2_DMA_IN;
@@ -1211,6 +1233,8 @@ inline void cosmac_device::dma_output()
m_icount -= CLOCKS_DMA;
+ sample_dma_io();
+
if (m_dmain)
{
m_state = cosmac_state::STATE_2_DMA_IN;
@@ -1248,6 +1272,8 @@ inline void cosmac_device::interrupt()
m_icount -= CLOCKS_INTERRUPT;
+ sample_dma_io();
+
if (m_dmain)
{
m_state = cosmac_state::STATE_2_DMA_IN;
@@ -1479,7 +1505,7 @@ void cosmac_device::rsxd() { RAM_W(R[X], R[N] & 0xff); R[X]--; RAM_W(R[X], R[N]
void cosmac_device::rnx() { R[X] = R[N]; }
void cosmac_device::bci() { short_branch(m_cil); m_cil = 0; }
-void cosmac_device::bxi() { short_branch(m_irq); }
+void cosmac_device::bxi() { short_branch(sample_interrupt()); }
void cosmac_device::xie() { m_xie = 1; }
void cosmac_device::xid() { m_xie = 0; }