summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tms1000/tms1100.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/tms1000/tms1100.cpp')
-rw-r--r--src/devices/cpu/tms1000/tms1100.cpp81
1 files changed, 38 insertions, 43 deletions
diff --git a/src/devices/cpu/tms1000/tms1100.cpp b/src/devices/cpu/tms1000/tms1100.cpp
index 9f7d6a040b8..54d30a8348e 100644
--- a/src/devices/cpu/tms1000/tms1100.cpp
+++ b/src/devices/cpu/tms1000/tms1100.cpp
@@ -4,69 +4,61 @@
TMS1000 family - TMS1100, TMS1170, TMS1300, TMS1370
- TODO:
- - add TMS1100C when needed
+TMS1100 is nearly the same as TMS1000, some different opcodes, and with double the RAM and ROM
+
+TODO:
+- add TMS1100C when needed
*/
#include "emu.h"
#include "tms1100.h"
#include "tms1k_dasm.h"
-#include "debugger.h"
-// TMS1100 is nearly the same as TMS1000, some different opcodes, and with double the RAM and ROM
+
+// device definitions
DEFINE_DEVICE_TYPE(TMS1100, tms1100_cpu_device, "tms1100", "Texas Instruments TMS1100") // 28-pin DIP, 11 R pins
DEFINE_DEVICE_TYPE(TMS1170, tms1170_cpu_device, "tms1170", "Texas Instruments TMS1170") // high voltage version
DEFINE_DEVICE_TYPE(TMS1300, tms1300_cpu_device, "tms1300", "Texas Instruments TMS1300") // 40-pin DIP, 16 R pins
DEFINE_DEVICE_TYPE(TMS1370, tms1370_cpu_device, "tms1370", "Texas Instruments TMS1370") // high voltage version, also seen in 28-pin package(some O/R pins unavailable)
-// internal memory maps
-void tms1100_cpu_device::program_11bit_8(address_map &map)
-{
- map(0x000, 0x7ff).rom();
-}
-
-void tms1100_cpu_device::data_128x4(address_map &map)
-{
- map(0x00, 0x7f).ram();
-}
+tms1100_cpu_device::tms1100_cpu_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, u8 stack_levels, int rom_width, address_map_constructor rom_map, int ram_width, address_map_constructor ram_map) :
+ tms1000_cpu_device(mconfig, type, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, stack_levels, rom_width, rom_map, ram_width, ram_map)
+{ }
+tms1100_cpu_device::tms1100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
+ tms1100_cpu_device(mconfig, TMS1100, tag, owner, clock, 8 /* o pins */, 11 /* r pins */, 6 /* pc bits */, 8 /* byte width */, 3 /* x width */, 1 /* stack levels */, 11 /* rom width */, address_map_constructor(FUNC(tms1100_cpu_device::rom_11bit), this), 7 /* ram width */, address_map_constructor(FUNC(tms1100_cpu_device::ram_7bit), this))
+{ }
-// device definitions
-tms1100_cpu_device::tms1100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : tms1100_cpu_device(mconfig, TMS1100, tag, owner, clock, 8 /* o pins */, 11 /* r pins */, 6 /* pc bits */, 8 /* byte width */, 3 /* x width */, 11 /* prg width */, address_map_constructor(FUNC(tms1100_cpu_device::program_11bit_8), this), 7 /* data width */, address_map_constructor(FUNC(tms1100_cpu_device::data_128x4), this))
-{
-}
+tms1170_cpu_device::tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
+ tms1100_cpu_device(mconfig, TMS1170, tag, owner, clock, 8, 11, 6, 8, 3, 1, 11, address_map_constructor(FUNC(tms1170_cpu_device::rom_11bit), this), 7, address_map_constructor(FUNC(tms1170_cpu_device::ram_7bit), this))
+{ }
-tms1100_cpu_device::tms1100_cpu_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)
- : tms1000_cpu_device(mconfig, type, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data)
-{
-}
+tms1300_cpu_device::tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
+ tms1100_cpu_device(mconfig, TMS1300, tag, owner, clock, 8, 16, 6, 8, 3, 1, 11, address_map_constructor(FUNC(tms1300_cpu_device::rom_11bit), this), 7, address_map_constructor(FUNC(tms1300_cpu_device::ram_7bit), this))
+{ }
-tms1170_cpu_device::tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : tms1100_cpu_device(mconfig, TMS1170, tag, owner, clock, 8, 11, 6, 8, 3, 11, address_map_constructor(FUNC(tms1170_cpu_device::program_11bit_8), this), 7, address_map_constructor(FUNC(tms1170_cpu_device::data_128x4), this))
-{
-}
+tms1370_cpu_device::tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
+ tms1100_cpu_device(mconfig, TMS1370, tag, owner, clock, 8, 16, 6, 8, 3, 1, 11, address_map_constructor(FUNC(tms1370_cpu_device::rom_11bit), this), 7, address_map_constructor(FUNC(tms1370_cpu_device::ram_7bit), this))
+{ }
-tms1300_cpu_device::tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : tms1100_cpu_device(mconfig, TMS1300, tag, owner, clock, 8, 16, 6, 8, 3, 11, address_map_constructor(FUNC(tms1300_cpu_device::program_11bit_8), this), 7, address_map_constructor(FUNC(tms1300_cpu_device::data_128x4), this))
-{
-}
-tms1370_cpu_device::tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : tms1100_cpu_device(mconfig, TMS1370, tag, owner, clock, 8, 16, 6, 8, 3, 11, address_map_constructor(FUNC(tms1370_cpu_device::program_11bit_8), this), 7, address_map_constructor(FUNC(tms1370_cpu_device::data_128x4), this))
+// disasm
+std::unique_ptr<util::disasm_interface> tms1100_cpu_device::create_disassembler()
{
+ return std::make_unique<tms1100_disassembler>();
}
-// disasm
-std::unique_ptr<util::disasm_interface> tms1100_cpu_device::create_disassembler()
+// device_start/reset
+void tms1100_cpu_device::device_start()
{
- return std::make_unique<tms1100_disassembler>();
+ tms1000_cpu_device::device_start();
+
+ state_add(++m_state_count, "CB", m_cb).formatstr("%01X"); // 8
}
-// device_reset
void tms1100_cpu_device::device_reset()
{
tms1000_cpu_device::device_reset();
@@ -84,14 +76,17 @@ void tms1100_cpu_device::device_reset()
// opcode deviations
void tms1100_cpu_device::op_setr()
{
- // SETR: same, but X register MSB must be clear
- if (~m_x & (1 << (m_x_bits-1)))
- tms1k_base_device::op_setr();
+ // SETR: supports 5-bit index with X MSB (used when it has more than 16 R pins)
+ // TMS1100 manual simply says that X must be less than 4
+ u8 index = BIT(m_x, m_x_bits - 1) << 4 | m_y;
+ m_r = m_r | (1 << index);
+ write_r_output(m_r);
}
void tms1100_cpu_device::op_rstr()
{
- // RSTR: same, but X register MSB must be clear
- if (~m_x & (1 << (m_x_bits-1)))
- tms1k_base_device::op_rstr();
+ // RSTR: see SETR
+ u8 index = BIT(m_x, m_x_bits - 1) << 4 | m_y;
+ m_r = m_r & ~(1 << index);
+ write_r_output(m_r);
}