diff options
Diffstat (limited to 'src/devices/cpu/tms1000/tms1k_base.cpp')
-rw-r--r-- | src/devices/cpu/tms1000/tms1k_base.cpp | 100 |
1 files changed, 88 insertions, 12 deletions
diff --git a/src/devices/cpu/tms1000/tms1k_base.cpp b/src/devices/cpu/tms1000/tms1k_base.cpp index 985784570e8..bfbf6eab8af 100644 --- a/src/devices/cpu/tms1000/tms1k_base.cpp +++ b/src/devices/cpu/tms1000/tms1k_base.cpp @@ -5,8 +5,7 @@ TMS1000 family - base/shared TODO: - - fix debugger disasm view - - INIT pin + - accurate INIT pin (currently, just use INPUT_LINE_RESET) The TMS0980 and TMS1000-family MCU cores are very similar. The TMS0980 has a @@ -72,7 +71,7 @@ unknown cycle: CME, SSE, SSS tms1k_base_device::tms1k_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) : cpu_device(mconfig, type, tag, owner, clock) - , m_program_config("program", ENDIANNESS_BIG, byte_bits > 8 ? 16 : 8, prgwidth, 0, program) + , m_program_config("program", ENDIANNESS_BIG, byte_bits > 8 ? 16 : 8, prgwidth, byte_bits > 8 ? -1 : 0, program) , m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data) , m_mpla(*this, "mpla") , m_ipla(*this, "ipla") @@ -145,6 +144,7 @@ void tms1k_base_device::device_start() m_r = 0; m_o = 0; m_o_index = 0; + m_halt = false; m_cki_bus = 0; m_c4 = 0; m_p = 0; @@ -184,6 +184,7 @@ void tms1k_base_device::device_start() save_item(NAME(m_r)); save_item(NAME(m_o)); save_item(NAME(m_o_index)); + save_item(NAME(m_halt)); save_item(NAME(m_cki_bus)); save_item(NAME(m_c4)); save_item(NAME(m_p)); @@ -225,6 +226,14 @@ void tms1k_base_device::device_start() m_icountptr = &m_icount; } +device_memory_interface::space_config_vector tms1k_base_device::memory_space_config() const +{ + return space_config_vector { + std::make_pair(AS_PROGRAM, &m_program_config), + std::make_pair(AS_DATA, &m_data_config) + }; +} + //------------------------------------------------- @@ -260,13 +269,6 @@ void tms1k_base_device::device_reset() m_power_off(0); } -device_memory_interface::space_config_vector tms1k_base_device::memory_space_config() const -{ - return space_config_vector { - std::make_pair(AS_PROGRAM, &m_program_config), - std::make_pair(AS_DATA, &m_data_config) - }; -} //------------------------------------------------- @@ -306,6 +308,15 @@ void tms1k_base_device::read_opcode() // i/o handling //------------------------------------------------- +void tms1k_base_device::execute_set_input(int line, int state) +{ + if (line != TMS1XXX_INPUT_LINE_HALT) + return; + + // HALT pin (CMOS only) + m_halt = bool(state); +} + void tms1k_base_device::write_o_output(u8 index) { // a hardcoded table is supported if the output pla is unknown @@ -405,6 +416,62 @@ void tms1k_base_device::op_retn() } +// TMS1400/TMS1000C 3-level stack version + +void tms1k_base_device::op_br3() +{ + // BR/BL: conditional branch + if (m_status) + { + m_pa = m_pb; // don't care about clatch + m_ca = m_cb; + m_pc = m_opcode & m_pc_mask; + } +} + +void tms1k_base_device::op_call3() +{ + // CALL/CALLL: conditional call + if (m_status) + { + // mask clatch 3 bits (no need to mask others) + m_clatch = (m_clatch << 1 | 1) & 7; + + m_sr = m_sr << m_pc_bits | m_pc; + m_pc = m_opcode & m_pc_mask; + + m_ps = m_ps << 4 | m_pa; + m_pa = m_pb; + + m_cs = m_cs << 2 | m_ca; + m_ca = m_cb; + } + else + { + m_pb = m_pa; + m_cb = m_ca; + } +} + +void tms1k_base_device::op_retn3() +{ + // RETN: return from subroutine + if (m_clatch & 1) + { + m_clatch >>= 1; + + m_pc = m_sr & m_pc_mask; + m_sr >>= m_pc_bits; + + m_pa = m_pb = m_ps & 0xf; + m_ps >>= 4; + + m_ca = m_cb = m_cs & 3; + m_cs >>= 2; + } +} + + // handle other: // TMS1000/common @@ -542,9 +609,17 @@ void tms1k_base_device::op_sbl() void tms1k_base_device::execute_run() { - do + while (m_icount > 0) { m_icount--; + + if (m_halt) + { + // not running (output pins remain unchanged) + m_icount = 0; + return; + } + switch (m_subcycle) { case 0: @@ -667,6 +742,7 @@ void tms1k_base_device::execute_run() // execute: br/call 1/2 break; } + m_subcycle = (m_subcycle + 1) % 6; - } while (m_icount > 0); + } } |