diff options
Diffstat (limited to 'src/devices/cpu/tms1000')
-rw-r--r-- | src/devices/cpu/tms1000/tms0970.cpp | 2 | ||||
-rw-r--r-- | src/devices/cpu/tms1000/tms0980.cpp | 4 | ||||
-rw-r--r-- | src/devices/cpu/tms1000/tms1000.cpp | 20 | ||||
-rw-r--r-- | src/devices/cpu/tms1000/tms1000.h | 2 | ||||
-rw-r--r-- | src/devices/cpu/tms1000/tms1100.cpp | 5 | ||||
-rw-r--r-- | src/devices/cpu/tms1000/tms1k_base.cpp | 43 | ||||
-rw-r--r-- | src/devices/cpu/tms1000/tms1k_base.h | 93 | ||||
-rw-r--r-- | src/devices/cpu/tms1000/tp0320.cpp | 2 |
8 files changed, 110 insertions, 61 deletions
diff --git a/src/devices/cpu/tms1000/tms0970.cpp b/src/devices/cpu/tms1000/tms0970.cpp index 503f95def3e..2ba98ae38a2 100644 --- a/src/devices/cpu/tms1000/tms0970.cpp +++ b/src/devices/cpu/tms1000/tms0970.cpp @@ -110,7 +110,7 @@ void tms0970_cpu_device::device_reset() if (imask & 0x40 && (imask & 0x20) == 0) msel = (op & 0xf) | (op >> 1 & 0x10); - msel = BITSWAP8(msel,7,6,5,0,1,2,3,4); // lines are reversed + msel = bitswap<8>(msel,7,6,5,0,1,2,3,4); // lines are reversed u32 mmask = m_mpla->read(msel); mmask ^= 0x09fe; // invert active-negative diff --git a/src/devices/cpu/tms1000/tms0980.cpp b/src/devices/cpu/tms1000/tms0980.cpp index 622d8ca5be4..4ca31ad4330 100644 --- a/src/devices/cpu/tms1000/tms0980.cpp +++ b/src/devices/cpu/tms1000/tms0980.cpp @@ -110,7 +110,7 @@ u32 tms0980_cpu_device::decode_fixed(u16 op) u32 tms0980_cpu_device::decode_micro(u8 sel) { u32 decode = 0; - sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed + sel = bitswap<8>(sel,7,6,0,1,2,3,4,5); // lines are reversed u32 mask = m_mpla->read(sel); mask ^= 0x43fc3; // invert active-negative @@ -175,7 +175,7 @@ void tms0980_cpu_device::read_opcode() { debugger_instruction_hook(this, m_rom_address); m_opcode = m_program->read_word(m_rom_address) & 0x1ff; - m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes + m_c4 = bitswap<8>(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes m_fixed = m_fixed_decode[m_opcode]; m_micro = read_micro(); diff --git a/src/devices/cpu/tms1000/tms1000.cpp b/src/devices/cpu/tms1000/tms1000.cpp index 813f1da99f8..ce21213a1d2 100644 --- a/src/devices/cpu/tms1000/tms1000.cpp +++ b/src/devices/cpu/tms1000/tms1000.cpp @@ -8,7 +8,7 @@ TODO: - add TMS1270 (10 O pins, how does that work?) - add TMS1200C (has L input pins like TMS1600) - - add HALT input pin for TMS1000C + - add TMS1000C-specific mpla */ @@ -34,6 +34,13 @@ DEFINE_DEVICE_TYPE(TMS1700, tms1700_cpu_device, "tms1700", "TMS1700") // 28-p DEFINE_DEVICE_TYPE(TMS1730, tms1730_cpu_device, "tms1730", "TMS1730") // 20-pin DIP, same die as TMS1700, package has less pins: 6 R pins, 5 O pins (output PLA is still 8-bit, O1,O3,O5 unused) // CMOS versions (3-level stack, HALT pin) +// - RAM at top-left, ROM at top-right(rotate CCW) +// - ROM ordering is different: +// * row select is linear (0-63) +// * bit select is 7-0 instead of 0-7 +// * page select doesn't flip in the middle +// - 32-term mpla at bottom-right, different order +// - 32-term opla at bottom-left, ordered O7-O0(0 or 1), and A8,4,2,1,S DEFINE_DEVICE_TYPE(TMS1000C, tms1000c_cpu_device, "tms1000c", "TMS1000C") // 28-pin SDIP, 10 R pins // 2nd source Motorola chips @@ -122,6 +129,17 @@ MACHINE_CONFIG_MEMBER(tms1000_cpu_device::device_add_mconfig) MCFG_PLA_FILEFORMAT(BERKELEY) MACHINE_CONFIG_END +MACHINE_CONFIG_MEMBER(tms1000c_cpu_device::device_add_mconfig) + + // microinstructions PLA, output PLA + //MCFG_PLA_ADD("mpla", 8, 16, 32) + MCFG_PLA_ADD("mpla", 8, 16, 30) + MCFG_PLA_FILEFORMAT(BERKELEY) + MCFG_PLA_ADD("opla", 5, 8, 32) + MCFG_PLA_FILEFORMAT(BERKELEY) +MACHINE_CONFIG_END + + // disasm util::disasm_interface *tms1000_cpu_device::create_disassembler() { diff --git a/src/devices/cpu/tms1000/tms1000.h b/src/devices/cpu/tms1000/tms1000.h index 9e969dfc356..d5f53c890b6 100644 --- a/src/devices/cpu/tms1000/tms1000.h +++ b/src/devices/cpu/tms1000/tms1000.h @@ -69,6 +69,8 @@ public: protected: // overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual void op_br() override { op_br3(); } // 3-level stack virtual void op_call() override { op_call3(); } // " virtual void op_retn() override { op_retn3(); } // " diff --git a/src/devices/cpu/tms1000/tms1100.cpp b/src/devices/cpu/tms1000/tms1100.cpp index 70c38bc72c1..9f654009bbe 100644 --- a/src/devices/cpu/tms1000/tms1100.cpp +++ b/src/devices/cpu/tms1000/tms1100.cpp @@ -4,6 +4,9 @@ TMS1000 family - TMS1100, TMS1170, TMS1300, TMS1370 + TODO: + - add TMS1100C when needed + */ #include "emu.h" @@ -15,7 +18,7 @@ DEFINE_DEVICE_TYPE(TMS1100, tms1100_cpu_device, "tms1100", "TMS1100") // 28-pin DIP, 11 R pins DEFINE_DEVICE_TYPE(TMS1170, tms1170_cpu_device, "tms1170", "TMS1170") // high voltage version DEFINE_DEVICE_TYPE(TMS1300, tms1300_cpu_device, "tms1300", "TMS1300") // 40-pin DIP, 16 R pins -DEFINE_DEVICE_TYPE(TMS1370, tms1370_cpu_device, "tms1370", "TMS1370") // high voltage version +DEFINE_DEVICE_TYPE(TMS1370, tms1370_cpu_device, "tms1370", "TMS1370") // high voltage version, also seen in 28-pin package(some O/R pins unavailable) // internal memory maps diff --git a/src/devices/cpu/tms1000/tms1k_base.cpp b/src/devices/cpu/tms1000/tms1k_base.cpp index eb389fc6bc9..eaac999b2ce 100644 --- a/src/devices/cpu/tms1000/tms1k_base.cpp +++ b/src/devices/cpu/tms1000/tms1k_base.cpp @@ -5,7 +5,7 @@ TMS1000 family - base/shared TODO: - - 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 @@ -144,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; @@ -183,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)); @@ -224,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) + }; +} + //------------------------------------------------- @@ -259,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) - }; -} //------------------------------------------------- @@ -291,7 +294,7 @@ void tms1k_base_device::read_opcode() { debugger_instruction_hook(this, m_rom_address); m_opcode = m_program->read_byte(m_rom_address); - m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes + m_c4 = bitswap<8>(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes m_fixed = m_fixed_decode[m_opcode]; m_micro = m_micro_decode[m_opcode]; @@ -305,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 @@ -597,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: @@ -722,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); + } } diff --git a/src/devices/cpu/tms1000/tms1k_base.h b/src/devices/cpu/tms1000/tms1k_base.h index 7ddff2bb68f..b5e75ec77d2 100644 --- a/src/devices/cpu/tms1000/tms1k_base.h +++ b/src/devices/cpu/tms1000/tms1k_base.h @@ -38,6 +38,9 @@ #define MCFG_TMS1XXX_POWER_OFF_CB(_devcb) \ devcb = &tms1k_base_device::set_power_off_callback(*device, DEVCB_##_devcb); +// HALT input pin on CMOS chips (use set_input_line) +#define TMS1XXX_INPUT_LINE_HALT 0 + // pinout reference @@ -105,6 +108,7 @@ protected: virtual u32 execute_min_cycles() const override { return 1; } virtual u32 execute_max_cycles() const override { return 6; } virtual u32 execute_input_lines() const override { return 1; } + virtual void execute_set_input(int line, int state) override; virtual void execute_run() override; // device_memory_interface overrides @@ -214,50 +218,51 @@ protected: optional_device<pla_device> m_opla; optional_device<pla_device> m_spla; - u8 m_pc; // 6 or 7-bit program counter - u32 m_sr; // 6 or 7-bit subroutine return register(s) - u8 m_pa; // 4-bit page address register - u8 m_pb; // 4-bit page buffer register - u16 m_ps; // 4-bit page subroutine register(s) - u8 m_a; // 4-bit accumulator - u8 m_x; // 2,3,or 4-bit RAM X register - u8 m_y; // 4-bit RAM Y register - u8 m_ca; // chapter address register - u8 m_cb; // chapter buffer register - u16 m_cs; // chapter subroutine register(s) - u16 m_r; - u16 m_o; - u8 m_cki_bus; - u8 m_c4; - u8 m_p; // 4-bit adder p(lus)-input - u8 m_n; // 4-bit adder n(egative)-input - u8 m_adder_out; // adder result - u8 m_carry_in; // adder carry-in bit - u8 m_carry_out; // adder carry-out bit - u8 m_status; - u8 m_status_latch; - u8 m_eac; // end around carry bit - u8 m_clatch; // call latch bit(s) - u8 m_add; // add latch bit - u8 m_bl; // branch latch bit - - u8 m_ram_in; - u8 m_dam_in; - int m_ram_out; // signed! - u8 m_ram_address; - u16 m_rom_address; - u16 m_opcode; - u32 m_fixed; - u32 m_micro; - int m_subcycle; - int m_icount; - u8 m_o_index; - - u8 m_o_pins; // how many O pins - u8 m_r_pins; // how many R pins - u8 m_pc_bits; // how many program counter bits - u8 m_byte_bits; // how many bits per 'byte' - u8 m_x_bits; // how many X register bits + u8 m_pc; // 6 or 7-bit program counter + u32 m_sr; // 6 or 7-bit subroutine return register(s) + u8 m_pa; // 4-bit page address register + u8 m_pb; // 4-bit page buffer register + u16 m_ps; // 4-bit page subroutine register(s) + u8 m_a; // 4-bit accumulator + u8 m_x; // 2,3,or 4-bit RAM X register + u8 m_y; // 4-bit RAM Y register + u8 m_ca; // chapter address register + u8 m_cb; // chapter buffer register + u16 m_cs; // chapter subroutine register(s) + u16 m_r; + u16 m_o; + u8 m_cki_bus; + u8 m_c4; + u8 m_p; // 4-bit adder p(lus)-input + u8 m_n; // 4-bit adder n(egative)-input + u8 m_adder_out; // adder result + u8 m_carry_in; // adder carry-in bit + u8 m_carry_out; // adder carry-out bit + u8 m_status; + u8 m_status_latch; + u8 m_eac; // end around carry bit + u8 m_clatch; // call latch bit(s) + u8 m_add; // add latch bit + u8 m_bl; // branch latch bit + + u8 m_ram_in; + u8 m_dam_in; + int m_ram_out; // signed! + u8 m_ram_address; + u16 m_rom_address; + u16 m_opcode; + u32 m_fixed; + u32 m_micro; + int m_subcycle; + int m_icount; + u8 m_o_index; + bool m_halt; // halt pin state + + u8 m_o_pins; // how many O pins + u8 m_r_pins; // how many R pins + u8 m_pc_bits; // how many program counter bits + u8 m_byte_bits; // how many bits per 'byte' + u8 m_x_bits; // how many X register bits address_space *m_program; address_space *m_data; diff --git a/src/devices/cpu/tms1000/tp0320.cpp b/src/devices/cpu/tms1000/tp0320.cpp index 64ebdb3365a..8f10c9f2b62 100644 --- a/src/devices/cpu/tms1000/tp0320.cpp +++ b/src/devices/cpu/tms1000/tp0320.cpp @@ -67,7 +67,7 @@ u32 tp0320_cpu_device::decode_micro(u8 sel) { u32 decode = 0; - sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed + sel = bitswap<8>(sel,7,6,0,1,2,3,4,5); // lines are reversed u32 mask = m_mpla->read(sel); mask ^= 0x0bff0; // invert active-negative |