summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tms7000
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/tms7000')
-rw-r--r--src/devices/cpu/tms7000/7000dasm.cpp68
-rw-r--r--src/devices/cpu/tms7000/tms7000.cpp112
-rw-r--r--src/devices/cpu/tms7000/tms7000.h112
3 files changed, 147 insertions, 145 deletions
diff --git a/src/devices/cpu/tms7000/7000dasm.cpp b/src/devices/cpu/tms7000/7000dasm.cpp
index 000c7ea2ea3..f38643c38d5 100644
--- a/src/devices/cpu/tms7000/7000dasm.cpp
+++ b/src/devices/cpu/tms7000/7000dasm.cpp
@@ -26,7 +26,7 @@ const tms7000_disassembler::oprandinfo tms7000_disassembler::of[] = {
/* 11 */ { {" R%u", "", "", ""}, {UI8, DONE, DONE, DONE} },
/* 12 */ { {" @>%04X(B)","", "", ""}, {UI16, DONE, DONE, DONE} },
-/* 13 */ { {" B,A", ",%s", "", ""}, {NONE, PCREL, DONE, DONE} },
+/* 13 */ { {" B,A,%s", "", "", ""}, {PCREL, DONE, DONE, DONE} },
/* 14 */ { {" R%u,A", ",%s", "", ""}, {UI8, PCREL, DONE, DONE} },
/* 15 */ { {" R%u,B", ",%s", "", ""}, {UI8, PCREL, DONE, DONE} },
/* 16 */ { {" R%u", ",R%u", ",%s", ""}, {UI8, UI8, PCREL, DONE} },
@@ -102,29 +102,29 @@ const tms7000_disassembler::tms7000_opcodeinfo tms7000_disassembler::opcs[] = {
{0x9C, "BR", 45, 0 },
{0xAC, "BR", 12, 0 },
- {0x66, "BTJO", 13, 0 },
- {0x16, "BTJO", 14, 0 },
- {0x36, "BTJO", 15, 0 },
- {0x46, "BTJO", 16, 0 },
- {0x26, "BTJO", 17, 0 },
- {0x56, "BTJO", 18, 0 },
- {0x76, "BTJO", 19, 0 },
-
- {0x86, "BTJOP", 20, 0 },
- {0x96, "BTJOP", 21, 0 },
- {0xA6, "BTJOP", 22, 0 },
-
- {0x67, "BTJZ", 13, 0 },
- {0x17, "BTJZ", 14, 0 },
- {0x37, "BTJZ", 15, 0 },
- {0x47, "BTJZ", 16, 0 },
- {0x27, "BTJZ", 17, 0 },
- {0x57, "BTJZ", 18, 0 },
- {0x77, "BTJZ", 19, 0 },
-
- {0x87, "BTJZP", 20, 0 },
- {0x97, "BTJZP", 21, 0 },
- {0xA7, "BTJZP", 22, 0 },
+ {0x66, "BTJO", 13, STEP_COND },
+ {0x16, "BTJO", 14, STEP_COND },
+ {0x36, "BTJO", 15, STEP_COND },
+ {0x46, "BTJO", 16, STEP_COND },
+ {0x26, "BTJO", 17, STEP_COND },
+ {0x56, "BTJO", 18, STEP_COND },
+ {0x76, "BTJO", 19, STEP_COND },
+
+ {0x86, "BTJOP", 20, STEP_COND },
+ {0x96, "BTJOP", 21, STEP_COND },
+ {0xA6, "BTJOP", 22, STEP_COND },
+
+ {0x67, "BTJZ", 13, STEP_COND },
+ {0x17, "BTJZ", 14, STEP_COND },
+ {0x37, "BTJZ", 15, STEP_COND },
+ {0x47, "BTJZ", 16, STEP_COND },
+ {0x27, "BTJZ", 17, STEP_COND },
+ {0x57, "BTJZ", 18, STEP_COND },
+ {0x77, "BTJZ", 19, STEP_COND },
+
+ {0x87, "BTJZP", 20, STEP_COND },
+ {0x97, "BTJZP", 21, STEP_COND },
+ {0xA7, "BTJZP", 22, STEP_COND },
{0x8E, "CALL", 43, STEP_OVER },
{0x9E, "CALL", 45, STEP_OVER },
@@ -166,9 +166,9 @@ const tms7000_disassembler::tms7000_opcodeinfo tms7000_disassembler::opcs[] = {
{0x06, "DINT", 23, 0 },
- {0xBA, "DJNZ", 25, 0 },
- {0xCA, "DJNZ", 26, 0 },
- {0xDA, "DJNZ", 27, 0 },
+ {0xBA, "DJNZ", 25, STEP_COND },
+ {0xCA, "DJNZ", 26, STEP_COND },
+ {0xDA, "DJNZ", 27, STEP_COND },
{0x6F, "DSB", 0, 0 },
{0x1F, "DSB", 1, 0 },
@@ -190,14 +190,14 @@ const tms7000_disassembler::tms7000_opcodeinfo tms7000_disassembler::opcs[] = {
{0xC4, "INV B", 23, 0 },
{0xD4, "INV", 24, 0 },
- {0xE2, "JEQ", 28, 0 },
- {0xE3, "JHS", 28, 0 },
- {0xE7, "JL", 28, 0 },
+ {0xE2, "JEQ", 28, STEP_COND },
+ {0xE3, "JHS", 28, STEP_COND },
+ {0xE7, "JL", 28, STEP_COND },
{0xE0, "JMP", 28, 0 },
- {0xE1, "JN", 28, 0 },
- {0xE6, "JNZ", 28, 0 },
- {0xE4, "JP", 28, 0 },
- {0xE5, "JPI", 28, 0 },
+ {0xE1, "JN", 28, STEP_COND },
+ {0xE6, "JNZ", 28, STEP_COND },
+ {0xE4, "JP", 28, STEP_COND },
+ {0xE5, "JPZ", 28, STEP_COND },
{0x8A, "LDA", 10, 0 },
{0x9A, "LDA", 45, 0 },
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)
{
}
diff --git a/src/devices/cpu/tms7000/tms7000.h b/src/devices/cpu/tms7000/tms7000.h
index 0d1d3b82490..a6b22f8d5a5 100644
--- a/src/devices/cpu/tms7000/tms7000.h
+++ b/src/devices/cpu/tms7000/tms7000.h
@@ -11,9 +11,7 @@
#pragma once
-#include "debugger.h"
-
-enum { TMS7000_PC=1, TMS7000_SP, TMS7000_ST };
+enum { TMS7000_PC=1, TMS7000_SP, TMS7000_ST, TMS7000_A, TMS7000_B };
enum
{
@@ -45,26 +43,30 @@ public:
auto in_porte() { return m_port_in_cb[4].bind(); }
auto out_porte() { return m_port_out_cb[4].bind(); }
- DECLARE_READ8_MEMBER(tms7000_unmapped_rf_r) { if (!machine().side_effects_disabled()) logerror("'%s' (%04X): unmapped_rf_r @ $%04x\n", tag(), m_pc, offset + 0x80); return 0; };
- DECLARE_WRITE8_MEMBER(tms7000_unmapped_rf_w) { logerror("'%s' (%04X): unmapped_rf_w @ $%04x = $%02x\n", tag(), m_pc, offset + 0x80, data); };
+ // clock divider mask option
+ void set_divide_by_2() { m_divider = 2; }
+ void set_divide_by_4() { m_divider = 4; }
+
+ uint8_t tms7000_unmapped_rf_r(offs_t offset) { if (!machine().side_effects_disabled()) logerror("'%s' (%04X): unmapped_rf_r @ $%04x\n", tag(), m_pc, offset + 0x80); return 0; }
+ void tms7000_unmapped_rf_w(offs_t offset, uint8_t data) { logerror("'%s' (%04X): unmapped_rf_w @ $%04x = $%02x\n", tag(), m_pc, offset + 0x80, data); }
- DECLARE_READ8_MEMBER(tms7000_pf_r);
- DECLARE_WRITE8_MEMBER(tms7000_pf_w);
- DECLARE_READ8_MEMBER(tms7002_pf_r) { return tms7000_pf_r(space, offset + 0x10); }
- DECLARE_WRITE8_MEMBER(tms7002_pf_w) { tms7000_pf_w(space, offset + 0x10, data); }
+ uint8_t tms7000_pf_r(offs_t offset);
+ void tms7000_pf_w(offs_t offset, uint8_t data);
+ uint8_t tms7002_pf_r(offs_t offset) { return tms7000_pf_r(offset + 0x10); }
+ void tms7002_pf_w(offs_t offset, uint8_t data) { tms7000_pf_w(offset + 0x10, data); }
bool chip_is_cmos() const { return (m_info_flags & CHIP_IS_CMOS) ? true : false; }
bool chip_is_family_70x0() const { return chip_get_family() == CHIP_FAMILY_70X0; }
bool chip_is_family_70x2() const { return chip_get_family() == CHIP_FAMILY_70X2; }
bool chip_is_family_70cx2() const { return chip_get_family() == CHIP_FAMILY_70CX2; }
- void tms7000_mem(address_map &map);
- void tms7001_mem(address_map &map);
- void tms7002_mem(address_map &map);
- void tms7020_mem(address_map &map);
- void tms7040_mem(address_map &map);
- void tms7041_mem(address_map &map);
- void tms7042_mem(address_map &map);
+ void tms7000_mem(address_map &map) ATTR_COLD;
+ void tms7001_mem(address_map &map) ATTR_COLD;
+ void tms7002_mem(address_map &map) ATTR_COLD;
+ void tms7020_mem(address_map &map) ATTR_COLD;
+ void tms7040_mem(address_map &map) ATTR_COLD;
+ void tms7041_mem(address_map &map) ATTR_COLD;
+ void tms7042_mem(address_map &map) ATTR_COLD;
protected:
// chip info flags
static constexpr uint32_t CHIP_IS_CMOS = 0x01;
@@ -76,15 +78,14 @@ protected:
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);
// device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
+ virtual void device_start() override ATTR_COLD;
+ virtual void device_reset() override ATTR_COLD;
// device_execute_interface overrides
- virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 2 - 1) / 2; } // internal /2 divider
- virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 2); } // internal /2 divider
- virtual uint32_t execute_min_cycles() const override { return 5; }
- virtual uint32_t execute_max_cycles() const override { return 49; }
- virtual uint32_t execute_input_lines() const override { return 2; }
+ virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const noexcept override { return (clocks + m_divider - 1) / m_divider; }
+ virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const noexcept override { return (cycles * m_divider); }
+ virtual uint32_t execute_min_cycles() const noexcept override { return 5; }
+ virtual uint32_t execute_max_cycles() const noexcept override { return 49; }
virtual void execute_run() override;
virtual void execute_set_input(int extline, int state) override;
@@ -103,13 +104,14 @@ protected:
address_space_config m_program_config;
- devcb_read8 m_port_in_cb[5];
- devcb_write8 m_port_out_cb[5];
+ devcb_read8::array<5> m_port_in_cb;
+ devcb_write8::array<5> m_port_out_cb;
- uint32_t m_info_flags;
+ const uint32_t m_info_flags;
+ unsigned m_divider;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program;
int m_icount;
bool m_irq_state[2];
@@ -143,26 +145,26 @@ protected:
void timer_tick_low(int tmr);
// internal read/write
- inline uint8_t read_r8(uint8_t address) { return m_program->read_byte(address); }
- inline void write_r8(uint8_t address, uint8_t data) { m_program->write_byte(address, data); }
- inline uint16_t read_r16(uint8_t address) { return m_program->read_byte((address - 1) & 0xff) << 8 | m_program->read_byte(address); }
- inline void write_r16(uint8_t address, uint16_t data) { m_program->write_byte((address - 1) & 0xff, data >> 8 & 0xff); m_program->write_byte(address, data & 0xff); }
+ inline uint8_t read_r8(uint8_t address) { return m_program.read_byte(address); }
+ inline void write_r8(uint8_t address, uint8_t data) { m_program.write_byte(address, data); }
+ inline uint16_t read_r16(uint8_t address) { return m_program.read_byte((address - 1) & 0xff) << 8 | m_program.read_byte(address); }
+ inline void write_r16(uint8_t address, uint16_t data) { m_program.write_byte((address - 1) & 0xff, data >> 8 & 0xff); m_program.write_byte(address, data & 0xff); }
- inline uint8_t read_p(uint8_t address) { return m_program->read_byte(0x100 + address); }
- inline void write_p(uint8_t address, uint8_t data) { m_program->write_byte(0x100 + address, data); }
+ inline uint8_t read_p(uint8_t address) { return m_program.read_byte(0x100 + address); }
+ inline void write_p(uint8_t address, uint8_t data) { m_program.write_byte(0x100 + address, data); }
- inline uint8_t read_mem8(uint16_t address) { return m_program->read_byte(address); }
- inline void write_mem8(uint16_t address, uint8_t data) { m_program->write_byte(address, data); }
- inline uint16_t read_mem16(uint16_t address) { return m_program->read_byte(address) << 8 | m_program->read_byte((address + 1) & 0xffff); }
- inline void write_mem16(uint16_t address, uint16_t data) { m_program->write_byte(address, data >> 8 & 0xff); m_program->write_byte((address + 1) & 0xffff, data & 0xff); }
+ inline uint8_t read_mem8(uint16_t address) { return m_program.read_byte(address); }
+ inline void write_mem8(uint16_t address, uint8_t data) { m_program.write_byte(address, data); }
+ inline uint16_t read_mem16(uint16_t address) { return m_program.read_byte(address) << 8 | m_program.read_byte((address + 1) & 0xffff); }
+ inline void write_mem16(uint16_t address, uint16_t data) { m_program.write_byte(address, data >> 8 & 0xff); m_program.write_byte((address + 1) & 0xffff, data & 0xff); }
- inline uint8_t imm8() { return m_cache->read_byte(m_pc++); }
- inline uint16_t imm16() { uint16_t ret = m_cache->read_byte(m_pc++) << 8; return ret | m_cache->read_byte(m_pc++); }
+ inline uint8_t imm8() { return m_cache.read_byte(m_pc++); }
+ inline uint16_t imm16() { uint16_t ret = m_cache.read_byte(m_pc++) << 8; return ret | m_cache.read_byte(m_pc++); }
- inline uint8_t pull8() { return m_program->read_byte(m_sp--); }
- inline void push8(uint8_t data) { m_program->write_byte(++m_sp, data); }
- inline uint16_t pull16() { uint16_t ret = m_program->read_byte(m_sp--); return ret | m_program->read_byte(m_sp--) << 8; }
- inline void push16(uint16_t data) { m_program->write_byte(++m_sp, data >> 8 & 0xff); m_program->write_byte(++m_sp, data & 0xff); }
+ inline uint8_t pull8() { return m_program.read_byte(m_sp--); }
+ inline void push8(uint8_t data) { m_program.write_byte(++m_sp, data); }
+ inline uint16_t pull16() { uint16_t ret = m_program.read_byte(m_sp--); return ret | m_program.read_byte(m_sp--) << 8; }
+ inline void push16(uint16_t data) { m_program.write_byte(++m_sp, data >> 8 & 0xff); m_program.write_byte(++m_sp, data & 0xff); }
// statusreg flags
enum
@@ -322,23 +324,23 @@ class tms70c46_device : public tms7000_device
public:
tms70c46_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- DECLARE_READ8_MEMBER(control_r);
- DECLARE_WRITE8_MEMBER(control_w);
+ uint8_t control_r();
+ void control_w(uint8_t data);
- DECLARE_READ8_MEMBER(dockbus_status_r);
- DECLARE_WRITE8_MEMBER(dockbus_status_w);
- DECLARE_READ8_MEMBER(dockbus_data_r);
- DECLARE_WRITE8_MEMBER(dockbus_data_w);
+ uint8_t dockbus_status_r();
+ void dockbus_status_w(uint8_t data);
+ uint8_t dockbus_data_r();
+ void dockbus_data_w(uint8_t data);
// access I/O port E if databus is disabled
- DECLARE_READ8_MEMBER(e_bus_data_r) { return machine().side_effects_disabled() ? 0xff : ((m_control & 0x20) ? 0xff : m_port_in_cb[4]()); }
- DECLARE_WRITE8_MEMBER(e_bus_data_w) { if (~m_control & 0x20) m_port_out_cb[4](data); }
+ uint8_t e_bus_data_r() { return machine().side_effects_disabled() ? 0xff : ((m_control & 0x20) ? 0xff : m_port_in_cb[4]()); }
+ void e_bus_data_w(uint8_t data) { if (~m_control & 0x20) m_port_out_cb[4](data); }
- void tms70c46_mem(address_map &map);
+ void tms70c46_mem(address_map &map) ATTR_COLD;
protected:
// device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
+ virtual void device_start() override ATTR_COLD;
+ virtual void device_reset() override ATTR_COLD;
private:
uint8_t m_control;