summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/h6280/h6280.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/h6280/h6280.cpp')
-rw-r--r--src/devices/cpu/h6280/h6280.cpp55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp
index 814f906de81..7bb01c3f6d5 100644
--- a/src/devices/cpu/h6280/h6280.cpp
+++ b/src/devices/cpu/h6280/h6280.cpp
@@ -113,7 +113,6 @@
#include "emu.h"
#include "h6280.h"
#include "6280dasm.h"
-#include "debugger.h"
/* 6280 flags */
enum
@@ -173,7 +172,7 @@ h6280_device::h6280_device(const machine_config &mconfig, const char *tag, devic
, device_mixer_interface(mconfig, *this, 2)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 21, 0, 16, 0, address_map_constructor(FUNC(h6280_device::internal_map), this))
, m_io_config("io", ENDIANNESS_LITTLE, 8, 2)
- , m_port_in_cb(*this)
+ , m_port_in_cb(*this, 0)
, m_port_out_cb(*this)
, m_psg(*this, "psg")
, m_timer_scale(1)
@@ -239,9 +238,6 @@ void h6280_device::device_add_mconfig(machine_config &config)
void h6280_device::device_start()
{
- m_port_in_cb.resolve();
- m_port_out_cb.resolve_safe();
-
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_pc.w.l).noshow();
state_add(STATE_GENPCBASE, "CURPC", m_pc.w.l).noshow();
@@ -320,9 +316,9 @@ void h6280_device::device_reset()
#endif
m_io_buffer = 0;
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
/* set I and B flags */
P = _fI | _fB;
@@ -414,14 +410,14 @@ inline void h6280_device::check_and_take_irq_lines()
if ( m_irq_state[0] != CLEAR_LINE &&
!(m_irq_mask & 0x2) )
{
+ standard_irq_callback(0, PCW);
do_interrupt(H6280_IRQ1_VEC);
- standard_irq_callback(0);
} else
if ( m_irq_state[1] != CLEAR_LINE &&
!(m_irq_mask & 0x1) )
{
+ standard_irq_callback(1, PCW);
do_interrupt(H6280_IRQ2_VEC);
- standard_irq_callback(1);
}
}
}
@@ -1605,7 +1601,7 @@ inline uint8_t h6280_device::smb(int bit, uint8_t tmp)
inline void h6280_device::st0(uint8_t tmp)
{
clear_t();
- m_io->write_byte(0x0000,tmp);
+ m_io.write_byte(0x0000,tmp);
}
/* 6280 ********************************************************
@@ -1614,7 +1610,7 @@ inline void h6280_device::st0(uint8_t tmp)
inline void h6280_device::st1(uint8_t tmp)
{
clear_t();
- m_io->write_byte(0x0002,tmp);
+ m_io.write_byte(0x0002,tmp);
}
/* 6280 ********************************************************
@@ -1623,7 +1619,7 @@ inline void h6280_device::st1(uint8_t tmp)
inline void h6280_device::st2(uint8_t tmp)
{
clear_t();
- m_io->write_byte(0x0003,tmp);
+ m_io.write_byte(0x0003,tmp);
}
/* 6280 ********************************************************
@@ -2329,7 +2325,7 @@ void h6280_device::execute_set_input(int inputnum, int state)
uint8_t h6280_device::program_read8(offs_t addr)
{
check_vdc_vce_penalty(addr);
- return m_program->read_byte(translated(addr));
+ return m_program.read_byte(translated(addr));
}
/***************************************************************
@@ -2338,7 +2334,7 @@ uint8_t h6280_device::program_read8(offs_t addr)
void h6280_device::program_write8(offs_t addr, uint8_t data)
{
check_vdc_vce_penalty(addr);
- m_program->write_byte(translated(addr), data);
+ m_program.write_byte(translated(addr), data);
}
/***************************************************************
@@ -2346,7 +2342,7 @@ void h6280_device::program_write8(offs_t addr, uint8_t data)
***************************************************************/
uint8_t h6280_device::program_read8z(offs_t addr)
{
- return m_program->read_byte((m_mmr[1] << 13) | (addr & 0x1fff));
+ return m_program.read_byte((m_mmr[1] << 13) | (addr & 0x1fff));
}
/***************************************************************
@@ -2354,7 +2350,7 @@ uint8_t h6280_device::program_read8z(offs_t addr)
***************************************************************/
void h6280_device::program_write8z(offs_t addr, uint8_t data)
{
- m_program->write_byte((m_mmr[1] << 13) | (addr & 0x1fff), data);
+ m_program.write_byte((m_mmr[1] << 13) | (addr & 0x1fff), data);
}
/***************************************************************
@@ -2362,8 +2358,8 @@ void h6280_device::program_write8z(offs_t addr, uint8_t data)
***************************************************************/
uint16_t h6280_device::program_read16(offs_t addr)
{
- return m_program->read_byte(translated(addr)) |
- (m_program->read_byte(translated(addr + 1)) << 8);
+ return m_program.read_byte(translated(addr)) |
+ (m_program.read_byte(translated(addr + 1)) << 8);
}
/***************************************************************
@@ -2373,13 +2369,13 @@ uint16_t h6280_device::program_read16z(offs_t addr)
{
if ((addr & 0xff) == 0xff)
{
- return m_program->read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
- (m_program->read_byte((m_mmr[1] << 13) | ((addr - 0xff) & 0x1fff)) << 8);
+ return m_program.read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
+ (m_program.read_byte((m_mmr[1] << 13) | ((addr - 0xff) & 0x1fff)) << 8);
}
else
{
- return m_program->read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
- (m_program->read_byte((m_mmr[1] << 13) | ((addr + 1) & 0x1fff)) << 8);
+ return m_program.read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
+ (m_program.read_byte((m_mmr[1] << 13) | ((addr + 1) & 0x1fff)) << 8);
}
}
@@ -2388,7 +2384,7 @@ uint16_t h6280_device::program_read16z(offs_t addr)
***************************************************************/
void h6280_device::push(uint8_t value)
{
- m_program->write_byte((m_mmr[1] << 13) | m_sp.d, value);
+ m_program.write_byte((m_mmr[1] << 13) | m_sp.d, value);
S--;
}
@@ -2398,7 +2394,7 @@ void h6280_device::push(uint8_t value)
void h6280_device::pull(uint8_t &value)
{
S++;
- value = m_program->read_byte((m_mmr[1] << 13) | m_sp.d);
+ value = m_program.read_byte((m_mmr[1] << 13) | m_sp.d);
}
/***************************************************************
@@ -2406,7 +2402,7 @@ void h6280_device::pull(uint8_t &value)
***************************************************************/
uint8_t h6280_device::read_opcode()
{
- return m_cache->read_byte(translated(PCW));
+ return m_cache.read_byte(translated(PCW));
}
/***************************************************************
@@ -2414,7 +2410,7 @@ uint8_t h6280_device::read_opcode()
***************************************************************/
uint8_t h6280_device::read_opcode_arg()
{
- return m_cache->read_byte(translated(PCW));
+ return m_cache.read_byte(translated(PCW));
}
@@ -2583,7 +2579,7 @@ void h6280_device::timer_w(offs_t offset, uint8_t data)
uint8_t h6280_device::port_r()
{
- if (!m_port_in_cb.isnull())
+ if (!m_port_in_cb.isunset())
return m_port_in_cb();
else
return m_io_buffer;
@@ -2607,8 +2603,9 @@ void h6280_device::psg_w(offs_t offset, uint8_t data)
m_psg->c6280_w(offset, data);
}
-bool h6280_device::memory_translate(int spacenum, int intention, offs_t &address)
+bool h6280_device::memory_translate(int spacenum, int intention, offs_t &address, address_space *&target_space)
{
+ target_space = &space(spacenum);
if (spacenum == AS_PROGRAM)
address = translated(address);