summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tms7000/tms7000.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/tms7000/tms7000.cpp')
-rw-r--r--src/devices/cpu/tms7000/tms7000.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/devices/cpu/tms7000/tms7000.cpp b/src/devices/cpu/tms7000/tms7000.cpp
index 11014f63994..2f23b4ba05a 100644
--- a/src/devices/cpu/tms7000/tms7000.cpp
+++ b/src/devices/cpu/tms7000/tms7000.cpp
@@ -54,7 +54,7 @@ DEFINE_DEVICE_TYPE(TMS70C46, tms70c46_device, "tms70c46", "Texas Instruments TMS
// internal memory maps
void tms7000_device::tms7000_mem(address_map &map)
{
- map(0x0000, 0x007f).ram(); // 128 bytes internal RAM
+ map(0x0000, 0x007f).ram().share("rf"); // 128 bytes internal RAM
map(0x0080, 0x00ff).rw(FUNC(tms7000_device::tms7000_unmapped_rf_r), FUNC(tms7000_device::tms7000_unmapped_rf_w));
map(0x0100, 0x010b).rw(FUNC(tms7000_device::tms7000_pf_r), FUNC(tms7000_device::tms7000_pf_w));
map(0x0104, 0x0105).nopw(); // no port A write or ddr
@@ -62,7 +62,7 @@ void tms7000_device::tms7000_mem(address_map &map)
void tms7000_device::tms7001_mem(address_map &map)
{
- map(0x0000, 0x007f).ram(); // 128 bytes internal RAM
+ map(0x0000, 0x007f).ram().share("rf"); // 128 bytes internal RAM
map(0x0080, 0x00ff).rw(FUNC(tms7000_device::tms7000_unmapped_rf_r), FUNC(tms7000_device::tms7000_unmapped_rf_w));
map(0x0100, 0x010b).rw(FUNC(tms7000_device::tms7000_pf_r), FUNC(tms7000_device::tms7000_pf_w));
map(0x0110, 0x0117).rw(FUNC(tms7000_device::tms7002_pf_r), FUNC(tms7000_device::tms7002_pf_w));
@@ -70,7 +70,7 @@ void tms7000_device::tms7001_mem(address_map &map)
void tms7000_device::tms7002_mem(address_map &map)
{
- map(0x0000, 0x00ff).ram(); // 256 bytes internal RAM
+ map(0x0000, 0x00ff).ram().share("rf"); // 256 bytes internal RAM
map(0x0100, 0x010b).rw(FUNC(tms7000_device::tms7000_pf_r), FUNC(tms7000_device::tms7000_pf_w));
map(0x0110, 0x0117).rw(FUNC(tms7000_device::tms7002_pf_r), FUNC(tms7000_device::tms7002_pf_w));
}
@@ -111,72 +111,73 @@ void tms70c46_device::tms70c46_mem(address_map &map)
// device definitions
-tms7000_device::tms7000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7000, tag, owner, clock, address_map_constructor(FUNC(tms7000_device::tms7000_mem), this), 0)
+tms7000_device::tms7000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7000, tag, owner, clock, address_map_constructor(FUNC(tms7000_device::tms7000_mem), this), 0)
{
}
-tms7000_device::tms7000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal, uint32_t info_flags)
- : cpu_device(mconfig, type, tag, owner, clock),
+tms7000_device::tms7000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal, uint32_t info_flags) :
+ cpu_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, internal),
- m_port_in_cb{{*this}, {*this}, {*this}, {*this}, {*this}},
- m_port_out_cb{{*this}, {*this}, {*this}, {*this}, {*this}},
- m_info_flags(info_flags)
+ m_port_in_cb(*this, 0xff),
+ m_port_out_cb(*this),
+ m_info_flags(info_flags),
+ m_divider(2)
{
}
-tms7020_device::tms7020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7020, tag, owner, clock, address_map_constructor(FUNC(tms7020_device::tms7020_mem), this), 0)
+tms7020_device::tms7020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7020, tag, owner, clock, address_map_constructor(FUNC(tms7020_device::tms7020_mem), this), 0)
{
}
-tms7020_exl_device::tms7020_exl_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7020_EXL, tag, owner, clock, address_map_constructor(FUNC(tms7020_exl_device::tms7020_mem), this), 0)
+tms7020_exl_device::tms7020_exl_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7020_EXL, tag, owner, clock, address_map_constructor(FUNC(tms7020_exl_device::tms7020_mem), this), 0)
{
}
-tms7040_device::tms7040_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7040, tag, owner, clock, address_map_constructor(FUNC(tms7040_device::tms7040_mem), this), 0)
+tms7040_device::tms7040_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7040, tag, owner, clock, address_map_constructor(FUNC(tms7040_device::tms7040_mem), this), 0)
{
}
-tms70c00_device::tms70c00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS70C00, tag, owner, clock, address_map_constructor(FUNC(tms70c00_device::tms7000_mem), this), CHIP_IS_CMOS)
+tms70c00_device::tms70c00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS70C00, tag, owner, clock, address_map_constructor(FUNC(tms70c00_device::tms7000_mem), this), CHIP_IS_CMOS)
{
}
-tms70c20_device::tms70c20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS70C20, tag, owner, clock, address_map_constructor(FUNC(tms70c20_device::tms7020_mem), this), CHIP_IS_CMOS)
+tms70c20_device::tms70c20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS70C20, tag, owner, clock, address_map_constructor(FUNC(tms70c20_device::tms7020_mem), this), CHIP_IS_CMOS)
{
}
-tms70c40_device::tms70c40_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS70C40, tag, owner, clock, address_map_constructor(FUNC(tms70c40_device::tms7040_mem), this), CHIP_IS_CMOS)
+tms70c40_device::tms70c40_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS70C40, tag, owner, clock, address_map_constructor(FUNC(tms70c40_device::tms7040_mem), this), CHIP_IS_CMOS)
{
}
-tms7001_device::tms7001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7001, tag, owner, clock, address_map_constructor(FUNC(tms7001_device::tms7001_mem), this), CHIP_FAMILY_70X2)
+tms7001_device::tms7001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7001, tag, owner, clock, address_map_constructor(FUNC(tms7001_device::tms7001_mem), this), CHIP_FAMILY_70X2)
{
}
-tms7041_device::tms7041_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7041, tag, owner, clock, address_map_constructor(FUNC(tms7041_device::tms7041_mem), this), CHIP_FAMILY_70X2)
+tms7041_device::tms7041_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7041, tag, owner, clock, address_map_constructor(FUNC(tms7041_device::tms7041_mem), this), CHIP_FAMILY_70X2)
{
}
-tms7002_device::tms7002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7002, tag, owner, clock, address_map_constructor(FUNC(tms7002_device::tms7002_mem), this), CHIP_FAMILY_70X2)
+tms7002_device::tms7002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7002, tag, owner, clock, address_map_constructor(FUNC(tms7002_device::tms7002_mem), this), CHIP_FAMILY_70X2)
{
}
-tms7042_device::tms7042_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS7042, tag, owner, clock, address_map_constructor(FUNC(tms7042_device::tms7042_mem), this), CHIP_FAMILY_70X2)
+tms7042_device::tms7042_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS7042, tag, owner, clock, address_map_constructor(FUNC(tms7042_device::tms7042_mem), this), CHIP_FAMILY_70X2)
{
}
-tms70c46_device::tms70c46_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms7000_device(mconfig, TMS70C46, tag, owner, clock, address_map_constructor(FUNC(tms70c46_device::tms70c46_mem), this), CHIP_IS_CMOS)
+tms70c46_device::tms70c46_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ tms7000_device(mconfig, TMS70C46, tag, owner, clock, address_map_constructor(FUNC(tms70c46_device::tms70c46_mem), this), CHIP_IS_CMOS)
{
}
@@ -195,19 +196,14 @@ device_memory_interface::space_config_vector tms7000_device::memory_space_config
void tms7000_device::device_start()
{
// init/zerofill
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
set_icountptr(m_icount);
m_irq_state[TMS7000_INT1_LINE] = false;
m_irq_state[TMS7000_INT3_LINE] = false;
- for (auto &cb : m_port_in_cb)
- cb.resolve_safe(0xff);
- for (auto &cb : m_port_out_cb)
- cb.resolve_safe();
-
m_idle_state = false;
m_idle_halt = false;
m_pc = 0;
@@ -223,7 +219,7 @@ void tms7000_device::device_start()
for (int tmr = 0; tmr < 2; tmr++)
{
- m_timer_handle[tmr] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tms7000_device::simple_timer_cb), this));
+ m_timer_handle[tmr] = timer_alloc(FUNC(tms7000_device::simple_timer_cb), this);
m_timer_handle[tmr]->adjust(attotime::never, tmr);
m_timer_data[tmr] = 0;
@@ -251,13 +247,16 @@ void tms7000_device::device_start()
save_item(NAME(m_timer_capture_latch));
// register for debugger
- state_add(TMS7000_PC, "PC", m_pc).formatstr("%02X");
- state_add(TMS7000_SP, "S", m_sp).formatstr("%02X");
+ state_add(TMS7000_PC, "PC", m_pc).formatstr("%04X");
+ state_add(TMS7000_SP, "SP", m_sp).formatstr("%02X");
state_add(TMS7000_ST, "ST", m_sr).formatstr("%02X");
- state_add(STATE_GENPC, "GENPC", m_pc).formatstr("%02X").noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_pc).formatstr("%02X").noshow();
- state_add(STATE_GENSP, "GENSP", m_sp).formatstr("%02X").noshow();
+ uint8_t *rf = static_cast<uint8_t *>(memshare("rf")->ptr());
+ state_add(TMS7000_A, "A", rf[0]).formatstr("%02X");
+ state_add(TMS7000_B, "B", rf[1]).formatstr("%02X");
+
+ state_add(STATE_GENPC, "GENPC", m_pc).formatstr("%04X").noshow();
+ state_add(STATE_GENPCBASE, "CURPC", m_pc).formatstr("%04X").noshow();
state_add(STATE_GENFLAGS, "GENFLAGS", m_sr).formatstr("%8s").noshow();
}
@@ -418,12 +417,12 @@ void tms7000_device::do_interrupt(int irqline)
else
m_icount -= 19;
+ standard_irq_callback(irqline, m_pc);
+
push8(m_sr);
push16(m_pc);
m_sr = 0;
m_pc = read_mem16(0xfffc - irqline * 2);
-
- standard_irq_callback(irqline);
}
@@ -496,7 +495,7 @@ TIMER_CALLBACK_MEMBER(tms7000_device::simple_timer_cb)
// note: TMS7000 family is from $00 to $0b, TMS7002 family adds $10 to $17
//-------------------------------------------------
-READ8_MEMBER(tms7000_device::tms7000_pf_r)
+uint8_t tms7000_device::tms7000_pf_r(offs_t offset)
{
switch (offset)
{
@@ -537,7 +536,7 @@ READ8_MEMBER(tms7000_device::tms7000_pf_r)
return 0;
}
-WRITE8_MEMBER(tms7000_device::tms7000_pf_w)
+void tms7000_device::tms7000_pf_w(offs_t offset, uint8_t data)
{
switch (offset)
{
@@ -582,6 +581,7 @@ WRITE8_MEMBER(tms7000_device::tms7000_pf_w)
logerror("%s: CMOS low-power halt mode enabled\n", tag());
}
data &= ~0x20;
+ [[fallthrough]];
case 0x13:
// d0-d4: prescaler reload value
// d5: t2: cascade from t1
@@ -632,7 +632,7 @@ void tms7000_device::execute_run()
{
debugger_instruction_hook(m_pc);
- m_op = m_cache->read_byte(m_pc++);
+ m_op = m_cache.read_byte(m_pc++);
execute_one(m_op);
} while (m_icount > 0);
}
@@ -903,12 +903,12 @@ void tms70c46_device::device_reset()
tms7000_device::device_reset();
}
-READ8_MEMBER(tms70c46_device::control_r)
+uint8_t tms70c46_device::control_r()
{
return m_control;
}
-WRITE8_MEMBER(tms70c46_device::control_w)
+void tms70c46_device::control_w(uint8_t data)
{
// d5: enable external databus
if (~m_control & data & 0x20)
@@ -927,7 +927,7 @@ WRITE8_MEMBER(tms70c46_device::control_w)
// right now pretend that nothing is connected
// external pins are HD0-HD3(data), HSK(handshake), BAV(bus available)
-READ8_MEMBER(tms70c46_device::dockbus_status_r)
+uint8_t tms70c46_device::dockbus_status_r()
{
// d0: slave _HSK
// d1: slave _BAV
@@ -936,18 +936,18 @@ READ8_MEMBER(tms70c46_device::dockbus_status_r)
return 0;
}
-WRITE8_MEMBER(tms70c46_device::dockbus_status_w)
+void tms70c46_device::dockbus_status_w(uint8_t data)
{
// d0: master _HSK (setting it low(write 1) also clears IRQ)
// d1: master _BAV
// other bits: unused?
}
-READ8_MEMBER(tms70c46_device::dockbus_data_r)
+uint8_t tms70c46_device::dockbus_data_r()
{
return 0xff;
}
-WRITE8_MEMBER(tms70c46_device::dockbus_data_w)
+void tms70c46_device::dockbus_data_w(uint8_t data)
{
}