summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/saturn/saturn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/saturn/saturn.cpp')
-rw-r--r--src/devices/cpu/saturn/saturn.cpp59
1 files changed, 25 insertions, 34 deletions
diff --git a/src/devices/cpu/saturn/saturn.cpp b/src/devices/cpu/saturn/saturn.cpp
index 14b05baf3dd..4ca7d0aadc7 100644
--- a/src/devices/cpu/saturn/saturn.cpp
+++ b/src/devices/cpu/saturn/saturn.cpp
@@ -12,7 +12,9 @@
#include "emu.h"
#include "saturn.h"
-#include "debugger.h"
+
+//#define VERBOSE 1
+#include "logmacro.h"
#define R0 0
@@ -27,10 +29,6 @@
#define I 9 // invalid
-//#define VERBOSE 1
-#include "logmacro.h"
-
-
// Hardware status bits
#define XM 1 // external Modules missing
#define SB 2 // Sticky bit
@@ -46,22 +44,24 @@ saturn_device::saturn_device(const machine_config &mconfig, const char *tag, dev
: cpu_device(mconfig, SATURN, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 20, 0)
, m_out_func(*this)
- , m_in_func(*this)
+ , m_in_func(*this, 0)
, m_reset_func(*this)
, m_config_func(*this)
, m_unconfig_func(*this)
- , m_id_func(*this)
+ , m_id_func(*this, 0)
, m_crc_func(*this)
- , m_rsi_func(*this), m_pc(0), m_oldpc(0), m_p(0), m_out(0), m_carry(0), m_decimal(0), m_st(0), m_hst(0), m_nmi_state(0), m_irq_state(0), m_irq_enable(0), m_in_irq(0),
- m_pending_irq(0), m_sleeping(0), m_monitor_id(0), m_monitor_in(0), m_program(nullptr), m_cache(nullptr), m_icount(0), m_debugger_temp(0)
+ , m_rsi_func(*this)
+ , m_pc(0), m_oldpc(0), m_p(0), m_out(0), m_carry(0), m_decimal(0), m_st(0), m_hst(0)
+ , m_nmi_state(0), m_irq_state(0), m_irq_enable(0), m_in_irq(0), m_pending_irq(0)
+ , m_sleeping(0), m_monitor_id(0), m_monitor_in(0)
+ , m_icount(0)
+ , m_debugger_temp(0)
{
}
device_memory_interface::space_config_vector saturn_device::memory_space_config() const
{
- return space_config_vector {
- std::make_pair(AS_PROGRAM, &m_program_config)
- };
+ return space_config_vector{ std::make_pair(AS_PROGRAM, &m_program_config) };
}
bool saturn_device::get_nonstandard_mnemonics_mode() const
@@ -81,8 +81,8 @@ std::unique_ptr<util::disasm_interface> saturn_device::create_disassembler()
* include the opcode macros, functions and tables
***************************************************************/
-#include "satops.hxx"
-#include "sattable.hxx"
+#include "satops.ipp"
+#include "sattable.ipp"
/*****************************************************************************
*
@@ -92,17 +92,8 @@ std::unique_ptr<util::disasm_interface> saturn_device::create_disassembler()
void saturn_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
-
- m_out_func.resolve_safe();
- m_in_func.resolve_safe(0);
- m_reset_func.resolve_safe();
- m_config_func.resolve_safe();
- m_unconfig_func.resolve_safe();
- m_id_func.resolve_safe(0);
- m_crc_func.resolve_safe();
- m_rsi_func.resolve_safe();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
memset(m_reg, 0, sizeof(m_reg));
memset(m_d, 0, sizeof(m_d));
@@ -332,32 +323,33 @@ void saturn_device::device_reset()
void saturn_device::saturn_take_irq()
{
+ LOG("SATURN takes IRQ ($%04x)\n", m_pc);
+ standard_irq_callback(SATURN_IRQ_LINE, m_pc);
+
m_in_irq = 1; /* reset by software, using RTI */
m_pending_irq = 0;
m_icount -= 7;
saturn_push(m_pc);
m_pc=IRQ_ADDRESS;
-
- LOG("SATURN takes IRQ ($%04x)\n", m_pc);
-
- standard_irq_callback(SATURN_IRQ_LINE);
}
void saturn_device::execute_run()
{
do
{
- m_oldpc = m_pc;
-
- debugger_instruction_hook(m_pc);
-
if ( m_sleeping )
{
+ debugger_wait_hook();
+
/* advance time when sleeping */
m_icount -= 100;
}
else
{
+ m_oldpc = m_pc;
+
+ debugger_instruction_hook(m_pc);
+
/* takes irq */
if ( m_pending_irq && (!m_in_irq) )
saturn_take_irq();
@@ -398,7 +390,6 @@ void saturn_device::execute_set_input(int inputnum, int state)
if (m_sleeping && state==1)
{
LOG("SATURN set_wakeup_line(ASSERT)\n");
- standard_irq_callback(SATURN_WAKEUP_LINE);
m_sleeping = 0;
}
break;