summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Michaël Banaan Ananas <happppp@users.noreply.github.com>2014-07-16 22:55:49 +0000
committer Michaël Banaan Ananas <happppp@users.noreply.github.com>2014-07-16 22:55:49 +0000
commit2bc1ef5ea7efbf706026a992bb2a30326cb7ff82 (patch)
treef634a75419f36f8b2b95c009440fcbb076f42136
parent03b8149a04eb20071470bfd53b583b179e35c021 (diff)
rewrote most of tms7000, fixing a few issues and adding preliminary support for TMS70x1/2 family
-rw-r--r--.gitattributes1
-rw-r--r--src/emu/cpu/cpu.mak3
-rw-r--r--src/emu/cpu/tms7000/7000dasm.c8
-rw-r--r--src/emu/cpu/tms7000/tms7000.c1047
-rw-r--r--src/emu/cpu/tms7000/tms7000.h434
-rw-r--r--src/emu/cpu/tms7000/tms70op.inc3715
-rw-r--r--src/emu/cpu/tms7000/tms70tb.inc124
-rw-r--r--src/mess/drivers/cc40.c2
-rw-r--r--src/mess/drivers/exelv.c20
9 files changed, 1221 insertions, 4133 deletions
diff --git a/.gitattributes b/.gitattributes
index 86d09177036..668b7d67d52 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2251,7 +2251,6 @@ src/emu/cpu/tms7000/7000dasm.c svneol=native#text/plain
src/emu/cpu/tms7000/tms7000.c svneol=native#text/plain
src/emu/cpu/tms7000/tms7000.h svneol=native#text/plain
src/emu/cpu/tms7000/tms70op.inc svneol=native#text/plain
-src/emu/cpu/tms7000/tms70tb.inc svneol=native#text/plain
src/emu/cpu/tms9900/9900dasm.c svneol=native#text/plain
src/emu/cpu/tms9900/99xxcore.h svneol=native#text/plain
src/emu/cpu/tms9900/ti990_10.c svneol=native#text/plain
diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak
index a0989c0b5b4..c70b60ee51a 100644
--- a/src/emu/cpu/cpu.mak
+++ b/src/emu/cpu/cpu.mak
@@ -2011,8 +2011,7 @@ endif
$(CPUOBJ)/tms7000/tms7000.o: $(CPUSRC)/tms7000/tms7000.h \
$(CPUSRC)/tms7000/tms7000.c \
- $(CPUSRC)/tms7000/tms70op.inc \
- $(CPUSRC)/tms7000/tms70tb.inc
+ $(CPUSRC)/tms7000/tms70op.inc
$(CPUOBJ)/tms7000/7000dasm.o: $(CPUSRC)/tms7000/tms7000.h \
$(CPUSRC)/tms7000/7000dasm.c
diff --git a/src/emu/cpu/tms7000/7000dasm.c b/src/emu/cpu/tms7000/7000dasm.c
index aa72329121b..33f49cb52d9 100644
--- a/src/emu/cpu/tms7000/7000dasm.c
+++ b/src/emu/cpu/tms7000/7000dasm.c
@@ -395,32 +395,27 @@ CPU_DISASSEMBLE( tms7000 )
case UI8:
a = (UINT8)opram[pos++];
buffer += sprintf(buffer, of[j].opstr[k], (unsigned int)a);
- //size += 1;
break;
case I8:
b = (INT8)opram[pos++];
buffer += sprintf (buffer, of[j].opstr[k], (INT8)b);
- //size += 1;
break;
case UI16:
c = (UINT16)opram[pos++];
c <<= 8;
c += opram[pos++];
buffer += sprintf (buffer, of[j].opstr[k], (unsigned int)c);
- //size += 2;
break;
case I16:
d = (INT16)opram[pos++];
d <<= 8;
d += opram[pos++];
buffer += sprintf (buffer, of[j].opstr[k], (signed int)d);
- //size += 2;
break;
case PCREL:
b = (INT8)opram[pos++];
sprintf(tmpbuf, "$%04X", pc+2+k+b);
buffer += sprintf (buffer, of[j].opstr[k], tmpbuf);
- //size += 1;
break;
case PCABS:
c = (UINT16)opram[pos++];
@@ -428,11 +423,10 @@ CPU_DISASSEMBLE( tms7000 )
c += opram[pos++];
sprintf(tmpbuf, "$%04X", c);
buffer += sprintf (buffer, of[j].opstr[k], tmpbuf);
- //size += 2;
break;
case TRAP:
vector = 0xffff - ((0xff - opcode) * 2);
- c = vector;//(UINT16)((memory_decrypted_read_byte( vector-1 ) << 8) + memory_decrypted_read_byte( vector ));
+ c = vector;
break;
}
}
diff --git a/src/emu/cpu/tms7000/tms7000.c b/src/emu/cpu/tms7000/tms7000.c
index 87fac1d116f..f831b2d8a3f 100644
--- a/src/emu/cpu/tms7000/tms7000.c
+++ b/src/emu/cpu/tms7000/tms7000.c
@@ -18,11 +18,13 @@
*****************************************************************************
* Misc. improvements were done over the years by team MESS/MAME
*
- * Currently this source emulates a TMS70x0, not any of the other variants
- * Unimplemented is the MC pin which (in conjunection with IOCNT0 bits 7 and 6
- * control the memory mapping.
+ * TODO:
+ * - dump CROM and emulate cpu at microinstruction level
+ * - memory modes with IOCNT0, currently ignored
+ * - timer event counter mode (timer control register, bit 6)
+ * - TMS70x1/2 serial port and timer 3
+ * - when they're needed, add TMS70Cx2, TMS7742, TMS77C82, SE70xxx
*
- * This source implements the MC pin at Vss and mode bits in single chip mode.
*****************************************************************************/
#include "debugger.h"
@@ -32,19 +34,16 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
+// flag helpers
+#define SR_C 0x80 /* Carry */
+#define SR_N 0x40 /* Negative */
+#define SR_Z 0x20 /* Zero */
+#define SR_I 0x10 /* Interrupt */
-#define RM(Addr) ((unsigned)m_program->read_byte(Addr))
-#define WM(Addr,Value) (m_program->write_byte(Addr, Value))
-
-#define IMMBYTE(b) b = ((unsigned)m_direct->read_raw_byte(pPC)); pPC++
-#define SKIPBYTE() ((unsigned)m_direct->read_raw_byte(pPC)); pPC++
-#define SIMMBYTE(b) b = ((signed)m_direct->read_raw_byte(pPC)); pPC++
-#define IMMWORD(w) w.b.h = (unsigned)m_direct->read_raw_byte(pPC++); w.b.l = (unsigned)m_direct->read_raw_byte(pPC++)
-
-#define PUSHBYTE(b) pSP++; WM(pSP,b)
-#define PUSHWORD(w) pSP++; WM(pSP,w.b.h); pSP++; WM(pSP,w.b.l)
-#define PULLBYTE(b) b = RM(pSP); pSP--
-#define PULLWORD(w) w.b.l = RM(pSP); pSP--; w.b.h = RM(pSP); pSP--
+#define GET_C() (m_sr >> 7 & 1)
+#define SET_C(x) m_sr = (m_sr & 0x7f) | ((x) >> 1 & 0x80)
+#define SET_NZ(x) m_sr = (m_sr & 0x9f) | ((x) >> 1 & 0x40) | (((x) & 0xff) ? 0 : 0x20)
+#define SET_CNZ(x) m_sr = (m_sr & 0x1f) | ((x) >> 1 & 0xc0) | (((x) & 0xff) ? 0 : 0x20)
const device_type TMS7000 = &device_creator<tms7000_device>;
@@ -54,15 +53,35 @@ const device_type TMS7040 = &device_creator<tms7040_device>;
const device_type TMS70C00 = &device_creator<tms70c00_device>;
const device_type TMS70C20 = &device_creator<tms70c20_device>;
const device_type TMS70C40 = &device_creator<tms70c40_device>;
+const device_type TMS7001 = &device_creator<tms7001_device>;
+const device_type TMS7041 = &device_creator<tms7041_device>;
+const device_type TMS7002 = &device_creator<tms7002_device>;
+const device_type TMS7042 = &device_creator<tms7042_device>;
+
+// internal memory maps
static ADDRESS_MAP_START(tms7000_io, AS_IO, 8, tms7000_device)
- AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_WRITENOP
AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_READNOP
ADDRESS_MAP_END
static ADDRESS_MAP_START(tms7000_mem, AS_PROGRAM, 8, tms7000_device )
AM_RANGE(0x0000, 0x007f) AM_RAM // 128 bytes internal RAM
- AM_RANGE(0x0100, 0x010f) AM_READWRITE(tms70x0_pf_r, tms70x0_pf_w) /* tms7000 internal I/O ports */
+ AM_RANGE(0x0080, 0x00ff) AM_READWRITE(tms7000_unmapped_rf_r, tms7000_unmapped_rf_w)
+ AM_RANGE(0x0104, 0x0105) AM_WRITENOP // no port A write or ddr
+ AM_RANGE(0x0100, 0x010b) AM_READWRITE(tms7000_pf_r, tms7000_pf_w)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START(tms7001_mem, AS_PROGRAM, 8, tms7000_device )
+ AM_RANGE(0x0000, 0x007f) AM_RAM // 128 bytes internal RAM
+ AM_RANGE(0x0080, 0x00ff) AM_READWRITE(tms7000_unmapped_rf_r, tms7000_unmapped_rf_w)
+ AM_RANGE(0x0100, 0x010b) AM_READWRITE(tms7000_pf_r, tms7000_pf_w)
+ AM_RANGE(0x0110, 0x0117) AM_READWRITE(tms7002_pf_r, tms7002_pf_w)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START(tms7002_mem, AS_PROGRAM, 8, tms7000_device )
+ AM_RANGE(0x0000, 0x00ff) AM_RAM // 256 bytes internal RAM
+ AM_RANGE(0x0100, 0x010b) AM_READWRITE(tms7000_pf_r, tms7000_pf_w)
+ AM_RANGE(0x0110, 0x0117) AM_READWRITE(tms7002_pf_r, tms7002_pf_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START(tms7020_mem, AS_PROGRAM, 8, tms7000_device )
@@ -75,164 +94,151 @@ static ADDRESS_MAP_START(tms7040_mem, AS_PROGRAM, 8, tms7000_device )
AM_IMPORT_FROM( tms7000_mem )
ADDRESS_MAP_END
+static ADDRESS_MAP_START(tms7041_mem, AS_PROGRAM, 8, tms7000_device )
+ AM_RANGE(0xf000, 0xffff) AM_ROM
+ AM_IMPORT_FROM( tms7001_mem )
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START(tms7042_mem, AS_PROGRAM, 8, tms7000_device )
+ AM_RANGE(0xf000, 0xffff) AM_ROM
+ AM_IMPORT_FROM( tms7002_mem )
+ADDRESS_MAP_END
+
+// device definitions
tms7000_device::tms7000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, TMS7000, "TMS7000", tag, owner, clock, "tms7000", __FILE__),
m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, ADDRESS_MAP_NAME(tms7000_mem)),
m_io_config("io", ENDIANNESS_BIG, 8, 8, 0, ADDRESS_MAP_NAME(tms7000_io)),
- m_opcode(s_opfn)
+ m_info_flags(0)
{
}
-tms7000_device::tms7000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal, const opcode_func *opcode, const char *shortname, const char *source)
+tms7000_device::tms7000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal, UINT32 info_flags, const char *shortname, const char *source)
: cpu_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, internal),
m_io_config("io", ENDIANNESS_BIG, 8, 8, 0, ADDRESS_MAP_NAME(tms7000_io)),
- m_opcode(opcode)
+ m_info_flags(info_flags)
{
}
tms7020_device::tms7020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : tms7000_device(mconfig, TMS7020, "TMS7020", tag, owner, clock, ADDRESS_MAP_NAME(tms7020_mem), s_opfn, "tms7020", __FILE__)
+ : tms7000_device(mconfig, TMS7020, "TMS7020", tag, owner, clock, ADDRESS_MAP_NAME(tms7020_mem), 0, "tms7020", __FILE__)
{
}
tms7020_exl_device::tms7020_exl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : tms7000_device(mconfig, TMS7020_EXL, "TMS7020 (EXL)", tag, owner, clock, ADDRESS_MAP_NAME(tms7020_mem), s_opfn_exl, "tms7020_exl", __FILE__)
+ : tms7000_device(mconfig, TMS7020_EXL, "TMS7020 (Exelvision)", tag, owner, clock, ADDRESS_MAP_NAME(tms7020_mem), 0, "tms7020_exl", __FILE__)
{
}
tms7040_device::tms7040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : tms7000_device(mconfig, TMS7040, "TMS7040", tag, owner, clock, ADDRESS_MAP_NAME(tms7040_mem), s_opfn, "tms7040", __FILE__)
+ : tms7000_device(mconfig, TMS7040, "TMS7040", tag, owner, clock, ADDRESS_MAP_NAME(tms7040_mem), 0, "tms7040", __FILE__)
{
}
tms70c00_device::tms70c00_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : tms7000_device(mconfig, TMS70C00, "TMS70C00", tag, owner, clock, ADDRESS_MAP_NAME(tms7000_mem), s_opfn, "tms70c00", __FILE__)
+ : tms7000_device(mconfig, TMS70C00, "TMS70C00", tag, owner, clock, ADDRESS_MAP_NAME(tms7000_mem), TMS7000_CHIP_IS_CMOS, "tms70c00", __FILE__)
{
}
tms70c20_device::tms70c20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : tms7000_device(mconfig, TMS70C20, "TMS70C20", tag, owner, clock, ADDRESS_MAP_NAME(tms7020_mem), s_opfn, "tms70c20", __FILE__)
+ : tms7000_device(mconfig, TMS70C20, "TMS70C20", tag, owner, clock, ADDRESS_MAP_NAME(tms7020_mem), TMS7000_CHIP_IS_CMOS, "tms70c20", __FILE__)
{
}
tms70c40_device::tms70c40_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : tms7000_device(mconfig, TMS70C40, "TMS70C40", tag, owner, clock, ADDRESS_MAP_NAME(tms7040_mem), s_opfn, "tms70c40", __FILE__)
+ : tms7000_device(mconfig, TMS70C40, "TMS70C40", tag, owner, clock, ADDRESS_MAP_NAME(tms7040_mem), TMS7000_CHIP_IS_CMOS, "tms70c40", __FILE__)
{
}
-
-offs_t tms7000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
+tms7001_device::tms7001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : tms7000_device(mconfig, TMS7001, "TMS7001", tag, owner, clock, ADDRESS_MAP_NAME(tms7001_mem), TMS7000_CHIP_FAMILY_70X2, "tms7001", __FILE__)
{
- extern CPU_DISASSEMBLE( tms7000 );
- return CPU_DISASSEMBLE_NAME(tms7000)(this, buffer, pc, oprom, opram, options);
}
-
-#define pPC m_pc.w.l
-#define PC m_pc
-#define pSP m_sp
-#define pSR m_sr
-
-#define RDA RM(0x0000)
-#define RDB RM(0x0001)
-
-#define WRA(Value) (WM(0x0000,Value))
-#define WRB(Value) (WM(0x0001,Value))
-
-#define SR_C 0x80 /* Carry */
-#define SR_N 0x40 /* Negative */
-#define SR_Z 0x20 /* Zero */
-#define SR_I 0x10 /* Interrupt */
-
-#define CLR_NZC pSR&=~(SR_N|SR_Z|SR_C)
-#define CLR_NZCI pSR&=~(SR_N|SR_Z|SR_C|SR_I)
-#define SET_C8(a) pSR|=((a&0x0100)>>1)
-#define SET_N8(a) pSR|=((a&0x0080)>>1)
-#define SET_Z(a) if(!a)pSR|=SR_Z
-#define SET_Z8(a) SET_Z((UINT8)a)
-#define SET_Z16(a) SET_Z((UINT8)a>>8)
-#define GET_C (pSR >> 7)
-
-#define SET_N16(a) pSR|=(((a)&0x008000)>>9)
-
-/* Not working */
-#define SET_C16(a) pSR|=((a&0x010000)>>9)
-
-#define SETC pSR |= SR_C
-#define SETZ pSR |= SR_Z
-#define SETN pSR |= SR_N
-
-
-UINT16 tms7000_device::RM16( UINT32 mAddr ) /* Read memory (16-bit) */
+tms7041_device::tms7041_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : tms7000_device(mconfig, TMS7041, "TMS7041", tag, owner, clock, ADDRESS_MAP_NAME(tms7041_mem), TMS7000_CHIP_FAMILY_70X2, "tms7041", __FILE__)
{
- UINT32 result = RM(mAddr) << 8;
- return result | RM((mAddr+1)&0xffff);
}
-UINT16 tms7000_device::RRF16( UINT32 mAddr ) /* Read register file (16 bit) */
+tms7002_device::tms7002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : tms7000_device(mconfig, TMS7002, "TMS7002", tag, owner, clock, ADDRESS_MAP_NAME(tms7002_mem), TMS7000_CHIP_FAMILY_70X2, "tms7002", __FILE__)
{
- PAIR result;
- result.b.h = RM((mAddr-1)&0xffff);
- result.b.l = RM(mAddr);
- return result.w.l;
}
-void tms7000_device::WRF16( UINT32 mAddr, PAIR p ) /* Write register file (16 bit) */
+tms7042_device::tms7042_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : tms7000_device(mconfig, TMS7042, "TMS7042", tag, owner, clock, ADDRESS_MAP_NAME(tms7042_mem), TMS7000_CHIP_FAMILY_70X2, "tms7042", __FILE__)
{
- WM( (mAddr-1)&0xffff, p.b.h );
- WM( mAddr, p.b.l );
}
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
void tms7000_device::device_start()
{
+ // init/zerofill
m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct();
m_io = &space(AS_IO);
- memset(m_pf, 0, 0x100);
- m_cycles_per_INT2 = 0;
- m_t1_capture_latch = 0;
- m_t1_prescaler = 0;
- m_t1_decrementer = 0;
- memset(&m_pc, 0x00, sizeof(m_pc));
- m_sp = 0;
- m_sr = 0;
- m_idle_state = 0;
+ m_icountptr = &m_icount;
- /* Save register state */
- save_item(NAME(pPC));
- save_item(NAME(pSP));
- save_item(NAME(pSR));
+ m_irq_state[TMS7000_INT1_LINE] = false;
+ m_irq_state[TMS7000_INT3_LINE] = false;
- /* Save Interrupt state */
- save_item(NAME(m_irq_state));
+ m_idle_state = false;
+ m_idle_halt = false;
+ m_pc = 0;
+ m_sp = 0;
+ m_sr = 0;
+ m_op = 0;
- /* Save register and perpherial file state */
- save_item(NAME(m_pf));
+ memset(m_io_control, 0, 3);
- /* Save timer state */
- save_item(NAME(m_t1_prescaler));
- save_item(NAME(m_t1_capture_latch));
- save_item(NAME(m_t1_decrementer));
+ memset(m_port_latch, 0, 4);
+ memset(m_port_ddr, 0, 4);
+ m_port_ddr[1] = 0xff; // !
+ 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]->adjust(attotime::never, tmr);
+
+ m_timer_data[tmr] = 0;
+ m_timer_control[tmr] = 0;
+ m_timer_decrementer[tmr] = 0;
+ m_timer_prescaler[tmr] = 0;
+ m_timer_capture_latch[tmr] = 0;
+ }
+
+ // register for savestates
+ save_item(NAME(m_irq_state));
save_item(NAME(m_idle_state));
-
- state_add( TMS7000_PC, "PC", m_pc.w.l).formatstr("%04X");
- state_add( TMS7000_SP, "S", m_sp).formatstr("%02X");
- state_add( TMS7000_ST, "ST", m_sr).formatstr("%02X");
- state_add( TMS7000_IDLE, "Idle", m_idle_state).formatstr("%02X");
- state_add( TMS7000_T1_CL, "T1CL", m_t1_capture_latch).formatstr("%02X");
- state_add( TMS7000_T1_PS, "T1PS", m_t1_prescaler).mask(0x1f).formatstr("%02X");
- state_add( TMS7000_T1_DEC, "T1DEC", m_t1_decrementer).mask(0xff).formatstr("%02X");
-
- state_add(STATE_GENPC, "GENPC", m_pc.w.l).formatstr("%04X").noshow();
+ save_item(NAME(m_pc));
+ save_item(NAME(m_sp));
+ save_item(NAME(m_sr));
+ save_item(NAME(m_op));
+
+ save_item(NAME(m_io_control));
+ save_item(NAME(m_port_latch));
+ save_item(NAME(m_port_ddr));
+ save_item(NAME(m_timer_data));
+ save_item(NAME(m_timer_control));
+ save_item(NAME(m_timer_decrementer));
+ save_item(NAME(m_timer_prescaler));
+ 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_ST, "ST", m_sr).formatstr("%02X");
+
+ state_add(STATE_GENPC, "GENPC", m_pc).formatstr("%02X").noshow();
state_add(STATE_GENSP, "GENSP", m_sp).formatstr("%02X").noshow();
- state_add(STATE_GENFLAGS, "GENFLAGS", m_sr).formatstr("%8s").noshow();
-
- m_icountptr = &m_icount;
+ state_add(STATE_GENFLAGS, "GENFLAGS", m_sr).formatstr("%8s").noshow();
}
void tms7000_device::state_string_export(const device_state_entry &entry, astring &string)
@@ -241,378 +247,609 @@ void tms7000_device::state_string_export(const device_state_entry &entry, astrin
{
case STATE_GENFLAGS:
string.printf("%c%c%c%c%c%c%c%c",
- m_sr & 0x80 ? 'C':'c',
- m_sr & 0x40 ? 'N':'n',
- m_sr & 0x20 ? 'Z':'z',
- m_sr & 0x10 ? 'I':'i',
- m_sr & 0x08 ? '?':'.',
- m_sr & 0x04 ? '?':'.',
- m_sr & 0x02 ? '?':'.',
- m_sr & 0x01 ? '?':'.'
+ m_sr & 0x80 ? 'C':'c',
+ m_sr & 0x40 ? 'N':'n',
+ m_sr & 0x20 ? 'Z':'z',
+ m_sr & 0x10 ? 'I':'i',
+ m_sr & 0x08 ? '?':'.',
+ m_sr & 0x04 ? '?':'.',
+ m_sr & 0x02 ? '?':'.',
+ m_sr & 0x01 ? '?':'.'
);
break;
+
+ default: break;
}
}
-void tms7000_device::device_reset()
+offs_t tms7000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
{
-// m_architecture = (int)param;
-
- m_idle_state = 0;
- m_irq_state[ TMS7000_IRQ1_LINE ] = CLEAR_LINE;
- m_irq_state[ TMS7000_IRQ2_LINE ] = CLEAR_LINE;
- m_irq_state[ TMS7000_IRQ3_LINE ] = CLEAR_LINE;
-
- WM( 0x100 + 9, 0 ); /* Data direction regs are cleared */
- WM( 0x100 + 11, 0 );
-
-// if( m_architecture == TMS7000_NMOS )
-// {
- WM( 0x100 + 4, 0xff ); /* Output 0xff on port A */
- WM( 0x100 + 8, 0xff ); /* Output 0xff on port C */
- WM( 0x100 + 10, 0xff ); /* Output 0xff on port D */
-// }
-// else
-// {
-// WM( 0x100 + 4, 0xff ); /* Output 0xff on port A */
-// }
-
- pSP = 0x01; /* Set stack pointer to r1 */
- pSR = 0x00; /* Clear status register (disabling interrupts */
- WM( 0x100 + 0, 0 ); /* Write a zero to IOCNT0 */
-
- /* On TMS70x2 and TMS70Cx2 IOCNT1 is zero */
-
- WRA( m_pc.b.h ); /* Write previous PC to A:B */
- WRB( m_pc.b.l );
- pPC = RM16(0xfffe); /* Load reset vector */
-
- m_div_by_16_trigger = -16;
+ extern CPU_DISASSEMBLE( tms7000 );
+ return CPU_DISASSEMBLE_NAME(tms7000)(this, buffer, pc, oprom, opram, options);
}
-void tms7000_device::execute_set_input(int irqline, int state)
-{
- if (m_irq_state[irqline] != state)
- { /* check for transition */
- m_irq_state[irqline] = state;
- LOG(("tms7000: (cpu '%s') set_irq_line (INT%d, state %d)\n", tag(), irqline+1, state));
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
- if (state == CLEAR_LINE)
- {
- return;
- }
-
- m_pf[0] |= (0x02 << (irqline * 2)); /* Set INTx iocntl0 flag */
+void tms7000_device::device_reset()
+{
+ if (m_idle_state)
+ {
+ m_pc++;
+ m_idle_state = false;
+ }
- if( irqline == TMS7000_IRQ3_LINE )
- {
- /* Latch the value in perpherial file register 3 */
- m_t1_capture_latch = m_t1_decrementer & 0x00ff;
- }
+ // while _RESET is asserted:
+ // clear ports
+ write_p(0x04, 0xff); // port a
+ write_p(0x06, 0xff); // port b
- tms7000_check_IRQ_lines();
+ write_p(0x05, 0x00); // ddr a
+ write_p(0x09, 0x00); // ddr c
+ write_p(0x0b, 0x00); // ddr d
+
+ if (!chip_is_cmos())
+ {
+ write_p(0x08, 0xff); // port c
+ write_p(0x0a, 0xff); // port d
}
+
+ // when _RESET goes inactive (0 to 1)
+ m_sr = 0;
+
+ write_p(0x00, 0x00); // IOCNT0
+ if (chip_is_family_70x2())
+ write_p(0x10, 0x00); // IOCNT1
+
+ write_mem16(0, m_pc); // previous PC
+ m_sp = 0x01;
+ m_pc = read_mem16(0xfffe);
+ m_icount -= 17;
}
-void tms7000_device::tms7000_check_IRQ_lines()
+
+//-------------------------------------------------
+// interrupts
+//-------------------------------------------------
+
+void tms7000_device::execute_set_input(int irqline, int state)
{
- if( pSR & SR_I ) /* Check Global Interrupt bit: Status register, bit 4 */
- {
- if ((m_irq_state[TMS7000_IRQ1_LINE] == ASSERT_LINE) || (m_pf[0] & 0x02))
- {
- if( m_pf[0] & 0x01 ) /* INT1 Enable bit */
- {
- tms7000_do_interrupt( 0xfffc, TMS7000_IRQ1_LINE );
- m_pf[0] &= ~0x02; /* Data Manual, page: 9-41 */
- return;
- }
- }
+ assert(irqline == TMS7000_INT1_LINE || irqline == TMS7000_INT3_LINE);
+ bool irqstate = (state == CLEAR_LINE) ? false : true;
- if( m_irq_state[ TMS7000_IRQ2_LINE ] == ASSERT_LINE )
- {
- if( m_pf[0] & 0x04 ) /* INT2 Enable bit */
- {
- tms7000_do_interrupt( 0xfffa, TMS7000_IRQ2_LINE );
- return;
- }
- }
+ // reverse polarity (70cx2-only)
+ if (m_io_control[2] & (0x01 << (4 * irqline)))
+ irqstate = !irqstate;
- if ((m_irq_state[TMS7000_IRQ3_LINE] == ASSERT_LINE) || (m_pf[0] & 0x20))
+ if (m_irq_state[irqline] != irqstate)
+ {
+ m_irq_state[irqline] = irqstate;
+
+ // set/clear internal irq flag
+ flag_ext_interrupt(irqline);
+
+ if (m_irq_state[irqline])
{
- if( m_pf[0] & 0x10 ) /* INT3 Enable bit */
- {
- tms7000_do_interrupt( 0xfff8, TMS7000_IRQ3_LINE );
- m_pf[0] &= ~0x20; /* Data Manual, page: 9-41 */
- return;
- }
+ // latch timer 1 on INT3
+ if (irqline == TMS7000_INT3_LINE)
+ m_timer_capture_latch[0] = m_timer_decrementer[0];
+
+ // on 70cx2, latch timer 2 on INT1
+ if (irqline == TMS7000_INT1_LINE && chip_is_family_70cx2())
+ m_timer_capture_latch[1] = m_timer_decrementer[1];
+
+ // clear external if it's edge-triggered (70cx2-only)
+ if (m_io_control[2] & (0x02 << (4 * irqline)))
+ m_irq_state[irqline] = false;
+
+ check_interrupts();
}
}
}
-void tms7000_device::tms7000_do_interrupt( UINT16 address, UINT8 line )
+void tms7000_device::flag_ext_interrupt(int irqline)
{
- PUSHBYTE( pSR ); /* Push Status register */
- PUSHWORD( PC ); /* Push Program Counter */
- pSR = 0; /* Clear Status register */
- pPC = RM16(address); /* Load PC with interrupt vector */
+ if (irqline != TMS7000_INT1_LINE && irqline != TMS7000_INT3_LINE)
+ return;
- if( m_idle_state == 0 )
- m_icount -= 19; /* 19 cycles used */
+ // set/clear for pending external interrupt
+ if (m_irq_state[irqline])
+ m_io_control[0] |= (0x02 << (4 * irqline));
else
- {
- m_icount -= 17; /* 17 if idled */
- m_idle_state = 0;
- }
-
- standard_irq_callback(line);
+ m_io_control[0] &= ~(0x02 << (4 * irqline));
}
-#include "tms70op.inc"
-#include "tms70tb.inc"
-
-void tms7000_device::execute_run()
+void tms7000_device::check_interrupts()
{
- int op;
-
- m_div_by_16_trigger += m_icount;
-
- tms7000_check_IRQ_lines();
-
- do
+ // global interrupt bit
+ if (!(m_sr & SR_I))
+ return;
+
+ // check for and handle interrupt
+ for (int irqline = 0; irqline < 5; irqline++)
{
- debugger_instruction_hook(this, pPC);
-
- if( m_idle_state == 0 )
+ // INT 1,2,3 are in IOCNT0 d0-d5
+ // INT 4,5 are in IOCNT1 d0-d3
+ int shift = (irqline > 2) ? irqline * 2 - 6 : irqline * 2;
+ if ((m_io_control[irqline > 2] >> shift & 3) == 3)
{
- op = m_direct->read_decrypted_byte(pPC++);
-
- (this->*m_opcode[op])();
+ // ack
+ m_io_control[irqline > 2] &= ~(0x02 << shift);
+
+ flag_ext_interrupt(irqline);
+ do_interrupt(irqline);
+ return;
}
- else
- m_icount -= 16;
-
- /* Internal timer system */
-
- while( m_icount < m_div_by_16_trigger )
- {
- m_div_by_16_trigger -= 16;
+ }
+}
- if( (m_pf[0x03] & 0x80) == 0x80 ) /* Is timer system active? */
- {
- if( (m_pf[0x03] & 0x40) != 0x40) /* Is system clock (divided by 16) the timer source? */
- tms7000_service_timer1();
- }
- }
+void tms7000_device::do_interrupt(int irqline)
+{
+ if (m_idle_state)
+ {
+ m_icount -= 17;
+ m_pc++;
+ m_idle_state = false;
+ }
+ else
+ m_icount -= 19;
- } while( m_icount > 0 );
+ push8(m_sr);
+ push16(m_pc);
+ m_sr = 0;
+ m_pc = read_mem16(0xfffc - irqline * 2);
- m_div_by_16_trigger -= m_icount;
+ standard_irq_callback(irqline);
}
-/****************************************************************************
- * Trigger the event counter
- ****************************************************************************/
+//-------------------------------------------------
+// timers
+//-------------------------------------------------
-void tms7000_device::tms7000_service_timer1()
+void tms7000_device::timer_run(int tmr)
{
- if( --m_t1_prescaler < 0 ) /* Decrement prescaler and check for underflow */
+ m_timer_prescaler[tmr] = m_timer_control[tmr] & 0x1f;
+
+ // run automatic timer if source is internal
+ if ((m_timer_control[tmr] & 0xe0) == 0x80)
{
- m_t1_prescaler = m_pf[3] & 0x1f; /* Reload prescaler (5 bit) */
+ attotime period = attotime::from_hz(clock()) * 16 * (m_timer_prescaler[tmr] + 1); // fOSC/16
+ m_timer_handle[tmr]->adjust(period, tmr);
+ }
+}
- if( --m_t1_decrementer < 0 ) /* Decrement timer1 register and check for underflow */
- {
- m_t1_decrementer = m_pf[2]; /* Reload decrementer (8 bit) */
- set_input_line(TMS7000_IRQ2_LINE, HOLD_LINE);
- //LOG( ("tms7000: trigger int2 (cycles: %d)\t%d\tdelta %d\n", total_cycles(), total_cycles() - tick, m_cycles_per_INT2-(total_cycles() - tick) );
- //tick = total_cycles() );
- /* Also, cascade out to timer 2 - timer 2 unimplemented */
- }
+void tms7000_device::timer_reload(int tmr)
+{
+ // stop possible running timer
+ m_timer_handle[tmr]->adjust(attotime::never, tmr);
+
+ if (m_timer_control[tmr] & 0x80)
+ {
+ m_timer_decrementer[tmr] = m_timer_data[tmr];
+ timer_run(tmr);
}
-// LOG( ( "tms7000: service timer1. 0x%2.2x 0x%2.2x (cycles %d)\t%d\t\n", m_t1_prescaler, m_t1_decrementer, total_cycles(), total_cycles() - tick2 ) );
-// tick2 = total_cycles();
}
-WRITE8_MEMBER( tms7000_device::tms70x0_pf_w ) /* Perpherial file write */
+void tms7000_device::timer_tick_pre(int tmr)
{
- UINT8 temp1, temp2, temp3;
+ // timer prescaler underflow
+ if (--m_timer_prescaler[tmr] < 0)
+ {
+ m_timer_prescaler[tmr] = m_timer_control[tmr] & 0x1f;
+ timer_tick_low(tmr);
+ }
+}
- switch( offset )
+void tms7000_device::timer_tick_low(int tmr)
+{
+ // timer decrementer underflow
+ if (--m_timer_decrementer[tmr] < 0)
{
- case 0x00: /* IOCNT0, Input/Ouput control */
- temp1 = data & 0x2a; /* Record which bits to clear */
- temp2 = m_pf[0x00] & 0x2a; /* Get copy of current bits */
- temp3 = (~temp1) & temp2; /* Clear the requested bits */
- m_pf[0x00] = temp3 | (data & (~0x2a) ); /* OR in the remaining data */
- break;
- case 0x02:
- m_t1_decrementer = m_pf[0x02] = data;
- m_cycles_per_INT2 = 0x10*((m_pf[3] & 0x1f)+1)*(m_pf[0x02]+1);
- LOG( ( "tms7000: Timer adjusted. Decrementer: 0x%2.2x (Cycles per interrupt: %d)\n", m_t1_decrementer, m_cycles_per_INT2 ) );
- break;
- case 0x03: /* T1CTL, timer 1 control */
- if( ((m_pf[0x03] & 0x80) == 0) && ((data & 0x80) == 0x80 ) ) /* Start timer? */
- {
- m_pf[0x03] = data;
- m_t1_prescaler = m_pf[3] & 0x1f; /* Reload prescaler (5 bit) */
- m_cycles_per_INT2 = 0x10*((m_pf[3] & 0x1f)+1)*(m_pf[0x02]+1);
- LOG( ( "tms7000: Timer started. Prescaler: 0x%2.2x (Cycles per interrupt: %d)\n", m_pf[3] & 0x1f, m_cycles_per_INT2 ) );
- }
- else if( ((data & 0x80) == 0x80 ) && ((m_pf[0x03] & 0x80) == 0) ) /* Timer Stopped? */
- {
- m_pf[0x03] = data;
- m_t1_prescaler = m_pf[3] & 0x1f; /* Reload prescaler (5 bit) */
- m_cycles_per_INT2 = 0x10*((m_pf[3] & 0x1f)+1)*(m_pf[0x02]+1);
- LOG( ( "tms7000: Timer stopped. Prescaler: 0x%2.2x (Cycles per interrupt: %d)\n", m_pf[3] & 0x1f, m_cycles_per_INT2 ) );
- }
- else /* Don't modify timer state, but still store data */
- {
- m_pf[0x03] = data;
- m_cycles_per_INT2 = 0x10*((m_pf[3] & 0x1f)+1)*(m_pf[0x02]+1);
- LOG( ( "tms7000: Timer adjusted. Prescaler: 0x%2.2x (Cycles per interrupt: %d)\n", m_pf[3] & 0x1f, m_cycles_per_INT2 ) );
- }
- break;
+ timer_reload(tmr);
+
+ // set INT2/INT5
+ m_io_control[tmr] |= 0x08;
+
+ // cascaded timer
+ if (tmr == 0 && (m_timer_control[1] & 0xa0) == 0xa0)
+ timer_tick_pre(tmr + 1);
+ }
+}
- case 0x04: /* Port A write */
- /* Port A is read only so this is a NOP */
- break;
+TIMER_CALLBACK_MEMBER(tms7000_device::simple_timer_cb)
+{
+ int tmr = param;
+
+ // tick and restart timer
+ timer_tick_low(tmr);
+ timer_run(tmr);
+}
- case 0x06: /* Port B write */
- m_io->write_byte( TMS7000_PORTB, data );
- m_pf[ 0x06 ] = data;
- break;
- case 0x08: /* Port C write */
- temp1 = data & m_pf[ 0x09 ]; /* Mask off input bits */
- m_io->write_byte( TMS7000_PORTC, temp1 );
- m_pf[ 0x08 ] = temp1;
- break;
+//-------------------------------------------------
+// peripheral file - read/write internal ports
+// note: 7000 family is from $00 to $0b, 7002 family adds $10 to $17
+//-------------------------------------------------
- case 0x0a: /* Port D write */
- temp1 = data & m_pf[ 0x0b ]; /* Mask off input bits */
- m_io->write_byte( TMS7000_PORTD, temp1 );
- m_pf[ 0x0a ] = temp1;
- break;
+READ8_MEMBER(tms7000_device::tms7000_pf_r)
+{
+ switch (offset)
+ {
+ // i/o control
+ case 0x00: case 0x10:
+ return m_io_control[offset >> 4];
+
+ // timer 1/2 data
+ case 0x02: case 0x12:
+ // current decrementer value
+ return m_timer_decrementer[offset >> 4];
+
+ // timer 1 control
+ case 0x03:
+ // timer capture (latched by INT3)
+ return m_timer_capture_latch[0];
+
+ // port data
+ case 0x04: case 0x06: case 0x08: case 0x0a:
+ {
+ // note: port B is write-only, reading it returns the output value as if ddr is 0xff
+ int port = offset / 2 - 2;
+ return (m_io->read_byte(port) & ~m_port_ddr[port]) | (m_port_latch[port] & m_port_ddr[port]);
+ }
+
+ // port direction (note: 7000 doesn't support it for port A)
+ case 0x05: case 0x09: case 0x0b:
+ return m_port_ddr[offset / 2 - 2];
default:
- /* Just stuff the other registers */
- m_pf[ offset ] = data;
+ logerror("%s: tms7000_pf_r @ $%04x\n", tag(), offset);
break;
}
+
+ return 0;
}
-READ8_MEMBER( tms7000_device::tms70x0_pf_r ) /* Perpherial file read */
+WRITE8_MEMBER(tms7000_device::tms7000_pf_w)
{
- UINT8 result;
- UINT8 temp1, temp2, temp3;
-
- switch( offset )
+ switch (offset)
{
- case 0x00: /* IOCNT0, Input/Ouput control */
- result = m_pf[0x00];
- if (m_irq_state[TMS7000_IRQ1_LINE] == ASSERT_LINE)
- result |= 0x02;
- if (m_irq_state[TMS7000_IRQ3_LINE] == ASSERT_LINE)
- result |= 0x20;
- break;
-
- case 0x02: /* T1DATA, timer 1 8-bit decrementer */
- result = (m_t1_decrementer & 0x00ff);
+ // i/o control (IOCNT0)
+ case 0x00:
+ // d0,d2,d4: INT1,2,3 enable
+ // d1,d3,d5: INT1,2,3 flag (write 1 to clear flag)
+ // d6-d7: memory mode (currently not implemented)
+ m_io_control[0] = (m_io_control[0] & (~data & 0x2a)) | (data & 0xd5);
+
+ // possibly need to reactivate flags
+ if (data & 0x02)
+ flag_ext_interrupt(TMS7000_INT1_LINE);
+ if (data & 0x20)
+ flag_ext_interrupt(TMS7000_INT3_LINE);
+
+ check_interrupts();
break;
-
- case 0x03: /* T1CTL, timer 1 capture (latched by INT3) */
- result = m_t1_capture_latch;
+
+ // i/o control (IOCNT1)
+ case 0x10:
+ // d0,d2: INT4,5 enable
+ // d1,d3: INT4,5 flag (write 1 to clear flag)
+ m_io_control[1] = (m_io_control[1] & (~data & 0x0a)) | (data & 0x05);
+ check_interrupts();
break;
- case 0x04: /* Port A read */
- result = m_io->read_byte( TMS7000_PORTA );
+ // timer 1/2 data
+ case 0x02: case 0x12:
+ // decrementer reload value
+ m_timer_data[offset >> 4] = data;
break;
-
-
- case 0x06: /* Port B read */
- /* Port B is write only, return a previous written value */
- result = m_pf[ 0x06 ];
+
+ // timer 1/2 control
+ case 0x03:
+ // d5: t1: cmos low-power mode when IDLE opcode is used (not emulated)
+ // 0(normal), or 1(halt) - indicating it can only wake up with RESET or external interrupt
+ if (chip_is_cmos())
+ {
+ m_idle_halt = (data & 0x20) ? true : false;
+ if (m_idle_halt)
+ logerror("%s: CMOS low-power halt mode enabled\n", tag());
+ }
+ data &= ~0x20;
+ case 0x13:
+ // d0-d4: prescaler reload value
+ // d5: t2: cascade from t1
+ // d6: source (internal/external)
+ // d7: stop/start timer
+ m_timer_control[offset >> 4] = data;
+ timer_reload(offset >> 4);
+
+ // on cmos chip, clear INT2/INT5 as well
+ if (~data & 0x80 && chip_is_cmos())
+ m_io_control[offset >> 4] &= ~0x08;
+
break;
- case 0x08: /* Port C read */
- temp1 = m_pf[ 0x08 ] & m_pf[ 0x09 ]; /* Get previous output bits */
- temp2 = m_io->read_byte( TMS7000_PORTC ); /* Read port */
- temp3 = temp2 & (~m_pf[ 0x09 ]); /* Mask off output bits */
- result = temp1 | temp3; /* OR together */
+ // port data (note: 7000 doesn't support it for port A)
+ case 0x04: case 0x06: case 0x08: case 0x0a:
+ {
+ // note: in memory expansion modes, some port output pins are used for memory strobes.
+ // this is currently ignored, since port writes will always be visible externally on peripheral expansion anyway.
+ int port = offset / 2 - 2;
+ m_io->write_byte(port, data & m_port_ddr[port]);
+ m_port_latch[port] = data;
break;
-
- case 0x0a: /* Port D read */
- temp1 = m_pf[ 0x0a ] & m_pf[ 0x0b ]; /* Get previous output bits */
- temp2 = m_io->read_byte( TMS7000_PORTD ); /* Read port */
- temp3 = temp2 & (~m_pf[ 0x0b ]); /* Mask off output bits */
- result = temp1 | temp3; /* OR together */
+ }
+
+ // port direction (note: 7000 doesn't support it for port A)
+ case 0x05: case 0x09: case 0x0b:
+ // note: changing port direction does not change(refresh) the output pins
+ m_port_ddr[offset / 2 - 2] = data;
break;
default:
- /* Just unstuff the other registers */
- result = m_pf[ offset ];
+ logerror("%s: tms7000_pf_w @ $%04x = $%02x\n", tag(), offset, data);
break;
}
-
- return result;
}
-// BCD arthrimetic handling
-static const UINT8 lut_bcd_out[6] = { 0x00, 0x06, 0x00, 0x66, 0x60, 0x66 };
-inline UINT8 tms7000_device::bcd_add( UINT8 a, UINT8 b, UINT8 c )
-{
- c = (c != 0) ? 1 : 0;
+//-------------------------------------------------
+// execute
+//-------------------------------------------------
- UINT8 h1 = a >> 4 & 0xf;
- UINT8 l1 = a >> 0 & 0xf;
- UINT8 h2 = b >> 4 & 0xf;
- UINT8 l2 = b >> 0 & 0xf;
-
- // compute bcd constant
- UINT8 d = ((l1 + l2 + c) < 10) ? 0 : 1;
- if ((h1 + h2) == 9)
- d |= 2;
- else if ((h1 + h2) > 9)
- d |= 4;
-
- UINT8 ret = a + b + c + lut_bcd_out[d];
-
- CLR_NZC;
- SET_N8(ret);
- SET_Z8(ret);
-
- if (d > 2)
- pSR |= SR_C;
-
- return ret;
-}
+#include "tms70op.inc"
-inline UINT8 tms7000_device::bcd_sub( UINT8 a, UINT8 b, UINT8 c )
+void tms7000_device::execute_run()
{
- c = (c != 0) ? 0 : 1;
+ check_interrupts();
- UINT8 h1 = a >> 4 & 0xf;
- UINT8 l1 = a >> 0 & 0xf;
- UINT8 h2 = b >> 4 & 0xf;
- UINT8 l2 = b >> 0 & 0xf;
+ do
+ {
+ debugger_instruction_hook(this, m_pc);
- // compute bcd constant
- UINT8 d = ((l1 - c) >= l2) ? 0 : 1;
- if (h1 == h2)
- d |= 2;
- else if (h1 < h2)
- d |= 4;
+ m_op = m_direct->read_decrypted_byte(m_pc++);
+ execute_one(m_op);
+ } while (m_icount > 0);
+}
- UINT8 ret = a - b - c - lut_bcd_out[d];
-
- CLR_NZC;
- SET_N8(ret);
- SET_Z8(ret);
-
- if (d > 2)
- pSR |= SR_C;
-
- return ret;
+void tms7000_device::execute_one(UINT8 op)
+{
+ switch (op)
+ {
+ case 0x00: nop(); break;
+ case 0x01: idle(); break;
+ case 0x05: eint(); break;
+ case 0x06: dint(); break;
+ case 0x07: setc(); break;
+ case 0x08: pop_st(); break;
+ case 0x09: stsp(); break;
+ case 0x0a: rets(); break;
+ case 0x0b: reti(); break;
+ case 0x0d: ldsp(); break;
+ case 0x0e: push_st(); break;
+
+ case 0x12: am_r2a(&tms7000_device::op_mov); break;
+ case 0x13: am_r2a(&tms7000_device::op_and); break;
+ case 0x14: am_r2a(&tms7000_device::op_or); break;
+ case 0x15: am_r2a(&tms7000_device::op_xor); break;
+ case 0x16: am_r2a(&tms7000_device::op_btjo); break;
+ case 0x17: am_r2a(&tms7000_device::op_btjz); break;
+ case 0x18: am_r2a(&tms7000_device::op_add); break;
+ case 0x19: am_r2a(&tms7000_device::op_adc); break;
+ case 0x1a: am_r2a(&tms7000_device::op_sub); break;
+ case 0x1b: am_r2a(&tms7000_device::op_sbb); break;
+ case 0x1c: am_r2a(&tms7000_device::op_mpy); break;
+ case 0x1d: am_r2a(&tms7000_device::op_cmp); break;
+ case 0x1e: am_r2a(&tms7000_device::op_dac); break;
+ case 0x1f: am_r2a(&tms7000_device::op_dsb); break;
+
+ case 0x22: am_i2a(&tms7000_device::op_mov); break;
+ case 0x23: am_i2a(&tms7000_device::op_and); break;
+ case 0x24: am_i2a(&tms7000_device::op_or); break;
+ case 0x25: am_i2a(&tms7000_device::op_xor); break;
+ case 0x26: am_i2a(&tms7000_device::op_btjo); break;
+ case 0x27: am_i2a(&tms7000_device::op_btjz); break;
+ case 0x28: am_i2a(&tms7000_device::op_add); break;
+ case 0x29: am_i2a(&tms7000_device::op_adc); break;
+ case 0x2a: am_i2a(&tms7000_device::op_sub); break;
+ case 0x2b: am_i2a(&tms7000_device::op_sbb); break;
+ case 0x2c: am_i2a(&tms7000_device::op_mpy); break;
+ case 0x2d: am_i2a(&tms7000_device::op_cmp); break;
+ case 0x2e: am_i2a(&tms7000_device::op_dac); break;
+ case 0x2f: am_i2a(&tms7000_device::op_dsb); break;
+
+ case 0x32: am_r2b(&tms7000_device::op_mov); break;
+ case 0x33: am_r2b(&tms7000_device::op_and); break;
+ case 0x34: am_r2b(&tms7000_device::op_or); break;
+ case 0x35: am_r2b(&tms7000_device::op_xor); break;
+ case 0x36: am_r2b(&tms7000_device::op_btjo); break;
+ case 0x37: am_r2b(&tms7000_device::op_btjz); break;
+ case 0x38: am_r2b(&tms7000_device::op_add); break;
+ case 0x39: am_r2b(&tms7000_device::op_adc); break;
+ case 0x3a: am_r2b(&tms7000_device::op_sub); break;
+ case 0x3b: am_r2b(&tms7000_device::op_sbb); break;
+ case 0x3c: am_r2b(&tms7000_device::op_mpy); break;
+ case 0x3d: am_r2b(&tms7000_device::op_cmp); break;
+ case 0x3e: am_r2b(&tms7000_device::op_dac); break;
+ case 0x3f: am_r2b(&tms7000_device::op_dsb); break;
+
+ case 0x42: am_r2r(&tms7000_device::op_mov); break;
+ case 0x43: am_r2r(&tms7000_device::op_and); break;
+ case 0x44: am_r2r(&tms7000_device::op_or); break;
+ case 0x45: am_r2r(&tms7000_device::op_xor); break;
+ case 0x46: am_r2r(&tms7000_device::op_btjo); break;
+ case 0x47: am_r2r(&tms7000_device::op_btjz); break;
+ case 0x48: am_r2r(&tms7000_device::op_add); break;
+ case 0x49: am_r2r(&tms7000_device::op_adc); break;
+ case 0x4a: am_r2r(&tms7000_device::op_sub); break;
+ case 0x4b: am_r2r(&tms7000_device::op_sbb); break;
+ case 0x4c: am_r2r(&tms7000_device::op_mpy); break;
+ case 0x4d: am_r2r(&tms7000_device::op_cmp); break;
+ case 0x4e: am_r2r(&tms7000_device::op_dac); break;
+ case 0x4f: am_r2r(&tms7000_device::op_dsb); break;
+
+ case 0x52: am_i2b(&tms7000_device::op_mov); break;
+ case 0x53: am_i2b(&tms7000_device::op_and); break;
+ case 0x54: am_i2b(&tms7000_device::op_or); break;
+ case 0x55: am_i2b(&tms7000_device::op_xor); break;
+ case 0x56: am_i2b(&tms7000_device::op_btjo); break;
+ case 0x57: am_i2b(&tms7000_device::op_btjz); break;
+ case 0x58: am_i2b(&tms7000_device::op_add); break;
+ case 0x59: am_i2b(&tms7000_device::op_adc); break;
+ case 0x5a: am_i2b(&tms7000_device::op_sub); break;
+ case 0x5b: am_i2b(&tms7000_device::op_sbb); break;
+ case 0x5c: am_i2b(&tms7000_device::op_mpy); break;
+ case 0x5d: am_i2b(&tms7000_device::op_cmp); break;
+ case 0x5e: am_i2b(&tms7000_device::op_dac); break;
+ case 0x5f: am_i2b(&tms7000_device::op_dsb); break;
+
+ case 0x62: am_b2a(&tms7000_device::op_mov); break;
+ case 0x63: am_b2a(&tms7000_device::op_and); break;
+ case 0x64: am_b2a(&tms7000_device::op_or); break;
+ case 0x65: am_b2a(&tms7000_device::op_xor); break;
+ case 0x66: am_b2a(&tms7000_device::op_btjo); break;
+ case 0x67: am_b2a(&tms7000_device::op_btjz); break;
+ case 0x68: am_b2a(&tms7000_device::op_add); break;
+ case 0x69: am_b2a(&tms7000_device::op_adc); break;
+ case 0x6a: am_b2a(&tms7000_device::op_sub); break;
+ case 0x6b: am_b2a(&tms7000_device::op_sbb); break;
+ case 0x6c: am_b2a(&tms7000_device::op_mpy); break;
+ case 0x6d: am_b2a(&tms7000_device::op_cmp); break;
+ case 0x6e: am_b2a(&tms7000_device::op_dac); break;
+ case 0x6f: am_b2a(&tms7000_device::op_dsb); break;
+
+ case 0x72: am_i2r(&tms7000_device::op_mov); break;
+ case 0x73: am_i2r(&tms7000_device::op_and); break;
+ case 0x74: am_i2r(&tms7000_device::op_or); break;
+ case 0x75: am_i2r(&tms7000_device::op_xor); break;
+ case 0x76: am_i2r(&tms7000_device::op_btjo); break;
+ case 0x77: am_i2r(&tms7000_device::op_btjz); break;
+ case 0x78: am_i2r(&tms7000_device::op_add); break;
+ case 0x79: am_i2r(&tms7000_device::op_adc); break;
+ case 0x7a: am_i2r(&tms7000_device::op_sub); break;
+ case 0x7b: am_i2r(&tms7000_device::op_sbb); break;
+ case 0x7c: am_i2r(&tms7000_device::op_mpy); break;
+ case 0x7d: am_i2r(&tms7000_device::op_cmp); break;
+ case 0x7e: am_i2r(&tms7000_device::op_dac); break;
+ case 0x7f: am_i2r(&tms7000_device::op_dsb); break;
+
+ case 0x80: am_p2a(&tms7000_device::op_mov); break;
+ case 0x82: am_a2p(&tms7000_device::op_mov); break;
+ case 0x83: am_a2p(&tms7000_device::op_and); break;
+ case 0x84: am_a2p(&tms7000_device::op_or); break;
+ case 0x85: am_a2p(&tms7000_device::op_xor); break;
+ case 0x86: am_a2p(&tms7000_device::op_btjo); break;
+ case 0x87: am_a2p(&tms7000_device::op_btjz); break;
+ case 0x88: movd_dir(); break;
+ case 0x8a: lda_dir(); break;
+ case 0x8b: sta_dir(); break;
+ case 0x8c: br_dir(); break;
+ case 0x8d: cmpa_dir(); break;
+ case 0x8e: call_dir(); break;
+
+ case 0x91: am_p2b(&tms7000_device::op_mov); break;
+ case 0x92: am_b2p(&tms7000_device::op_mov); break;
+ case 0x93: am_b2p(&tms7000_device::op_and); break;
+ case 0x94: am_b2p(&tms7000_device::op_or); break;
+ case 0x95: am_b2p(&tms7000_device::op_xor); break;
+ case 0x96: am_b2p(&tms7000_device::op_btjo); break;
+ case 0x97: am_b2p(&tms7000_device::op_btjz); break;
+ case 0x98: movd_ind(); break;
+ case 0x9a: lda_ind(); break;
+ case 0x9b: sta_ind(); break;
+ case 0x9c: br_ind(); break;
+ case 0x9d: cmpa_ind(); break;
+ case 0x9e: call_ind(); break;
+
+ case 0xa2: am_i2p(&tms7000_device::op_mov); break;
+ case 0xa3: am_i2p(&tms7000_device::op_and); break;
+ case 0xa4: am_i2p(&tms7000_device::op_or); break;
+ case 0xa5: am_i2p(&tms7000_device::op_xor); break;
+ case 0xa6: am_i2p(&tms7000_device::op_btjo); break;
+ case 0xa7: am_i2p(&tms7000_device::op_btjz); break;
+ case 0xa8: movd_inx(); break;
+ case 0xaa: lda_inx(); break;
+ case 0xab: sta_inx(); break;
+ case 0xac: br_inx(); break;
+ case 0xad: cmpa_inx(); break;
+ case 0xae: call_inx(); break;
+
+ case 0xb0: am_a2a(&tms7000_device::op_mov); break; // aka clrc/tsta
+ case 0xb1: am_b2a(&tms7000_device::op_mov); break; // undocumented
+ case 0xb2: am_a(&tms7000_device::op_dec); break;
+ case 0xb3: am_a(&tms7000_device::op_inc); break;
+ case 0xb4: am_a(&tms7000_device::op_inv); break;
+ case 0xb5: am_a(&tms7000_device::op_clr); break;
+ case 0xb6: am_a(&tms7000_device::op_xchb); break;
+ case 0xb7: am_a(&tms7000_device::op_swap); break;
+ case 0xb8: push_a(); break;
+ case 0xb9: pop_a(); break;
+ case 0xba: am_a(&tms7000_device::op_djnz); break;
+ case 0xbb: decd_a(); break;
+ case 0xbc: am_a(&tms7000_device::op_rr); break;
+ case 0xbd: am_a(&tms7000_device::op_rrc); break;
+ case 0xbe: am_a(&tms7000_device::op_rl); break;
+ case 0xbf: am_a(&tms7000_device::op_rlc); break;
+
+ case 0xc0: am_a2b(&tms7000_device::op_mov); break;
+ case 0xc1: am_b2b(&tms7000_device::op_mov); break; // aka tstb
+ case 0xc2: am_b(&tms7000_device::op_dec); break;
+ case 0xc3: am_b(&tms7000_device::op_inc); break;
+ case 0xc4: am_b(&tms7000_device::op_inv); break;
+ case 0xc5: am_b(&tms7000_device::op_clr); break;
+ case 0xc6: am_b(&tms7000_device::op_xchb); break; // result equivalent to tstb
+ case 0xc7: am_b(&tms7000_device::op_swap); break;
+ case 0xc8: push_b(); break;
+ case 0xc9: pop_b(); break;
+ case 0xca: am_b(&tms7000_device::op_djnz); break;
+ case 0xcb: decd_b(); break;
+ case 0xcc: am_b(&tms7000_device::op_rr); break;
+ case 0xcd: am_b(&tms7000_device::op_rrc); break;
+ case 0xce: am_b(&tms7000_device::op_rl); break;
+ case 0xcf: am_b(&tms7000_device::op_rlc); break;
+
+ case 0xd0: am_a2r(&tms7000_device::op_mov); break;
+ case 0xd1: am_b2r(&tms7000_device::op_mov); break;
+ case 0xd2: am_r(&tms7000_device::op_dec); break;
+ case 0xd3: am_r(&tms7000_device::op_inc); break;
+ case 0xd4: am_r(&tms7000_device::op_inv); break;
+ case 0xd5: am_r(&tms7000_device::op_clr); break;
+ case 0xd6: am_r(&tms7000_device::op_xchb); break;
+ case 0xd7: am_r(&tms7000_device::op_swap); break;
+ case 0xd8: push_r(); break;
+ case 0xd9: pop_r(); break;
+ case 0xda: am_r(&tms7000_device::op_djnz); break;
+ case 0xdb: decd_r(); break;
+ case 0xdc: am_r(&tms7000_device::op_rr); break;
+ case 0xdd: am_r(&tms7000_device::op_rrc); break;
+ case 0xde: am_r(&tms7000_device::op_rl); break;
+ case 0xdf: am_r(&tms7000_device::op_rlc); break;
+
+ case 0xe0: jmp(true); break;
+ case 0xe1: jmp(m_sr & SR_N); break; // jn/jlt
+ case 0xe2: jmp(m_sr & SR_Z); break; // jz/jeq
+ case 0xe3: jmp(m_sr & SR_C); break; // jc/jhs
+ case 0xe4: jmp(!(m_sr & (SR_Z | SR_N))); break; // jp/jgt
+ case 0xe5: jmp(!(m_sr & SR_N)); break; // jpz/jge - note: error in TI official documentation
+ case 0xe6: jmp(!(m_sr & SR_Z)); break; // jnz/jne
+ case 0xe7: jmp(!(m_sr & SR_C)); break; // jnc/jl
+
+ case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
+ case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
+ case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
+ trap(op << 1); break;
+
+ default: illegal(op); break;
+ }
+}
+
+void tms7020_exl_device::execute_one(UINT8 op)
+{
+ // TMS7020 Exelvision EXL 100 custom opcode(s)
+ if (op == 0xd7)
+ lvdp();
+ else
+ tms7000_device::execute_one(op);
}
diff --git a/src/emu/cpu/tms7000/tms7000.h b/src/emu/cpu/tms7000/tms7000.h
index 8f7ce382b1d..d21563c63c4 100644
--- a/src/emu/cpu/tms7000/tms7000.h
+++ b/src/emu/cpu/tms7000/tms7000.h
@@ -25,38 +25,51 @@
#include "emu.h"
-enum { TMS7000_PC=1, TMS7000_SP, TMS7000_ST, TMS7000_IDLE, TMS7000_T1_CL, TMS7000_T1_PS, TMS7000_T1_DEC };
+enum { TMS7000_PC=1, TMS7000_SP, TMS7000_ST };
enum
{
- TMS7000_IRQ1_LINE = 0, /* INT1 */
- TMS7000_IRQ2_LINE, /* INT2 */
- TMS7000_IRQ3_LINE, /* INT3 */
- TMS7000_IRQNONE = 255
+ /* note: INT2,4,5 are generated internally */
+ TMS7000_INT1_LINE = 0,
+ TMS7000_INT3_LINE
};
enum
{
- TMS7000_PORTA = 0, /* read-only */
- TMS7000_PORTB, /* write-only */
+ TMS7000_PORTA = 0, /* read-only on 70x0 */
+ TMS7000_PORTB, /* write-only */
TMS7000_PORTC,
TMS7000_PORTD
};
+// chip info flags
+#define TMS7000_CHIP_IS_CMOS 0x01
+#define TMS7000_CHIP_FAMILY_70X0 0x00
+#define TMS7000_CHIP_FAMILY_70X2 0x02
+#define TMS7000_CHIP_FAMILY_70CX2 0x04
+#define TMS7000_CHIP_FAMILY_MASK 0x06
+
class tms7000_device : public cpu_device
{
public:
- typedef void ( tms7000_device::*opcode_func ) ();
- static const opcode_func s_opfn[0x100];
- static const opcode_func s_opfn_exl[0x100];
-
// construction/destruction
tms7000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- tms7000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal, const opcode_func *opcode, const char *shortname, const char *source);
-
- DECLARE_WRITE8_MEMBER( tms70x0_pf_w );
- DECLARE_READ8_MEMBER( tms70x0_pf_r );
+ tms7000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal, UINT32 info_flags, const char *shortname, const char *source);
+
+ DECLARE_READ8_MEMBER(tms7000_unmapped_rf_r) { logerror("%s: unmapped_rf_r @ $%04x\n", tag(), offset + 0x80); return 0; };
+ DECLARE_WRITE8_MEMBER(tms7000_unmapped_rf_w) { logerror("%s: unmapped_rf_w @ $%04x = $%02x\n", tag(), 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); }
+
+ bool chip_is_cmos() { return (m_info_flags & TMS7000_CHIP_IS_CMOS) ? true : false; }
+ UINT32 chip_get_family() { return m_info_flags & TMS7000_CHIP_FAMILY_MASK; }
+ bool chip_is_family_70x0() { return chip_get_family() == TMS7000_CHIP_FAMILY_70X0; }
+ bool chip_is_family_70x2() { return chip_get_family() == TMS7000_CHIP_FAMILY_70X2; }
+ bool chip_is_family_70cx2() { return chip_get_family() == TMS7000_CHIP_FAMILY_70CX2; }
protected:
// device-level overrides
@@ -64,9 +77,11 @@ protected:
virtual void device_reset();
// device_execute_interface overrides
- virtual UINT32 execute_min_cycles() const { return 1; }
- virtual UINT32 execute_max_cycles() const { return 48; }
- virtual UINT32 execute_input_lines() const { return 3; }
+ virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 2 - 1) / 2; } // internal /2 divider
+ virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 2); } // internal /2 divider
+ virtual UINT32 execute_min_cycles() const { return 5; }
+ virtual UINT32 execute_max_cycles() const { return 49; }
+ virtual UINT32 execute_input_lines() const { return 2; }
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
@@ -81,187 +96,94 @@ protected:
virtual UINT32 disasm_max_opcode_bytes() const { return 4; }
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
-private:
+ virtual void execute_one(UINT8 op);
+
address_space_config m_program_config;
address_space_config m_io_config;
- const opcode_func *m_opcode;
-
- inline UINT8 bcd_add( UINT8 a, UINT8 b, UINT8 c );
- inline UINT8 bcd_sub( UINT8 a, UINT8 b, UINT8 c );
-
- PAIR m_pc; /* Program counter */
- UINT8 m_sp; /* Stack Pointer */
- UINT8 m_sr; /* Status Register */
- UINT8 m_irq_state[3]; /* State of the three IRQs */
- UINT8 m_pf[0x100]; /* Perpherial file */
-
- int m_icount;
- int m_div_by_16_trigger;
- int m_cycles_per_INT2;
- UINT8 m_t1_capture_latch; /* Timer 1 capture latch */
- INT8 m_t1_prescaler; /* Timer 1 prescaler (5 bits) */
- INT16 m_t1_decrementer; /* Timer 1 decrementer (8 bits) */
- UINT8 m_idle_state; /* Set after the execution of an idle instruction */
+ UINT32 m_info_flags;
address_space *m_program;
direct_read_data *m_direct;
address_space *m_io;
-
- inline UINT16 RM16( UINT32 mAddr );
- inline UINT16 RRF16( UINT32 mAddr );
- inline void WRF16( UINT32 mAddr, PAIR p );
-
- void tms7000_check_IRQ_lines();
- void tms7000_do_interrupt( UINT16 address, UINT8 line );
- void tms7000_service_timer1();
-
- void illegal();
- void adc_b2a();
- void adc_r2a();
- void adc_r2b();
- void adc_r2r();
- void adc_i2a();
- void adc_i2b();
- void adc_i2r();
- void add_b2a();
- void add_r2a();
- void add_r2b();
- void add_r2r();
- void add_i2a();
- void add_i2b();
- void add_i2r();
- void and_b2a();
- void and_r2a();
- void and_r2b();
- void and_r2r();
- void and_i2a();
- void and_i2b();
- void and_i2r();
- void andp_a2p();
- void andp_b2p();
- void movp_i2p();
- void andp_i2p();
+ int m_icount;
+
+ bool m_irq_state[2];
+ bool m_idle_state;
+ bool m_idle_halt;
+ UINT16 m_pc;
+ UINT8 m_sp;
+ UINT8 m_sr;
+ UINT8 m_op;
+
+ UINT8 m_io_control[3];
+
+ emu_timer *m_timer_handle[2];
+ UINT8 m_timer_data[2];
+ UINT8 m_timer_control[2];
+ int m_timer_decrementer[2];
+ int m_timer_prescaler[2];
+ UINT16 m_timer_capture_latch[2];
+
+ UINT8 m_port_latch[4];
+ UINT8 m_port_ddr[4];
+
+ void flag_ext_interrupt(int irqline);
+ void check_interrupts();
+ void do_interrupt(int irqline);
+
+ TIMER_CALLBACK_MEMBER(simple_timer_cb);
+ void timer_run(int tmr);
+ void timer_reload(int tmr);
+ void timer_tick_pre(int tmr);
+ void timer_tick_low(int tmr);
+
+ // internal read/write
+ inline UINT8 read_r8(UINT8 address) { return m_program->read_byte(address); }
+ inline void write_r8(UINT8 address, UINT8 data) { m_program->write_byte(address, data); }
+ inline UINT16 read_r16(UINT8 address) { return m_program->read_byte((address - 1) & 0xff) << 8 | m_program->read_byte(address); }
+ inline void write_r16(UINT8 address, UINT16 data) { m_program->write_byte((address - 1) & 0xff, data >> 8 & 0xff); m_program->write_byte(address, data & 0xff); }
+
+ inline UINT8 read_p(UINT8 address) { return m_program->read_byte(0x100 + address); }
+ inline void write_p(UINT8 address, UINT8 data) { m_program->write_byte(0x100 + address, data); }
+
+ inline UINT8 read_mem8(UINT16 address) { return m_program->read_byte(address); }
+ inline void write_mem8(UINT16 address, UINT8 data) { m_program->write_byte(address, data); }
+ inline UINT16 read_mem16(UINT16 address) { return m_program->read_byte(address) << 8 | m_program->read_byte((address + 1) & 0xffff); }
+ inline void write_mem16(UINT16 address, UINT16 data) { m_program->write_byte(address, data >> 8 & 0xff); m_program->write_byte((address + 1) & 0xffff, data & 0xff); }
+
+ inline UINT8 imm8() { return m_direct->read_raw_byte(m_pc++); }
+ inline UINT16 imm16() { UINT16 ret = m_direct->read_raw_byte(m_pc++) << 8; return ret | m_direct->read_raw_byte(m_pc++); }
+
+ inline UINT8 pull8() { return m_program->read_byte(m_sp--); }
+ inline void push8(UINT8 data) { m_program->write_byte(++m_sp, data); }
+ inline UINT16 pull16() { UINT16 ret = m_program->read_byte(m_sp--); return ret | m_program->read_byte(m_sp--) << 8; }
+ inline void push16(UINT16 data) { m_program->write_byte(++m_sp, data >> 8 & 0xff); m_program->write_byte(++m_sp, data & 0xff); }
+
+ // opcode handlers
void br_dir();
- void br_ind();
void br_inx();
- void btjo_b2a();
- void btjo_r2a();
- void btjo_r2b();
- void btjo_r2r();
- void btjo_i2a();
- void btjo_i2b();
- void btjo_i2r();
- void btjop_ap();
- void btjop_bp();
- void btjop_ip();
- void btjz_b2a();
- void btjz_r2a();
- void btjz_r2b();
- void btjz_r2r();
- void btjz_i2a();
- void btjz_i2b();
- void btjz_i2r();
- void btjzp_ap();
- void btjzp_bp();
- void btjzp_ip();
+ void br_ind();
void call_dir();
- void call_ind();
void call_inx();
- void clr_a();
- void clr_b();
- void clr_r();
- void clrc();
- void cmp_ba();
- void cmp_ra();
- void cmp_rb();
- void cmp_rr();
- void cmp_ia();
- void cmp_ib();
- void cmp_ir();
+ void call_ind();
void cmpa_dir();
- void cmpa_ind();
void cmpa_inx();
- void dac_b2a();
- void dac_r2a();
- void dac_r2b();
- void dac_r2r();
- void dac_i2a();
- void dac_i2b();
- void dac_i2r();
- void dec_a();
- void dec_b();
- void dec_r();
+ void cmpa_ind();
void decd_a();
void decd_b();
void decd_r();
void dint();
- void djnz_a();
- void djnz_b();
- void djnz_r();
- void dsb_b2a();
- void dsb_r2a();
- void dsb_r2b();
- void dsb_r2r();
- void dsb_i2a();
- void dsb_i2b();
- void dsb_i2r();
void eint();
void idle();
- void inc_a();
- void inc_b();
- void inc_r();
- void inv_a();
- void inv_b();
- void inv_r();
- void jc();
- void jeq();
- void jl();
- void jmp();
- void j_jn();
- void jne();
- void jp();
- void jpz();
void lda_dir();
- void lda_ind();
void lda_inx();
+ void lda_ind();
void ldsp();
- void mov_a2b();
- void mov_b2a();
- void mov_a2r();
- void mov_b2r();
- void mov_r2a();
- void mov_r2b();
- void mov_r2r();
- void mov_i2a();
- void mov_i2b();
- void mov_i2r();
- void movd_imm();
- void movd_r();
+ void movd_dir();
void movd_inx();
- void movp_a2p();
- void movp_b2p();
- void movp_r2p();
- void movp_p2a();
- void movp_p2b();
- void mpy_ba();
- void mpy_ra();
- void mpy_rb();
- void mpy_rr();
- void mpy_ia();
- void mpy_ib();
- void mpy_ir();
+ void movd_ind();
void nop();
- void or_b2a();
- void or_r2a();
- void or_r2b();
- void or_r2r();
- void or_i2a();
- void or_i2b();
- void or_i2r();
- void orp_a2p();
- void orp_b2p();
- void orp_i2p();
void pop_a();
void pop_b();
void pop_r();
@@ -272,79 +194,65 @@ private:
void push_st();
void reti();
void rets();
- void rl_a();
- void rl_b();
- void rl_r();
- void rlc_a();
- void rlc_b();
- void rlc_r();
- void rr_a();
- void rr_b();
- void rr_r();
- void rrc_a();
- void rrc_b();
- void rrc_r();
- void sbb_ba();
- void sbb_ra();
- void sbb_rb();
- void sbb_rr();
- void sbb_ia();
- void sbb_ib();
- void sbb_ir();
void setc();
void sta_dir();
- void sta_ind();
void sta_inx();
+ void sta_ind();
void stsp();
- void sub_ba();
- void sub_ra();
- void sub_rb();
- void sub_rr();
- void sub_ia();
- void sub_ib();
- void sub_ir();
- void trap_0();
- void trap_1();
- void trap_2();
- void trap_3();
- void trap_4();
- void trap_5();
- void trap_6();
- void trap_7();
- void trap_8();
- void trap_9();
- void trap_10();
- void trap_11();
- void trap_12();
- void trap_13();
- void trap_14();
- void trap_15();
- void trap_16();
- void trap_17();
- void trap_18();
- void trap_19();
- void trap_20();
- void trap_21();
- void trap_22();
- void trap_23();
- void swap_a();
- void swap_b();
- void swap_r();
- void swap_r_exl();
- void tstb();
- void xchb_a();
- void xchb_b();
- void xchb_r();
- void xor_b2a();
- void xor_r2a();
- void xor_r2b();
- void xor_r2r();
- void xor_i2a();
- void xor_i2b();
- void xor_i2r();
- void xorp_a2p();
- void xorp_b2p();
- void xorp_i2p();
+ void trap(UINT8 address);
+ void illegal(UINT8 op);
+
+ typedef int (tms7000_device::*op_func)(UINT8, UINT8);
+ int op_clr(UINT8 param1, UINT8 param2);
+ int op_dec(UINT8 param1, UINT8 param2);
+ int op_inc(UINT8 param1, UINT8 param2);
+ int op_inv(UINT8 param1, UINT8 param2);
+ int op_rl(UINT8 param1, UINT8 param2);
+ int op_rlc(UINT8 param1, UINT8 param2);
+ int op_rr(UINT8 param1, UINT8 param2);
+ int op_rrc(UINT8 param1, UINT8 param2);
+ int op_swap(UINT8 param1, UINT8 param2);
+ int op_xchb(UINT8 param1, UINT8 param2);
+
+ int op_adc(UINT8 param1, UINT8 param2);
+ int op_add(UINT8 param1, UINT8 param2);
+ int op_and(UINT8 param1, UINT8 param2);
+ int op_cmp(UINT8 param1, UINT8 param2);
+ int op_dac(UINT8 param1, UINT8 param2);
+ int op_dsb(UINT8 param1, UINT8 param2);
+ int op_mpy(UINT8 param1, UINT8 param2);
+ int op_mov(UINT8 param1, UINT8 param2);
+ int op_or(UINT8 param1, UINT8 param2);
+ int op_sbb(UINT8 param1, UINT8 param2);
+ int op_sub(UINT8 param1, UINT8 param2);
+ int op_xor(UINT8 param1, UINT8 param2);
+
+ inline void shortbranch(bool check);
+ inline void jmp(bool check);
+ int op_djnz(UINT8 param1, UINT8 param2);
+ int op_btjo(UINT8 param1, UINT8 param2);
+ int op_btjz(UINT8 param1, UINT8 param2);
+
+ void am_a(op_func op);
+ void am_b(op_func op);
+ void am_r(op_func op);
+ void am_a2a(op_func op);
+ void am_a2b(op_func op);
+ void am_a2r(op_func op);
+ void am_a2p(op_func op);
+ void am_b2a(op_func op);
+ void am_b2b(op_func op);
+ void am_b2r(op_func op);
+ void am_b2p(op_func op);
+ void am_r2a(op_func op);
+ void am_r2b(op_func op);
+ void am_r2r(op_func op);
+ void am_i2a(op_func op);
+ void am_i2b(op_func op);
+ void am_i2r(op_func op);
+ void am_i2p(op_func op);
+ void am_p2a(op_func op);
+ void am_p2b(op_func op);
};
@@ -359,6 +267,11 @@ class tms7020_exl_device : public tms7000_device
{
public:
tms7020_exl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+protected:
+ virtual void execute_one(UINT8 op);
+
+private:
+ void lvdp();
};
@@ -390,6 +303,34 @@ public:
};
+class tms7001_device : public tms7000_device
+{
+public:
+ tms7001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+
+class tms7041_device : public tms7000_device
+{
+public:
+ tms7041_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+
+class tms7002_device : public tms7000_device
+{
+public:
+ tms7002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+
+class tms7042_device : public tms7000_device
+{
+public:
+ tms7042_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+
extern const device_type TMS7000;
extern const device_type TMS7020;
extern const device_type TMS7020_EXL;
@@ -397,6 +338,9 @@ extern const device_type TMS7040;
extern const device_type TMS70C00;
extern const device_type TMS70C20;
extern const device_type TMS70C40;
-
+extern const device_type TMS7001;
+extern const device_type TMS7041;
+extern const device_type TMS7002;
+extern const device_type TMS7042;
#endif /* __TMS7000_H__ */
diff --git a/src/emu/cpu/tms7000/tms70op.inc b/src/emu/cpu/tms7000/tms70op.inc
index 432b15428dd..8b81a7e8721 100644
--- a/src/emu/cpu/tms7000/tms70op.inc
+++ b/src/emu/cpu/tms7000/tms70op.inc
@@ -1,3666 +1,717 @@
/*****************************************************************************
*
- * tms70op.inc (Op code functions)
- * Portable TMS7000 emulator (Texas Instruments 7000)
- *
- * Copyright tim lindner, all rights reserved.
- *
- * - This source code is released as freeware for non-commercial purposes.
- * - You are free to use and redistribute this code in modified or
- * unmodified form, provided you list me in the credits.
- * - If you modify this source code, you must add a notice to each modified
- * source file that it has been changed. If you're a nice person, you
- * will clearly mark each change too. :)
- * - If you wish to use this for commercial purposes, please contact me at
- * tlindner@macmess.org
- * - This entire notice must remain in the source code.
+ * tms70op.inc (Op code functions)
*
*****************************************************************************/
-void tms7000_device::illegal()
-{
- /* This is a guess */
- m_icount -= 4;
-}
+// addressing modes (not all opcodes have a write cycle)
+#define WB_NO -1
+#define AM_WB(write_func, address, param1, param2) \
+ int result = (this->*op)(param1, param2); \
+ if (result > WB_NO) write_func(address, result)
-void tms7000_device::adc_b2a()
+void tms7000_device::am_a(op_func op)
{
- UINT16 t;
-
- t = RDA + RDB + GET_C;
- WRA(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 5;
+ AM_WB(write_r8, 0, read_r8(0), 0);
}
-void tms7000_device::adc_r2a()
-{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) + RDA + GET_C;
- WRA(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::adc_r2b()
-{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) + RDB + GET_C;
- WRB(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::adc_r2r()
+void tms7000_device::am_b(op_func op)
{
- UINT16 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = RM(i)+RM(j) + GET_C;
- WM(j,t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::adc_i2a()
-{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v + RDA + GET_C;
- WRA(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
+ m_icount -= 5;
+ AM_WB(write_r8, 1, read_r8(1), 0);
}
-void tms7000_device::adc_i2b()
+void tms7000_device::am_r(op_func op)
{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v + RDB + GET_C;
- WRB(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 7;
+ UINT8 r = imm8();
+ AM_WB(write_r8, r, read_r8(r), 0);
}
-void tms7000_device::adc_i2r()
+void tms7000_device::am_a2a(op_func op)
{
- UINT16 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = i+RM(j) + GET_C;
- WM(j,t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
+ m_icount -= 6;
+ AM_WB(write_r8, 0, read_r8(0), read_r8(0));
}
-void tms7000_device::add_b2a()
+void tms7000_device::am_a2b(op_func op)
{
- UINT16 t;
-
- t = RDA + RDB;
- WRA(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
+ m_icount -= 6;
+ AM_WB(write_r8, 1, read_r8(1), read_r8(0));
}
-void tms7000_device::add_r2a()
+void tms7000_device::am_a2p(op_func op)
{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) + RDA;
- WRA(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
+ m_icount -= 10;
+ UINT8 r = imm8();
+ AM_WB(write_p, r, read_p(r), read_r8(0));
}
-void tms7000_device::add_r2b()
+void tms7000_device::am_a2r(op_func op)
{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) + RDB;
- WRB(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 8;
+ UINT8 r = imm8();
+ AM_WB(write_r8, r, read_r8(r), read_r8(0));
}
-void tms7000_device::add_r2r()
+void tms7000_device::am_b2a(op_func op)
{
- UINT16 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = RM(i)+RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
+ m_icount -= 5;
+ AM_WB(write_r8, 0, read_r8(0), read_r8(1));
}
-void tms7000_device::add_i2a()
+void tms7000_device::am_b2b(op_func op)
{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v + RDA;
- WRA(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
+ m_icount -= 6;
+ AM_WB(write_r8, 1, read_r8(1), read_r8(1));
}
-void tms7000_device::add_i2b()
+void tms7000_device::am_b2r(op_func op)
{
- UINT16 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v + RDB;
- WRB(t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 7;
+ UINT8 r = imm8();
+ AM_WB(write_r8, r, read_r8(r), read_r8(1));
}
-void tms7000_device::add_i2r()
+void tms7000_device::am_b2p(op_func op)
{
- UINT16 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = i+RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 9;
+ UINT8 r = imm8();
+ AM_WB(write_p, r, read_p(r), read_r8(1));
}
-void tms7000_device::and_b2a()
+void tms7000_device::am_r2a(op_func op)
{
- UINT8 t;
-
- t = RDA & RDB;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::and_r2a()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) & RDA;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 8;
+ AM_WB(write_r8, 0, read_r8(0), read_r8(imm8()));
}
-void tms7000_device::and_r2b()
+void tms7000_device::am_r2b(op_func op)
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) & RDB;
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 8;
+ AM_WB(write_r8, 1, read_r8(1), read_r8(imm8()));
}
-void tms7000_device::and_r2r()
+void tms7000_device::am_r2r(op_func op)
{
- UINT8 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = RM(i) & RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 10;
+ UINT8 param2 = read_r8(imm8());
+ UINT8 r = imm8();
+ AM_WB(write_r8, r, read_r8(r), param2);
}
-void tms7000_device::and_i2a()
+void tms7000_device::am_i2a(op_func op)
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v & RDA;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 7;
+ AM_WB(write_r8, 0, read_r8(0), imm8());
}
-void tms7000_device::and_i2b()
+void tms7000_device::am_i2b(op_func op)
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v & RDB;
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 7;
+ AM_WB(write_r8, 1, read_r8(1), imm8());
}
-void tms7000_device::and_i2r()
+void tms7000_device::am_i2r(op_func op)
{
- UINT8 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = i & RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 9;
+ UINT8 param2 = imm8();
+ UINT8 r = imm8();
+ AM_WB(write_r8, r, read_r8(r), param2);
}
-void tms7000_device::andp_a2p()
+void tms7000_device::am_i2p(op_func op)
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
- t = RDA & RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::andp_b2p()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
- t = RDB & RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
-}
-
-
-void tms7000_device::movp_i2p()
-{
- UINT8 i,v;
-
- IMMBYTE(i);
- IMMBYTE(v);
- WM( 0x0100+v, i);
-
- CLR_NZC;
- SET_N8(i);
- SET_Z8(i);
-
- m_icount -= 11;
-}
-
-void tms7000_device::andp_i2p()
-{
- UINT8 t;
- UINT8 i,v;
-
- IMMBYTE(i);
- IMMBYTE(v);
- t = i & RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 11;
+ UINT8 param2 = imm8();
+ UINT8 r = imm8();
+ AM_WB(write_p, r, read_p(r), param2);
}
-void tms7000_device::br_dir()
-{
- PAIR p;
-
- IMMWORD( p );
- pPC = p.d;
- m_icount -= 10;
-}
-
-void tms7000_device::br_ind()
+void tms7000_device::am_p2a(op_func op)
{
- UINT8 v;
-
- IMMBYTE( v );
- PC.w.l = RRF16(v);
-
m_icount -= 9;
+ AM_WB(write_r8, 0, read_r8(0), read_p(imm8()));
}
-void tms7000_device::br_inx()
-{
- PAIR p;
-
- IMMWORD( p );
- pPC = p.w.l + RDB;
- m_icount -= 12;
-}
-
-void tms7000_device::btjo_b2a()
-{
- UINT8 t;
-
- t = RDB & RDA;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE( j );
- pPC += j;
- m_icount -= 9;
- }
- else
- {
- pPC++;
- m_icount -= 7;
- }
-}
-
-void tms7000_device::btjo_r2a()
-{
- UINT8 t,r;
-
- IMMBYTE( r );
- t = RM( r ) & RDA;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE( j );
- pPC += j;
- m_icount -= 9;
- }
- else
- {
- pPC++;
- m_icount -= 7;
- }
-}
-
-void tms7000_device::btjo_r2b()
-{
- UINT8 t,r;
-
- IMMBYTE(r);
- t = RM(r) & RDB;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 12;
- }
- else
- {
- pPC++;
- m_icount -= 10;
- }
-}
-
-void tms7000_device::btjo_r2r()
+void tms7000_device::am_p2b(op_func op)
{
- UINT8 t,r,s;
-
- IMMBYTE(r);
- IMMBYTE(s);
- t = RM(r) & RM(s);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 14;
- }
- else
- {
- pPC++;
- m_icount -= 12;
- }
+ m_icount -= 8;
+ AM_WB(write_r8, 1, read_r8(1), read_p(imm8()));
}
-void tms7000_device::btjo_i2a()
-{
- UINT8 t,r;
-
- IMMBYTE(r);
- t = r & RDA;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 11;
- }
- else
- {
- pPC++;
- m_icount -= 9;
- }
-}
-void tms7000_device::btjo_i2b()
+// common opcodes
+// 1 param
+int tms7000_device::op_clr(UINT8 param1, UINT8 param2)
{
- UINT8 t,i;
-
- IMMBYTE(i);
- t = i & RDB;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 11;
- }
- else
- {
- pPC++;
- m_icount -= 9;
- }
+ UINT8 t = 0;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjo_i2r()
+int tms7000_device::op_dec(UINT8 param1, UINT8 param2)
{
- UINT8 t,i,r;
-
- IMMBYTE(i);
- IMMBYTE(r);
- t = i & RM(r);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 13;
- }
- else
- {
- pPC++;
- m_icount -= 11;
- }
+ UINT16 t = param1 - 1;
+ SET_NZ(t);
+ SET_C(~t);
+ return t;
}
-void tms7000_device::btjop_ap()
+int tms7000_device::op_inc(UINT8 param1, UINT8 param2)
{
- UINT8 t,p;
-
- IMMBYTE(p);
-
- t = RM(0x100+p) & RDA;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 13;
- }
- else
- {
- pPC++;
- m_icount -= 11;
- }
+ UINT16 t = param1 + 1;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjop_bp()
+int tms7000_device::op_inv(UINT8 param1, UINT8 param2)
{
- UINT8 t,p;
-
- IMMBYTE(p);
-
- t = RM(0x100+p) & RDB;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 12;
- }
- else
- {
- pPC++;
- m_icount -= 10;
- }
+ UINT8 t = ~param1;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjop_ip()
+int tms7000_device::op_rl(UINT8 param1, UINT8 param2)
{
- UINT8 t,p,i;
-
- IMMBYTE(i);
- IMMBYTE(p);
-
- t = RM(0x100+p) & i;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 14;
- }
- else
- {
- pPC++;
- m_icount -= 12;
- }
+ UINT16 t = param1 << 1 | param1 >> 7;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjz_b2a()
+int tms7000_device::op_rlc(UINT8 param1, UINT8 param2)
{
- UINT8 t;
-
- t = RDB & (~RDA);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE( j );
- pPC += j;
- m_icount -= 9;
- }
- else
- {
- pPC++;
- m_icount -= 7;
- }
+ UINT16 t = param1 << 1 | GET_C();
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjz_r2a()
+int tms7000_device::op_rr(UINT8 param1, UINT8 param2)
{
- UINT8 t,r;
-
- IMMBYTE( r );
- t = RM( r ) & (~RDA);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE( j );
- pPC += j;
- m_icount -= 9;
- }
- else
- {
- pPC++;
- m_icount -= 7;
- }
+ UINT16 t = param1 >> 1 | param1 << 8 | (param1 << 7 & 0x80);
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjz_r2b()
+int tms7000_device::op_rrc(UINT8 param1, UINT8 param2)
{
- UINT8 t,r;
-
- IMMBYTE(r);
- t = RM(r) & (~RDB);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 12;
- }
- else
- {
- pPC++;
- m_icount -= 10;
- }
+ UINT16 t = param1 >> 1 | param1 << 8 | GET_C() << 7;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjz_r2r()
+int tms7000_device::op_swap(UINT8 param1, UINT8 param2)
{
- UINT8 t,r,s;
-
- IMMBYTE(r);
- IMMBYTE(s);
- t = RM(r) & (~RM(s));
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 14;
- }
- else
- {
- pPC++;
- m_icount -= 12;
- }
+ m_icount -= 3;
+ UINT16 t = param1 >> 4 | param1 << 4;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjz_i2a()
+int tms7000_device::op_xchb(UINT8 param1, UINT8 param2)
{
- UINT8 t,r;
-
- IMMBYTE(r);
- t = r & (~RDA);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 11;
- }
- else
- {
- pPC++;
- m_icount -= 9;
- }
+ m_icount -= 1;
+ UINT8 t = read_r8(1);
+ SET_CNZ(t);
+ write_r8(1, param1);
+ return t;
}
-void tms7000_device::btjz_i2b()
+// 2 params
+int tms7000_device::op_adc(UINT8 param1, UINT8 param2)
{
- UINT8 t,i;
-
- IMMBYTE(i);
- t = i & (~RDB);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 11;
- }
- else
- {
- pPC++;
- m_icount -= 9;
- }
-}
-
-void tms7000_device::btjz_i2r()
-{
- UINT8 t,i,r;
-
- IMMBYTE(i);
- IMMBYTE(r);
- t = i & (~RM(r));
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 13;
- }
- else
- {
- pPC++;
- m_icount -= 11;
- }
-}
-
-void tms7000_device::btjzp_ap()
-{
- UINT8 t,p;
-
- IMMBYTE(p);
-
- t = RDA & (~RM(0x100+p));
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 13;
- }
- else
- {
- pPC++;
- m_icount -= 11;
- }
+ UINT16 t = param1 + param2 + GET_C();
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjzp_bp()
+int tms7000_device::op_add(UINT8 param1, UINT8 param2)
{
- UINT8 t,p;
-
- IMMBYTE(p);
-
- t = RDB & (~RM(0x100+p));
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 12;
- }
- else
- {
- pPC++;
- m_icount -= 10;
- }
+ UINT16 t = param1 + param2;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::btjzp_ip()
+int tms7000_device::op_and(UINT8 param1, UINT8 param2)
{
- UINT8 t,p,i;
-
- IMMBYTE(i);
- IMMBYTE(p);
-
- t = i & (~RM(0x100+p));
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- if(t != 0)
- {
- INT8 j;
-
- SIMMBYTE(j);
- pPC += j;
- m_icount -= 14;
- }
- else
- {
- pPC++;
- m_icount -= 12;
- }
+ UINT8 t = param1 & param2;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::call_dir()
+int tms7000_device::op_cmp(UINT8 param1, UINT8 param2)
{
- PAIR tPC;
-
- IMMWORD( tPC );
- PUSHWORD( PC );
- pPC = tPC.d;
-
- m_icount -= 14;
+ UINT16 t = param1 - param2;
+ SET_NZ(t);
+ SET_C(~t);
+ return WB_NO;
}
-void tms7000_device::call_ind()
+int tms7000_device::op_mpy(UINT8 param1, UINT8 param2)
{
- UINT8 v;
-
- IMMBYTE( v );
- PUSHWORD( PC );
- PC.w.l = RRF16(v);
-
- m_icount -= 13;
+ m_icount -= 39;
+ UINT16 t = param1 * param2;
+ SET_CNZ(t >> 8 & 0xff);
+ write_mem16(0, t); // always writes result to regs A-B
+ return WB_NO;
}
-void tms7000_device::call_inx()
+int tms7000_device::op_mov(UINT8 param1, UINT8 param2)
{
- PAIR tPC;
-
- IMMWORD( tPC );
- PUSHWORD( PC );
- pPC = tPC.w.l + RDB;
- m_icount -= 16;
+ UINT8 t = param2;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::clr_a()
+int tms7000_device::op_or(UINT8 param1, UINT8 param2)
{
- WRA(0);
- CLR_NZC;
- SETZ;
- m_icount -= 5;
+ UINT8 t = param1 | param2;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::clr_b()
+int tms7000_device::op_sbb(UINT8 param1, UINT8 param2)
{
- WRB(0);
- CLR_NZC;
- SETZ;
- m_icount -= 5;
+ UINT8 t = param1 - param2 - (!GET_C());
+ SET_NZ(t);
+ SET_C(~t);
+ return t;
}
-void tms7000_device::clr_r()
+int tms7000_device::op_sub(UINT8 param1, UINT8 param2)
{
- UINT8 r;
-
- IMMBYTE(r);
- WM(r,0);
- CLR_NZC;
- SETZ;
- m_icount -= 7;
+ UINT16 t = param1 - param2;
+ SET_NZ(t);
+ SET_C(~t);
+ return t;
}
-void tms7000_device::clrc()
+int tms7000_device::op_xor(UINT8 param1, UINT8 param2)
{
- UINT8 a;
-
- a = RDA;
-
- CLR_NZC;
- SET_N8(a);
- SET_Z8(a);
-
- m_icount -= 6;
+ UINT8 t = param1 ^ param2;
+ SET_CNZ(t);
+ return t;
}
-void tms7000_device::cmp_ba()
-{
- UINT16 t;
-
- t = RDA - RDB;
+// BCD arthrimetic handling
+static const UINT8 lut_bcd_out[6] = { 0x00, 0x06, 0x00, 0x66, 0x60, 0x66 };
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- SET_C8( ~t );
- m_icount -= 5;
-}
-
-void tms7000_device::cmp_ra()
+int tms7000_device::op_dac(UINT8 param1, UINT8 param2)
{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- t = RDA - RM(r);
+ m_icount -= 2;
+ int c = GET_C();
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- SET_C8( ~t );
-
- m_icount -= 8;
-}
-
-void tms7000_device::cmp_rb()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- t = RDB - RM(r);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- SET_C8( ~t );
-
- m_icount -= 8;
-}
-
-void tms7000_device::cmp_rr()
-{
- UINT16 t;
- UINT8 r,s;
-
- IMMBYTE(r);
- IMMBYTE(s);
- t = RM(s) - RM(r);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- SET_C8( ~t );
-
- m_icount -= 10;
-}
-
-void tms7000_device::cmp_ia()
-{
- UINT16 t;
- UINT8 i;
-
- IMMBYTE(i);
- t = RDA - i;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- SET_C8( ~t );
-
- m_icount -= 7;
-}
-
-void tms7000_device::cmp_ib()
-{
- UINT16 t;
- UINT8 i;
-
- IMMBYTE(i);
- t = RDB - i;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- SET_C8( ~t );
-
- m_icount -= 7;
-}
-
-void tms7000_device::cmp_ir()
-{
- UINT16 t;
- UINT8 i,r;
-
- IMMBYTE(i);
- IMMBYTE(r);
- t = RM(r) - i;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- SET_C8( ~t );
-
- m_icount -= 9;
-}
-
-void tms7000_device::cmpa_dir()
-{
- UINT16 t;
- PAIR i;
-
- IMMWORD( i );
- t = RDA - RM(i.w.l);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- SET_C8( ~t );
-
- m_icount -= 12;
-}
-
-void tms7000_device::cmpa_ind()
-{
- UINT16 t;
- PAIR p;
- INT8 i;
-
- IMMBYTE(i);
- p.w.l = RRF16(i);
- t = RDA - RM(p.w.l);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- SET_C8( ~t );
-
- m_icount -= 11;
+ UINT8 h1 = param1 >> 4 & 0xf;
+ UINT8 l1 = param1 >> 0 & 0xf;
+ UINT8 h2 = param2 >> 4 & 0xf;
+ UINT8 l2 = param2 >> 0 & 0xf;
+
+ // compute bcd constant
+ UINT8 d = ((l1 + l2 + c) < 10) ? 0 : 1;
+ if ((h1 + h2) == 9)
+ d |= 2;
+ else if ((h1 + h2) > 9)
+ d |= 4;
+
+ UINT8 t = param1 + param2 + c + lut_bcd_out[d];
+ SET_CNZ(t);
+ if (d > 2)
+ m_sr |= SR_C;
+
+ return t;
}
-void tms7000_device::cmpa_inx()
+int tms7000_device::op_dsb(UINT8 param1, UINT8 param2)
{
- UINT16 t;
- PAIR i;
-
- IMMWORD( i );
- t = RDA - RM(i.w.l + RDB);
+ m_icount -= 2;
+ int c = !GET_C();
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- SET_C8( ~t );
+ UINT8 h1 = param1 >> 4 & 0xf;
+ UINT8 l1 = param1 >> 0 & 0xf;
+ UINT8 h2 = param2 >> 4 & 0xf;
+ UINT8 l2 = param2 >> 0 & 0xf;
- m_icount -= 14;
-}
+ // compute bcd constant
+ UINT8 d = ((l1 - c) >= l2) ? 0 : 1;
+ if (h1 == h2)
+ d |= 2;
+ else if (h1 < h2)
+ d |= 4;
-void tms7000_device::dac_b2a()
-{
- WRA(bcd_add(RDA, RDB, pSR & SR_C));
-
- m_icount -= 7;
-}
-
-void tms7000_device::dac_r2a()
-{
- UINT8 r;
- IMMBYTE(r);
-
- WRA(bcd_add(RDA, RM(r), pSR & SR_C));
-
- m_icount -= 10;
+ UINT8 t = param1 - param2 - c - lut_bcd_out[d];
+ SET_CNZ(t);
+ if (d <= 2)
+ m_sr |= SR_C;
+
+ return t;
}
-void tms7000_device::dac_r2b()
+// branches
+inline void tms7000_device::shortbranch(bool check)
{
- UINT8 r;
- IMMBYTE(r);
-
- WRB(bcd_add(RDB, RM(r), pSR & SR_C));
+ m_icount -= 2;
+ INT8 d = (INT8)imm8();
- m_icount -= 10;
+ if (check)
+ {
+ m_pc += d;
+ m_icount -= 2;
+ }
}
-void tms7000_device::dac_r2r()
+inline void tms7000_device::jmp(bool check)
{
- UINT8 s, r;
- IMMBYTE(s);
- IMMBYTE(r);
-
- WM(r, bcd_add(RM(s), RM(r), pSR & SR_C));
-
- m_icount -= 12;
+ m_icount -= 3;
+ shortbranch(check);
}
-void tms7000_device::dac_i2a()
+int tms7000_device::op_djnz(UINT8 param1, UINT8 param2)
{
- UINT8 i;
- IMMBYTE(i);
-
- WRA(bcd_add(i, RDA, pSR & SR_C));
-
- m_icount -= 9;
+ UINT16 t = param1 - 1;
+ shortbranch(t != 0);
+ return t;
}
-void tms7000_device::dac_i2b()
+int tms7000_device::op_btjo(UINT8 param1, UINT8 param2)
{
- UINT8 i;
- IMMBYTE(i);
-
- WRB(bcd_add(i, RDB, pSR & SR_C));
-
- m_icount -= 9;
+ UINT8 t = param1 & param2;
+ SET_CNZ(t);
+ shortbranch(t != 0);
+ return WB_NO;
}
-void tms7000_device::dac_i2r()
+int tms7000_device::op_btjz(UINT8 param1, UINT8 param2)
{
- UINT8 i, r;
- IMMBYTE(i);
- IMMBYTE(r);
-
- WM(r, bcd_add(i, RM(r), pSR & SR_C));
-
- m_icount -= 11;
+ UINT8 t = ~param1 & param2;
+ SET_CNZ(t);
+ shortbranch(t != 0);
+ return WB_NO;
}
-void tms7000_device::dec_a()
-{
- UINT16 t;
- t = RDA - 1;
-
- WRA( t );
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- if ((t&0xFF)!=0xFF) SETC;
-
- m_icount -= 5;
-}
-
-void tms7000_device::dec_b()
-{
- UINT16 t;
-
- t = RDB - 1;
-
- WRB( t );
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- if ((t&0xFF)!=0xFF) SETC;
-
- m_icount -= 5;
-}
-
-void tms7000_device::dec_r()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
-
- t = RM(r) - 1;
-
- WM( r, t );
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- if ((t&0xFF)!=0xFF) SETC;
-
- m_icount -= 7;
-}
+// other opcodes
+// dec double
void tms7000_device::decd_a()
{
- PAIR t;
-
- t.w.h = 0;
- t.w.l = RRF16(0);
- t.d -= 1;
- WRF16(0,t);
-
- CLR_NZC;
-
- SET_N16(t.d);
-
- if ((t.d&0xFF00)==0) SETZ;
- if ((t.d&0xFFFF)!=0xFFFF) SETC;
-
-
m_icount -= 9;
+ UINT32 t = read_r16(0) - 1;
+ write_r16(0, t);
+ SET_NZ(t >> 8);
+ SET_C(~(t >> 8));
}
void tms7000_device::decd_b()
{
- PAIR t;
-
- t.w.h = 0;
- t.w.l = RRF16(1);
- t.d -= 1;
- WRF16(1,t);
-
- CLR_NZC;
- SET_N16(t.d);
-
- if ((t.d&0xFF00)==0) SETZ;
- if ((t.d&0xFFFF)!=0xFFFF) SETC;
-
m_icount -= 9;
+ UINT32 t = read_r16(1) - 1;
+ write_r16(1, t);
+ SET_NZ(t >> 8);
+ SET_C(~(t >> 8));
}
void tms7000_device::decd_r()
{
- UINT8 r;
- PAIR t;
-
- IMMBYTE(r);
- t.w.h = 0;
- t.w.l = RRF16(r);
- t.d -= 1;
- WRF16(r,t);
-
- CLR_NZC;
- SET_N16(t.d);
-
- if ((t.d&0xFF00)==0) SETZ;
- if ((t.d&0xFFFF)!=0xFFFF) SETC;
-
m_icount -= 11;
+ UINT8 r = imm8();
+ UINT32 t = read_r16(r) - 1;
+ write_r16(r, t);
+ SET_NZ(t >> 8);
+ SET_C(~(t >> 8));
}
-void tms7000_device::dint()
-{
- CLR_NZCI;
- m_icount -= 5;
-}
-
-void tms7000_device::djnz_a()
-{
- UINT16 t;
-
- t = RDA - 1;
-
- WRA( t );
-
- if( t != 0 )
- {
- INT8 s;
-
- SIMMBYTE(s);
- pPC += s;
- m_icount -= 7;
- }
- else
- {
- pPC++;
- m_icount -= 2;
- }
-}
-
-void tms7000_device::djnz_b()
-{
- UINT16 t;
-
- t = RDB - 1;
-
- WRB( t );
-
- if( t != 0 )
- {
- INT8 s;
-
- SIMMBYTE(s);
- pPC += s;
- m_icount -= 7;
- }
- else
- {
- pPC++;
- m_icount -= 2;
- }
-}
-
-void tms7000_device::djnz_r()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
-
- t = RM(r) - 1;
-
- WM(r,t);
- if( t != 0 )
- {
- INT8 s;
-
- SIMMBYTE(s);
- pPC += s;
- m_icount -= 9;
- }
- else
- {
- pPC++;
- m_icount -= 3;
- }
-}
-
-void tms7000_device::dsb_b2a()
-{
- WRA(bcd_sub(RDA, RDB, pSR & SR_C));
-
- m_icount -= 7;
-}
-
-void tms7000_device::dsb_r2a()
-{
- UINT8 r;
- IMMBYTE(r);
-
- WRA(bcd_sub(RDA, RM(r), pSR & SR_C));
-
- m_icount -= 10;
-}
-
-void tms7000_device::dsb_r2b()
-{
- UINT8 r;
- IMMBYTE(r);
-
- WRB(bcd_sub(RDB, RM(r), pSR & SR_C));
-
- m_icount -= 10;
-}
-
-void tms7000_device::dsb_r2r()
+// cmpa extended
+void tms7000_device::cmpa_dir()
{
- UINT8 s, r;
- IMMBYTE(s);
- IMMBYTE(r);
-
- WM(r, bcd_sub(RM(s), RM(r), pSR & SR_C));
-
m_icount -= 12;
+ UINT16 t = read_r8(0) - read_mem8(imm16());
+ SET_NZ(t);
+ SET_C(~t);
}
-void tms7000_device::dsb_i2a()
-{
- UINT8 i;
- IMMBYTE(i);
-
- WRA(bcd_sub(RDA, i, pSR & SR_C));
-
- m_icount -= 9;
-}
-
-void tms7000_device::dsb_i2b()
+void tms7000_device::cmpa_inx()
{
- UINT8 i;
- IMMBYTE(i);
-
- WRB(bcd_sub(RDB, i, pSR & SR_C));
-
- m_icount -= 9;
+ m_icount -= 14;
+ UINT16 t = read_r8(0) - read_mem8(imm16() + read_r8(1));
+ SET_NZ(t);
+ SET_C(~t);
}
-void tms7000_device::dsb_i2r()
+void tms7000_device::cmpa_ind()
{
- UINT8 i, r;
- IMMBYTE(i);
- IMMBYTE(r);
-
- WM(r, bcd_sub(RM(r), i, pSR & SR_C));
-
m_icount -= 11;
+ UINT16 t = read_r8(0) - read_mem8(read_r16(imm8()));
+ SET_NZ(t);
+ SET_C(~t);
}
-void tms7000_device::eint()
-{
- pSR |= (SR_N|SR_Z|SR_C|SR_I);
- m_icount -= 5;
- tms7000_check_IRQ_lines();
-}
-
-void tms7000_device::idle()
-{
- m_idle_state = 1;
- m_icount -= 6;
-}
-
-void tms7000_device::inc_a()
-{
- UINT16 t;
-
- t = RDA + 1;
-
- WRA( t );
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::inc_b()
-{
- UINT16 t;
-
- t = RDB + 1;
-
- WRB( t );
-
- CLR_NZC;
- SET_C8(t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::inc_r()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
-
- t = RM(r) + 1;
-
- WM( r, t );
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
- SET_C8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::inv_a()
-{
- UINT16 t;
-
- t = ~(RDA);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::inv_b()
-{
- UINT16 t;
-
- t = ~(RDB);
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::inv_r()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
-
- t = ~(RM(r));
-
- WM( r, t );
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::jc()
-{
- if( pSR & SR_C )
- {
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
- }
- else
- {
- pPC++;
- m_icount -= 5;
- }
-}
-
-void tms7000_device::jeq()
-{
- if( pSR & SR_Z )
- {
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
- }
- else
- {
- pPC++;
- m_icount -= 5;
- }
-}
-
-void tms7000_device::jl()
-{
- if( pSR & SR_C )
- {
- pPC++;
- m_icount -= 5;
- }
- else
- {
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
- }
-}
-
-void tms7000_device::jmp()
-{
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
-}
-
-void tms7000_device::j_jn()
-{
- if( pSR & SR_N )
- {
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
- }
- else
- {
- pPC++;
- m_icount -= 5;
- }
-
-}
-
-void tms7000_device::jne()
-{
- if( pSR & SR_Z )
- {
- pPC++;
- m_icount -= 5;
- }
- else
- {
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
- }
-}
-
-void tms7000_device::jp()
-{
- if( pSR & (SR_Z|SR_N) )
- {
- pPC++;
- m_icount -= 5;
- }
- else
- {
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
- }
-}
-
-void tms7000_device::jpz()
-{
- // NOTE: JPZ in TI documentation was wrong:
- // if ((pSR & SR_N) == 0 && (pSR & SR_Z) != 0)
- // should be:
- // if ((pSR & SR_N) == 0)
- if ((pSR & SR_N) == 0)
- {
- INT8 s;
-
- SIMMBYTE( s );
- pPC += s;
- m_icount -= 7;
- }
- else
- {
- pPC++;
- m_icount -= 5;
- }
-}
-
+// lda extended
void tms7000_device::lda_dir()
{
- UINT16 t;
- PAIR i;
-
- IMMWORD( i );
- t = RM(i.w.l);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 11;
-}
-
-void tms7000_device::lda_ind()
-{
- UINT16 t;
- PAIR p;
- INT8 i;
-
- IMMBYTE(i);
- p.w.l=RRF16(i);
- t = RM(p.w.l);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
+ UINT8 t = read_mem8(imm16());
+ write_r8(0, t);
+ SET_CNZ(t);
}
void tms7000_device::lda_inx()
{
- UINT16 t;
- PAIR i;
-
- IMMWORD( i );
- t = RM(i.w.l + RDB);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 13;
+ UINT8 t = read_mem8(imm16() + read_r8(1));
+ write_r8(0, t);
+ SET_CNZ(t);
}
-void tms7000_device::ldsp()
-{
- pSP = RDB;
- m_icount -= 5;
-}
-
-void tms7000_device::mov_a2b()
-{
- UINT16 t;
-
- t = RDA;
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 6;
-}
-
-void tms7000_device::mov_b2a()
-{
- UINT16 t;
-
- t = RDB;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-
-void tms7000_device::mov_a2r()
-{
- UINT8 r;
- UINT16 t;
-
- IMMBYTE(r);
-
- t = RDA;
- WM(r,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::mov_b2r()
-{
- UINT8 r;
- UINT16 t;
-
- IMMBYTE(r);
-
- t = RDB;
- WM(r,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::mov_r2a()
-{
- UINT8 r;
- UINT16 t;
-
- IMMBYTE(r);
- t = RM(r);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::mov_r2b()
-{
- UINT8 r;
- UINT16 t;
-
- IMMBYTE(r);
- t = RM(r);
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::mov_r2r()
+void tms7000_device::lda_ind()
{
- UINT8 r,s;
- UINT16 t;
-
- IMMBYTE(r);
- IMMBYTE(s);
- t = RM(r);
- WM(s,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 10;
+ UINT8 t = read_mem8(read_r16(imm8()));
+ write_r8(0, t);
+ SET_CNZ(t);
}
-void tms7000_device::mov_i2a()
+// sta extended
+void tms7000_device::sta_dir()
{
- UINT16 t;
-
- IMMBYTE(t);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
+ m_icount -= 11;
+ UINT8 t = read_r8(0);
+ write_mem8(imm16(), t);
+ SET_CNZ(t);
}
-void tms7000_device::mov_i2b()
+void tms7000_device::sta_inx()
{
- UINT16 t;
-
- IMMBYTE(t);
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
+ m_icount -= 13;
+ UINT8 t = read_r8(0);
+ write_mem8(imm16() + read_r8(1), t);
+ SET_CNZ(t);
}
-void tms7000_device::mov_i2r()
+void tms7000_device::sta_ind()
{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(t);
- IMMBYTE(r);
- WM(r,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
+ m_icount -= 10;
+ UINT8 t = read_r8(0);
+ write_mem8(read_r16(imm8()), t);
+ SET_CNZ(t);
}
-void tms7000_device::movd_imm()
+// mov double
+void tms7000_device::movd_dir()
{
- PAIR t;
- UINT8 r;
-
- IMMWORD(t);
- IMMBYTE(r);
- WRF16(r,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
m_icount -= 15;
-
-}
-
-void tms7000_device::movd_r()
-{
- PAIR t;
- UINT8 r,s;
-
- IMMBYTE(r);
- IMMBYTE(s);
- t.w.l = RRF16(r);
- WRF16(s,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 14;
-
+ UINT16 t = imm16();
+ write_r16(imm8(), t);
+ SET_CNZ(t >> 8 & 0xff);
}
void tms7000_device::movd_inx()
{
- PAIR t;
- UINT8 r;
-
- IMMWORD(t);
- t.w.l = (t.w.l+RDB)&0xFFFF;
- IMMBYTE(r);
- WRF16(r,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
m_icount -= 17;
+ UINT16 t = imm16() + read_r8(1);
+ write_r16(imm8(), t);
+ SET_CNZ(t >> 8 & 0xff);
}
-void tms7000_device::movp_a2p()
+void tms7000_device::movd_ind()
{
- UINT8 p;
- UINT16 t;
-
- IMMBYTE(p);
- t=RDA;
- WM( 0x0100+p,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
+ m_icount -= 14;
+ UINT16 t = read_r16(imm8());
+ write_r16(imm8(), t);
+ SET_CNZ(t >> 8 & 0xff);
}
-void tms7000_device::movp_b2p()
+// long branch
+void tms7000_device::br_dir()
{
- UINT8 p;
- UINT16 t;
-
- IMMBYTE(p);
- t=RDB;
- WM( 0x0100+p,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 10;
+ m_pc = imm16();
}
-#if 0
-/* this appears to be unused */
-void tms7000_device::movp_r2p()
+void tms7000_device::br_inx()
{
- UINT8 p,r;
- UINT16 t;
-
- IMMBYTE(r);
- IMMBYTE(p);
- t=RM(r);
- WM( 0x0100+p,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 11;
+ m_icount -= 12;
+ m_pc = imm16() + read_r8(1);
}
-#endif
-void tms7000_device::movp_p2a()
+void tms7000_device::br_ind()
{
- UINT8 p;
- UINT16 t;
-
- IMMBYTE(p);
- t=RM(0x0100+p);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 9;
+ m_pc = read_r16(imm8());
}
-void tms7000_device::movp_p2b()
-{
- UINT8 p;
- UINT16 t;
-
- IMMBYTE(p);
- t=RM(0x0100+p);
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::mpy_ba()
-{
- PAIR t;
-
- t.w.l = RDA * RDB;
-
- WRF16(0x01,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 43;
-
-}
-
-void tms7000_device::mpy_ra()
-{
- PAIR t;
- UINT8 r;
-
- IMMBYTE(r);
-
- t.w.l = RDA * RM(r);
-
- WRF16(0x01,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 46;
-
-}
-
-void tms7000_device::mpy_rb()
-{
- PAIR t;
- UINT8 r;
-
- IMMBYTE(r);
-
- t.w.l = RDB * RM(r);
-
- WRF16(0x01,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 46;
-
-}
-
-void tms7000_device::mpy_rr()
-{
- PAIR t;
- UINT8 r,s;
-
- IMMBYTE(r);
- IMMBYTE(s);
-
- t.w.l = RM(s) * RM(r);
-
- WRF16(0x01,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 48;
-
-}
-
-void tms7000_device::mpy_ia()
-{
- PAIR t;
- UINT8 i;
-
- IMMBYTE(i);
-
- t.w.l = RDA * i;
-
- WRF16(0x01,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 45;
-
-}
-
-void tms7000_device::mpy_ib()
-{
- PAIR t;
- UINT8 i;
-
- IMMBYTE(i);
-
- t.w.l = RDB * i;
-
- WRF16(0x01,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 45;
-
-}
-
-void tms7000_device::mpy_ir()
-{
- PAIR t;
- UINT8 i,r;
-
- IMMBYTE(i);
- IMMBYTE(r);
-
- t.w.l = RM(r) * i;
-
- WRF16(0x01,t);
-
- CLR_NZC;
- SET_N8(t.b.h);
- SET_Z8(t.b.h);
-
- m_icount -= 47;
-
-}
-
-void tms7000_device::nop()
-{
- m_icount -= 4;
-}
-
-void tms7000_device::or_b2a()
-{
- UINT8 t;
-
- t = RDA | RDB;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::or_r2a()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) | RDA;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::or_r2b()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) | RDB;
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::or_r2r()
-{
- UINT8 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = RM(i) | RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::or_i2a()
+// call/return
+void tms7000_device::call_dir()
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v | RDA;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
+ m_icount -= 14;
+ UINT16 t = imm16();
+ push16(m_pc);
+ m_pc = t;
}
-void tms7000_device::or_i2b()
+void tms7000_device::call_inx()
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v | RDB;
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
+ m_icount -= 16;
+ UINT16 t = imm16() + read_r8(1);
+ push16(m_pc);
+ m_pc = t;
}
-void tms7000_device::or_i2r()
+void tms7000_device::call_ind()
{
- UINT8 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = i | RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
+ m_icount -= 13;
+ UINT16 t = read_r16(imm8());
+ push16(m_pc);
+ m_pc = t;
}
-void tms7000_device::orp_a2p()
+void tms7000_device::trap(UINT8 address)
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
- t = RDA | RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
+ m_icount -= 14;
+ push16(m_pc);
+ m_pc = read_mem16(0xff00 | address);
}
-void tms7000_device::orp_b2p()
+void tms7000_device::reti()
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
- t = RDB | RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 9;
+ m_pc = pull16();
+ m_sr = pull8() & 0xf0;
+ check_interrupts();
}
-void tms7000_device::orp_i2p()
+void tms7000_device::rets()
{
- UINT8 t;
- UINT8 i,v;
-
- IMMBYTE(i);
- IMMBYTE(v);
- t = i | RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 11;
+ m_icount -= 7;
+ m_pc = pull16();
}
+// pop
void tms7000_device::pop_a()
{
- UINT16 t;
-
- PULLBYTE(t);
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 6;
+ UINT8 t = pull8();
+ write_r8(0, t);
+ SET_CNZ(t);
}
void tms7000_device::pop_b()
{
- UINT16 t;
-
- PULLBYTE(t);
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 6;
+ UINT8 t = pull8();
+ write_r8(1, t);
+ SET_CNZ(t);
}
void tms7000_device::pop_r()
{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- PULLBYTE(t);
- WM(r,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 8;
+ UINT8 t = pull8();
+ write_r8(imm8(), t);
+ SET_CNZ(t);
}
void tms7000_device::pop_st()
{
- UINT16 t;
-
- PULLBYTE(t);
- pSR = t;
-
m_icount -= 6;
+ m_sr = pull8() & 0xf0;
+ check_interrupts();
}
+// push
void tms7000_device::push_a()
{
- UINT16 t;
-
- t = RDA;
- PUSHBYTE(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 6;
+ UINT8 t = read_r8(0);
+ push8(t);
+ SET_CNZ(t);
}
void tms7000_device::push_b()
{
- UINT16 t;
-
- t = RDB;
- PUSHBYTE(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 6;
+ UINT8 t = read_r8(1);
+ push8(t);
+ SET_CNZ(t);
}
void tms7000_device::push_r()
{
- UINT16 t;
- INT8 r;
-
- IMMBYTE(r);
- t = RM(r);
- PUSHBYTE(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 8;
+ UINT8 t = read_r8(imm8());
+ push8(t);
+ SET_CNZ(t);
}
void tms7000_device::push_st()
{
- UINT16 t;
- t = pSR;
- PUSHBYTE(t);
-
m_icount -= 6;
+ push8(m_sr);
}
-void tms7000_device::reti()
-{
- PULLWORD( PC );
- PULLBYTE( pSR );
-
- m_icount -= 9;
- tms7000_check_IRQ_lines();
-}
-
-void tms7000_device::rets()
-{
- PULLWORD( PC );
- m_icount -= 7;
-}
-
-void tms7000_device::rl_a()
-{
- UINT16 t;
-
- t = RDA << 1;
-
- CLR_NZC;
- SET_C8(t);
-
- if( pSR & SR_C )
- t |= 0x01;
-
- SET_N8(t);
- SET_Z8(t);
- WRA(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::rl_b()
-{
- UINT16 t;
-
- t = RDB << 1;
-
- CLR_NZC;
- SET_C8(t);
-
- if( pSR & SR_C )
- t |= 0x01;
-
- SET_N8(t);
- SET_Z8(t);
- WRB(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::rl_r()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- t = RM(r) << 1;
-
- CLR_NZC;
- SET_C8(t);
-
- if( pSR & SR_C )
- t |= 0x01;
-
- SET_N8(t);
- SET_Z8(t);
- WM(r,t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::rlc_a()
-{
- UINT16 t;
- int old_carry;
-
- old_carry = (pSR & SR_C);
-
- t = RDA << 1;
-
- CLR_NZC;
- SET_C8(t);
-
- if( old_carry )
- t |= 0x01;
-
- SET_N8(t);
- SET_Z8(t);
- WRA(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::rlc_b()
-{
- UINT16 t;
- int old_carry;
-
- old_carry = (pSR & SR_C);
-
- t = RDB << 1;
-
- CLR_NZC;
- SET_C8(t);
-
- if( old_carry )
- t |= 0x01;
-
- SET_N8(t);
- SET_Z8(t);
- WRB(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::rlc_r()
-{
- UINT16 t;
- UINT8 r;
- int old_carry;
-
- old_carry = (pSR & SR_C);
-
- IMMBYTE(r);
- t = RM(r) << 1;
-
- CLR_NZC;
- SET_C8(t);
-
- if( old_carry )
- t |= 0x01;
-
- SET_N8(t);
- SET_Z8(t);
- WM(r,t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::rr_a()
-{
- UINT16 t;
- int old_bit0;
-
- t = RDA;
-
- old_bit0 = t & 0x0001;
- t = t >> 1;
-
- CLR_NZC;
-
- if( old_bit0 )
- {
- SETC;
- t |= 0x80;
- }
-
- SET_N8(t);
- SET_Z8(t);
-
- WRA(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::rr_b()
+// other
+void tms7000_device::nop()
{
- UINT16 t;
- int old_bit0;
-
- t = RDB;
-
- old_bit0 = t & 0x0001;
- t = t >> 1;
-
- CLR_NZC;
-
- if( old_bit0 )
- {
- SETC;
- t |= 0x80;
- }
-
- SET_N8(t);
- SET_Z8(t);
-
- WRB(t);
-
m_icount -= 5;
}
-void tms7000_device::rr_r()
-{
- UINT16 t;
- UINT8 r;
-
- int old_bit0;
-
- IMMBYTE(r);
- t = RM(r);
-
- old_bit0 = t & 0x0001;
- t = t >> 1;
-
- CLR_NZC;
-
- if( old_bit0 )
- {
- SETC;
- t |= 0x80;
- }
-
- SET_N8(t);
- SET_Z8(t);
-
- WM(r,t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::rrc_a()
+void tms7000_device::idle()
{
- UINT16 t;
- int old_bit0;
-
- t = RDA;
-
- old_bit0 = t & 0x0001;
- /* Place carry bit in 9th position */
- t |= ((pSR & SR_C) << 1);
- t = t >> 1;
-
- CLR_NZC;
-
- if( old_bit0 )
- SETC;
- SET_N8(t);
- SET_Z8(t);
-
- WRA(t);
-
- m_icount -= 5;
+ m_icount -= 6;
+ m_pc--;
+ m_idle_state = true;
}
-void tms7000_device::rrc_b()
+void tms7000_device::dint()
{
- UINT16 t;
- int old_bit0;
-
- t = RDB;
-
- old_bit0 = t & 0x0001;
- /* Place carry bit in 9th position */
- t |= ((pSR & SR_C) << 1);
- t = t >> 1;
-
- CLR_NZC;
-
- if( old_bit0 )
- SETC;
- SET_N8(t);
- SET_Z8(t);
-
- WRB(t);
-
m_icount -= 5;
+ m_sr &= ~(SR_N | SR_Z | SR_C | SR_I);
}
-void tms7000_device::rrc_r()
-{
- UINT16 t;
- UINT8 r;
- int old_bit0;
-
- IMMBYTE(r);
- t = RM(r);
-
- old_bit0 = t & 0x0001;
- /* Place carry bit in 9th position */
- t |= ((pSR & SR_C) << 1);
- t = t >> 1;
-
- CLR_NZC;
-
- if( old_bit0 )
- SETC;
- SET_N8(t);
- SET_Z8(t);
-
- WM(r,t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::sbb_ba()
+void tms7000_device::eint()
{
- UINT16 t;
-
- t = RDA - RDB - ((pSR & SR_C) ? 0 : 1);
- WRA(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 5;
+ m_sr |= (SR_N | SR_Z | SR_C | SR_I);
+ check_interrupts();
}
-void tms7000_device::sbb_ra()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- t = RDA - RM(r) - ((pSR & SR_C) ? 0 : 1);
- WRA(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::sbb_rb()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- t = RDB - RM(r) - ((pSR & SR_C) ? 0 : 1);
- WRB(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::sbb_rr()
-{
- UINT16 t;
- UINT8 r,s;
-
- IMMBYTE(s);
- IMMBYTE(r);
- t = RM(r) - RM(s) - ((pSR & SR_C) ? 0 : 1);
- WM(r,t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::sbb_ia()
-{
- UINT16 t;
- UINT8 i;
-
- IMMBYTE(i);
- t = RDA - i - ((pSR & SR_C) ? 0 : 1);
- WRA(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::sbb_ib()
-{
- UINT16 t;
- UINT8 i;
-
- IMMBYTE(i);
- t = RDB - i - ((pSR & SR_C) ? 0 : 1);
- WRB(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::sbb_ir()
-{
- UINT16 t;
- UINT8 r,i;
-
- IMMBYTE(i);
- IMMBYTE(r);
- t = RM(r) - i - ((pSR & SR_C) ? 0 : 1);
- WM(r,t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
-}
-
-void tms7000_device::setc()
+void tms7000_device::ldsp()
{
- CLR_NZC;
- pSR |= (SR_C|SR_Z);
-
m_icount -= 5;
-}
-
-void tms7000_device::sta_dir()
-{
- UINT16 t;
- PAIR i;
-
- t = RDA;
- IMMWORD( i );
-
- WM(i.w.l,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 11;
-}
-
-void tms7000_device::sta_ind()
-{
- UINT16 t;
- PAIR p;
- INT8 r;
-
- IMMBYTE(r);
- p.w.l = RRF16(r);
- t = RDA;
- WM(p.w.l,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::sta_inx()
-{
- UINT16 t;
- PAIR i;
-
- IMMWORD( i );
- t = RDA;
- WM(i.w.l+RDB,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 13;
+ m_sp = read_r8(1);
}
void tms7000_device::stsp()
{
- WRB(pSP);
-
m_icount -= 6;
+ write_r8(1, m_sp);
}
-void tms7000_device::sub_ba()
-{
- UINT16 t;
-
- t = RDA - RDB;
- WRA(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 5;
-}
-
-void tms7000_device::sub_ra()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- t = RDA - RM(r);
- WRA(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::sub_rb()
-{
- UINT16 t;
- UINT8 r;
-
- IMMBYTE(r);
- t = RDB - RM(r);
- WRB(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::sub_rr()
-{
- UINT16 t;
- UINT8 r,s;
-
- IMMBYTE(s);
- IMMBYTE(r);
- t = RM(r) - RM(s);
- WM(r,t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::sub_ia()
-{
- UINT16 t;
- UINT8 i;
-
- IMMBYTE(i);
- t = RDA - i;
- WRA(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::sub_ib()
-{
- UINT16 t;
- UINT8 i;
-
- IMMBYTE(i);
- t = RDB - i;
- WRB(t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::sub_ir()
-{
- UINT16 t;
- UINT8 r,i;
-
- IMMBYTE(i);
- IMMBYTE(r);
- t = RM(r) - i;
- WM(r,t);
-
- CLR_NZC;
- SET_C8(~t);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
-}
-
-void tms7000_device::trap_0()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfffe);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_1()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfffc);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_2()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfffa);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_3()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfff8);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_4()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfff6);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_5()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfff4);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_6()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfff2);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_7()
-{
- PUSHWORD( PC );
- pPC = RM16(0xfff0);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_8()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffee);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_9()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffec);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_10()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffea);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_11()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffe8);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_12()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffe6);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_13()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffe4);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_14()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffe2);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_15()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffe0);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_16()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffde);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_17()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffdc);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_18()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffda);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_19()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffd8);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_20()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffd6);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_21()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffd4);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_22()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffd2);
- m_icount -= 14;
-}
-
-void tms7000_device::trap_23()
-{
- PUSHWORD( PC );
- pPC = RM16(0xffd0);
- m_icount -= 14;
-}
-
-void tms7000_device::swap_a()
-{
- UINT8 a,b;
- UINT16 t;
-
- a = b = RDA;
-
- a <<= 4;
- b >>= 4;
- t = a+b;
-
- WRA(t);
-
- CLR_NZC;
-
- pSR|=((t&0x0001)<<7);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -=8;
-}
-
-void tms7000_device::swap_b()
-{
- UINT8 a,b;
- UINT16 t;
-
- a = b = RDB;
-
- a <<= 4;
- b >>= 4;
- t = a+b;
-
- WRB(t);
-
- CLR_NZC;
-
- pSR|=((t&0x0001)<<7);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -=8;
-}
-
-void tms7000_device::swap_r()
-{
- UINT8 a,b,r;
- UINT16 t;
-
- IMMBYTE(r);
- a = b = RM(r);
-
- a <<= 4;
- b >>= 4;
- t = a+b;
-
- WM(r,t);
-
- CLR_NZC;
-
- pSR|=((t&0x0001)<<7);
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -=8;
-}
-
-void tms7000_device::swap_r_exl()
-{
- UINT16 t;
-
- SKIPBYTE();
-
- /* opcode D7 ?? (LVDP) mostly equivalent to
- * MOVP P40,xx
- * MOVP P36,A
- */
- RM(0x0128);
- t=RM(0x0124);
- WM(0,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9; /* FIXME : check real timing */
-}
-
-void tms7000_device::tstb()
-{
- UINT16 t;
-
- t=RDB;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 6;
-}
-
-void tms7000_device::xchb_a()
-{
- UINT16 t,u;
-
- t = RDB;
- u = RDA;
-
- WRA(t);
- WRB(u);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 6;
-}
-
-void tms7000_device::xchb_b()
-{
- UINT16 t;
-
- t = RDB;
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 6;
-}
-
-void tms7000_device::xchb_r()
-{
- UINT16 t,u;
- UINT8 r;
-
- IMMBYTE(r);
-
- t = RDB;
- u = RM(r);
-
- WM(r,t);
- WRB(u);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::xor_b2a()
+void tms7000_device::setc()
{
- UINT8 t;
-
- t = RDA ^ RDB;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
m_icount -= 5;
+ m_sr = (m_sr & ~SR_N) | SR_C | SR_Z;
}
-void tms7000_device::xor_r2a()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) ^ RDA;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::xor_r2b()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = RM(v) ^ RDB;
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 8;
-}
-
-void tms7000_device::xor_r2r()
-{
- UINT8 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = RM(i) ^ RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::xor_i2a()
+// not standard
+void tms7020_exl_device::lvdp()
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v ^ RDA;
- WRA(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
+ /* on EXL100, opcode D7 ?? (SWAP R) was changed to LVDP, mostly equivalent to:
+ * MOVP P40,xx
+ * MOVP P36,A
+ */
+ m_icount -= 10; // TODO: check real timing
+ imm8(); // always 0x28? discarded?
+ read_p(0x28);
+ UINT8 t = read_p(0x24);
+ write_r8(0, t);
+ SET_CNZ(t);
}
-void tms7000_device::xor_i2b()
+// illegal opcode handling
+void tms7000_device::illegal(UINT8 op)
{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
-
- t = v ^ RDB;
- WRB(t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 7;
-}
-
-void tms7000_device::xor_i2r()
-{
- UINT8 t;
- UINT8 i,j;
-
- IMMBYTE(i);
- IMMBYTE(j);
-
- t = i ^ RM(j);
- WM(j,t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
-}
-
-void tms7000_device::xorp_a2p()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
- t = RDA ^ RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 10;
-}
-
-void tms7000_device::xorp_b2p()
-{
- UINT8 t;
- UINT8 v;
-
- IMMBYTE(v);
- t = RDB ^ RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 9;
-}
-
-void tms7000_device::xorp_i2p()
-{
- UINT8 t;
- UINT8 i,v;
-
- IMMBYTE(i);
- IMMBYTE(v);
- t = i ^ RM( 0x0100 + v);
- WM( 0x0100+v, t);
-
- CLR_NZC;
- SET_N8(t);
- SET_Z8(t);
-
- m_icount -= 11;
+ m_icount -= 5; // guessed
+ logerror("%s: illegal opcode $%02X @ $%04x\n", tag(), op, m_pc);
}
diff --git a/src/emu/cpu/tms7000/tms70tb.inc b/src/emu/cpu/tms7000/tms70tb.inc
deleted file mode 100644
index ddfc25dc1d2..00000000000
--- a/src/emu/cpu/tms7000/tms70tb.inc
+++ /dev/null
@@ -1,124 +0,0 @@
-/*****************************************************************************
- *
- * tms70tb.inc (function table)
- * Portable TMS7000 emulator (Texas Instruments 7000)
- *
- * Copyright tim lindner, all rights reserved.
- *
- * - This source code is released as freeware for non-commercial purposes.
- * - You are free to use and redistribute this code in modified or
- * unmodified form, provided you list me in the credits.
- * - If you modify this source code, you must add a notice to each modified
- * source file that it has been changed. If you're a nice person, you
- * will clearly mark each change too. :)
- * - If you wish to use this for commercial purposes, please contact me at
- * tlindner@macmess.org
- * - This entire notice must remain in the source code.
- *
- *****************************************************************************/
-
-const tms7000_device::opcode_func tms7000_device::s_opfn[0x100] = {
-/* 0xX0, 0xX1, 0xX2, 0xX3, 0xX4, 0xX5, 0xX6, 0xX7,
- 0xX8, 0xX9, 0xXA, 0xXB, 0xXC, 0xXD, 0xXE, 0xXF */
-
-/* 0x0X */ &tms7000_device::nop, &tms7000_device::idle, &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::eint, &tms7000_device::dint, &tms7000_device::setc,
- &tms7000_device::pop_st, &tms7000_device::stsp, &tms7000_device::rets, &tms7000_device::reti, &tms7000_device::illegal, &tms7000_device::ldsp, &tms7000_device::push_st, &tms7000_device::illegal,
-
-/* 0x1X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_r2a, &tms7000_device::and_r2a, &tms7000_device::or_r2a, &tms7000_device::xor_r2a, &tms7000_device::btjo_r2a,&tms7000_device::btjz_r2a,
- &tms7000_device::add_r2a, &tms7000_device::adc_r2a, &tms7000_device::sub_ra, &tms7000_device::sbb_ra, &tms7000_device::mpy_ra, &tms7000_device::cmp_ra, &tms7000_device::dac_r2a, &tms7000_device::dsb_r2a,
-
-/* 0x2X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_i2a, &tms7000_device::and_i2a, &tms7000_device::or_i2a, &tms7000_device::xor_i2a, &tms7000_device::btjo_i2a,&tms7000_device::btjz_i2a,
- &tms7000_device::add_i2a, &tms7000_device::adc_i2a, &tms7000_device::sub_ia, &tms7000_device::sbb_ia, &tms7000_device::mpy_ia, &tms7000_device::cmp_ia, &tms7000_device::dac_i2a, &tms7000_device::dsb_i2a,
-
-/* 0x3X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_r2b, &tms7000_device::and_r2b, &tms7000_device::or_r2b, &tms7000_device::xor_r2b, &tms7000_device::btjo_r2b,&tms7000_device::btjz_r2b,
- &tms7000_device::add_r2b, &tms7000_device::adc_r2b, &tms7000_device::sub_rb, &tms7000_device::sbb_rb, &tms7000_device::mpy_rb, &tms7000_device::cmp_rb, &tms7000_device::dac_r2b, &tms7000_device::dsb_r2b,
-
-/* 0x4X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_r2r, &tms7000_device::and_r2r, &tms7000_device::or_r2r, &tms7000_device::xor_r2r, &tms7000_device::btjo_r2r,&tms7000_device::btjz_r2r,
- &tms7000_device::add_r2r, &tms7000_device::adc_r2r, &tms7000_device::sub_rr, &tms7000_device::sbb_rr, &tms7000_device::mpy_rr, &tms7000_device::cmp_rr, &tms7000_device::dac_r2r, &tms7000_device::dsb_r2r,
-
-/* 0x5X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_i2b, &tms7000_device::and_i2b, &tms7000_device::or_i2b, &tms7000_device::xor_i2b, &tms7000_device::btjo_i2b,&tms7000_device::btjz_i2b,
- &tms7000_device::add_i2b, &tms7000_device::adc_i2b, &tms7000_device::sub_ib, &tms7000_device::sbb_ib, &tms7000_device::mpy_ib, &tms7000_device::cmp_ib, &tms7000_device::dac_i2b, &tms7000_device::dsb_i2b,
-
-/* 0x6X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_b2a, &tms7000_device::and_b2a, &tms7000_device::or_b2a, &tms7000_device::xor_b2a, &tms7000_device::btjo_b2a,&tms7000_device::btjz_b2a,
- &tms7000_device::add_b2a, &tms7000_device::adc_b2a, &tms7000_device::sub_ba, &tms7000_device::sbb_ba, &tms7000_device::mpy_ba, &tms7000_device::cmp_ba, &tms7000_device::dac_b2a, &tms7000_device::dsb_b2a,
-
-/* 0x7X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_i2r, &tms7000_device::and_i2r, &tms7000_device::or_i2r, &tms7000_device::xor_i2r, &tms7000_device::btjo_i2r,&tms7000_device::btjz_i2r,
- &tms7000_device::add_i2r, &tms7000_device::adc_i2r, &tms7000_device::sub_ir, &tms7000_device::sbb_ir, &tms7000_device::mpy_ir, &tms7000_device::cmp_ir, &tms7000_device::dac_i2r, &tms7000_device::dsb_i2r,
-
-/* 0x8X */ &tms7000_device::movp_p2a,&tms7000_device::illegal, &tms7000_device::movp_a2p,&tms7000_device::andp_a2p,&tms7000_device::orp_a2p, &tms7000_device::xorp_a2p,&tms7000_device::btjop_ap,&tms7000_device::btjzp_ap,
- &tms7000_device::movd_imm,&tms7000_device::illegal, &tms7000_device::lda_dir, &tms7000_device::sta_dir, &tms7000_device::br_dir, &tms7000_device::cmpa_dir,&tms7000_device::call_dir,&tms7000_device::illegal,
-
-/* 0x9X */ &tms7000_device::illegal, &tms7000_device::movp_p2b,&tms7000_device::movp_b2p,&tms7000_device::andp_b2p,&tms7000_device::orp_b2p, &tms7000_device::xorp_b2p,&tms7000_device::btjop_bp,&tms7000_device::btjzp_bp,
- &tms7000_device::movd_r, &tms7000_device::illegal, &tms7000_device::lda_ind, &tms7000_device::sta_ind, &tms7000_device::br_ind, &tms7000_device::cmpa_ind,&tms7000_device::call_ind,&tms7000_device::illegal,
-
-/* 0xAX */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::movp_i2p,&tms7000_device::andp_i2p,&tms7000_device::orp_i2p, &tms7000_device::xorp_i2p,&tms7000_device::btjop_ip,&tms7000_device::btjzp_ip,
- &tms7000_device::movd_inx,&tms7000_device::illegal, &tms7000_device::lda_inx, &tms7000_device::sta_inx, &tms7000_device::br_inx, &tms7000_device::cmpa_inx,&tms7000_device::call_inx,&tms7000_device::illegal,
-
-/* 0xBX */ &tms7000_device::clrc, &tms7000_device::illegal, &tms7000_device::dec_a, &tms7000_device::inc_a, &tms7000_device::inv_a, &tms7000_device::clr_a, &tms7000_device::xchb_a, &tms7000_device::swap_a,
- &tms7000_device::push_a, &tms7000_device::pop_a, &tms7000_device::djnz_a, &tms7000_device::decd_a, &tms7000_device::rr_a, &tms7000_device::rrc_a, &tms7000_device::rl_a, &tms7000_device::rlc_a,
-
-/* 0xCX */ &tms7000_device::mov_a2b, &tms7000_device::tstb, &tms7000_device::dec_b, &tms7000_device::inc_b, &tms7000_device::inv_b, &tms7000_device::clr_b, &tms7000_device::xchb_b, &tms7000_device::swap_b,
- &tms7000_device::push_b, &tms7000_device::pop_b, &tms7000_device::djnz_b, &tms7000_device::decd_b, &tms7000_device::rr_b, &tms7000_device::rrc_b, &tms7000_device::rl_b, &tms7000_device::rlc_b,
-
-/* 0xDX */ &tms7000_device::mov_a2r, &tms7000_device::mov_b2r, &tms7000_device::dec_r, &tms7000_device::inc_r, &tms7000_device::inv_r, &tms7000_device::clr_r, &tms7000_device::xchb_r, &tms7000_device::swap_r,
- &tms7000_device::push_r, &tms7000_device::pop_r, &tms7000_device::djnz_r, &tms7000_device::decd_r, &tms7000_device::rr_r, &tms7000_device::rrc_r, &tms7000_device::rl_r, &tms7000_device::rlc_r,
-
-/* 0xEX */ &tms7000_device::jmp, &tms7000_device::j_jn, &tms7000_device::jeq, &tms7000_device::jc, &tms7000_device::jp, &tms7000_device::jpz, &tms7000_device::jne, &tms7000_device::jl,
- &tms7000_device::trap_23, &tms7000_device::trap_22, &tms7000_device::trap_21, &tms7000_device::trap_20, &tms7000_device::trap_19, &tms7000_device::trap_18, &tms7000_device::trap_17, &tms7000_device::trap_16,
-
-/* 0xFX */ &tms7000_device::trap_15, &tms7000_device::trap_14, &tms7000_device::trap_13, &tms7000_device::trap_12, &tms7000_device::trap_11, &tms7000_device::trap_10, &tms7000_device::trap_9, &tms7000_device::trap_8,
- &tms7000_device::trap_7, &tms7000_device::trap_6, &tms7000_device::trap_5, &tms7000_device::trap_4, &tms7000_device::trap_3, &tms7000_device::trap_2, &tms7000_device::trap_1, &tms7000_device::trap_0
-};
-
-const tms7000_device::opcode_func tms7000_device::s_opfn_exl[0x100] = {
-/* 0xX0, 0xX1, 0xX2, 0xX3, 0xX4, 0xX5, 0xX6, 0xX7,
- 0xX8, 0xX9, 0xXA, 0xXB, 0xXC, 0xXD, 0xXE, 0xXF */
-
-/* 0x0X */ &tms7000_device::nop, &tms7000_device::idle, &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::eint, &tms7000_device::dint, &tms7000_device::setc,
- &tms7000_device::pop_st, &tms7000_device::stsp, &tms7000_device::rets, &tms7000_device::reti, &tms7000_device::illegal, &tms7000_device::ldsp, &tms7000_device::push_st, &tms7000_device::illegal,
-
-/* 0x1X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_r2a, &tms7000_device::and_r2a, &tms7000_device::or_r2a, &tms7000_device::xor_r2a, &tms7000_device::btjo_r2a,&tms7000_device::btjz_r2a,
- &tms7000_device::add_r2a, &tms7000_device::adc_r2a, &tms7000_device::sub_ra, &tms7000_device::sbb_ra, &tms7000_device::mpy_ra, &tms7000_device::cmp_ra, &tms7000_device::dac_r2a, &tms7000_device::dsb_r2a,
-
-/* 0x2X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_i2a, &tms7000_device::and_i2a, &tms7000_device::or_i2a, &tms7000_device::xor_i2a, &tms7000_device::btjo_i2a,&tms7000_device::btjz_i2a,
- &tms7000_device::add_i2a, &tms7000_device::adc_i2a, &tms7000_device::sub_ia, &tms7000_device::sbb_ia, &tms7000_device::mpy_ia, &tms7000_device::cmp_ia, &tms7000_device::dac_i2a, &tms7000_device::dsb_i2a,
-
-/* 0x3X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_r2b, &tms7000_device::and_r2b, &tms7000_device::or_r2b, &tms7000_device::xor_r2b, &tms7000_device::btjo_r2b,&tms7000_device::btjz_r2b,
- &tms7000_device::add_r2b, &tms7000_device::adc_r2b, &tms7000_device::sub_rb, &tms7000_device::sbb_rb, &tms7000_device::mpy_rb, &tms7000_device::cmp_rb, &tms7000_device::dac_r2b, &tms7000_device::dsb_r2b,
-
-/* 0x4X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_r2r, &tms7000_device::and_r2r, &tms7000_device::or_r2r, &tms7000_device::xor_r2r, &tms7000_device::btjo_r2r,&tms7000_device::btjz_r2r,
- &tms7000_device::add_r2r, &tms7000_device::adc_r2r, &tms7000_device::sub_rr, &tms7000_device::sbb_rr, &tms7000_device::mpy_rr, &tms7000_device::cmp_rr, &tms7000_device::dac_r2r, &tms7000_device::dsb_r2r,
-
-/* 0x5X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_i2b, &tms7000_device::and_i2b, &tms7000_device::or_i2b, &tms7000_device::xor_i2b, &tms7000_device::btjo_i2b,&tms7000_device::btjz_i2b,
- &tms7000_device::add_i2b, &tms7000_device::adc_i2b, &tms7000_device::sub_ib, &tms7000_device::sbb_ib, &tms7000_device::mpy_ib, &tms7000_device::cmp_ib, &tms7000_device::dac_i2b, &tms7000_device::dsb_i2b,
-
-/* 0x6X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_b2a, &tms7000_device::and_b2a, &tms7000_device::or_b2a, &tms7000_device::xor_b2a, &tms7000_device::btjo_b2a,&tms7000_device::btjz_b2a,
- &tms7000_device::add_b2a, &tms7000_device::adc_b2a, &tms7000_device::sub_ba, &tms7000_device::sbb_ba, &tms7000_device::mpy_ba, &tms7000_device::cmp_ba, &tms7000_device::dac_b2a, &tms7000_device::dsb_b2a,
-
-/* 0x7X */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::mov_i2r, &tms7000_device::and_i2r, &tms7000_device::or_i2r, &tms7000_device::xor_i2r, &tms7000_device::btjo_i2r,&tms7000_device::btjz_i2r,
- &tms7000_device::add_i2r, &tms7000_device::adc_i2r, &tms7000_device::sub_ir, &tms7000_device::sbb_ir, &tms7000_device::mpy_ir, &tms7000_device::cmp_ir, &tms7000_device::dac_i2r, &tms7000_device::dsb_i2r,
-
-/* 0x8X */ &tms7000_device::movp_p2a,&tms7000_device::illegal, &tms7000_device::movp_a2p,&tms7000_device::andp_a2p,&tms7000_device::orp_a2p, &tms7000_device::xorp_a2p,&tms7000_device::btjop_ap,&tms7000_device::btjzp_ap,
- &tms7000_device::movd_imm,&tms7000_device::illegal, &tms7000_device::lda_dir, &tms7000_device::sta_dir, &tms7000_device::br_dir, &tms7000_device::cmpa_dir,&tms7000_device::call_dir,&tms7000_device::illegal,
-
-/* 0x9X */ &tms7000_device::illegal, &tms7000_device::movp_p2b,&tms7000_device::movp_b2p,&tms7000_device::andp_b2p,&tms7000_device::orp_b2p, &tms7000_device::xorp_b2p,&tms7000_device::btjop_bp,&tms7000_device::btjzp_bp,
- &tms7000_device::movd_r, &tms7000_device::illegal, &tms7000_device::lda_ind, &tms7000_device::sta_ind, &tms7000_device::br_ind, &tms7000_device::cmpa_ind,&tms7000_device::call_ind,&tms7000_device::illegal,
-
-/* 0xAX */ &tms7000_device::illegal, &tms7000_device::illegal, &tms7000_device::movp_i2p,&tms7000_device::andp_i2p,&tms7000_device::orp_i2p, &tms7000_device::xorp_i2p,&tms7000_device::btjop_ip,&tms7000_device::btjzp_ip,
- &tms7000_device::movd_inx,&tms7000_device::illegal, &tms7000_device::lda_inx, &tms7000_device::sta_inx, &tms7000_device::br_inx, &tms7000_device::cmpa_inx,&tms7000_device::call_inx,&tms7000_device::illegal,
-
-/* 0xBX */ &tms7000_device::clrc, &tms7000_device::illegal, &tms7000_device::dec_a, &tms7000_device::inc_a, &tms7000_device::inv_a, &tms7000_device::clr_a, &tms7000_device::xchb_a, &tms7000_device::swap_a,
- &tms7000_device::push_a, &tms7000_device::pop_a, &tms7000_device::djnz_a, &tms7000_device::decd_a, &tms7000_device::rr_a, &tms7000_device::rrc_a, &tms7000_device::rl_a, &tms7000_device::rlc_a,
-
-/* 0xCX */ &tms7000_device::mov_a2b, &tms7000_device::tstb, &tms7000_device::dec_b, &tms7000_device::inc_b, &tms7000_device::inv_b, &tms7000_device::clr_b, &tms7000_device::xchb_b, &tms7000_device::swap_b,
- &tms7000_device::push_b, &tms7000_device::pop_b, &tms7000_device::djnz_b, &tms7000_device::decd_b, &tms7000_device::rr_b, &tms7000_device::rrc_b, &tms7000_device::rl_b, &tms7000_device::rlc_b,
-
-/* 0xDX */ &tms7000_device::mov_a2r, &tms7000_device::mov_b2r, &tms7000_device::dec_r, &tms7000_device::inc_r, &tms7000_device::inv_r, &tms7000_device::clr_r, &tms7000_device::xchb_r, &tms7000_device::swap_r_exl,
- &tms7000_device::push_r, &tms7000_device::pop_r, &tms7000_device::djnz_r, &tms7000_device::decd_r, &tms7000_device::rr_r, &tms7000_device::rrc_r, &tms7000_device::rl_r, &tms7000_device::rlc_r,
-
-/* 0xEX */ &tms7000_device::jmp, &tms7000_device::j_jn, &tms7000_device::jeq, &tms7000_device::jc, &tms7000_device::jp, &tms7000_device::jpz, &tms7000_device::jne, &tms7000_device::jl,
- &tms7000_device::trap_23, &tms7000_device::trap_22, &tms7000_device::trap_21, &tms7000_device::trap_20, &tms7000_device::trap_19, &tms7000_device::trap_18, &tms7000_device::trap_17, &tms7000_device::trap_16,
-
-/* 0xFX */ &tms7000_device::trap_15, &tms7000_device::trap_14, &tms7000_device::trap_13, &tms7000_device::trap_12, &tms7000_device::trap_11, &tms7000_device::trap_10, &tms7000_device::trap_9, &tms7000_device::trap_8,
- &tms7000_device::trap_7, &tms7000_device::trap_6, &tms7000_device::trap_5, &tms7000_device::trap_4, &tms7000_device::trap_3, &tms7000_device::trap_2, &tms7000_device::trap_1, &tms7000_device::trap_0
-};
diff --git a/src/mess/drivers/cc40.c b/src/mess/drivers/cc40.c
index def721bba5f..89380a30944 100644
--- a/src/mess/drivers/cc40.c
+++ b/src/mess/drivers/cc40.c
@@ -36,7 +36,7 @@
HM6116LP-4 - Hitachi 2KB SRAM
HN61256PC09 - Hitachi DIP-28 32KB CMOS Mask PROM
- TMX70C20N2L - Texas Instruments TMS70C20 CPU (128 bytes RAM, 2KB ROM) @ 2.5MHz - "X" implies prototype?
+ TMX70C20N2L - Texas Instruments TMS70C20 CPU (128 bytes RAM, 2KB ROM) @ 2.5MHz - "X" implies prototype
AMI 8304BXH - 74-pin QFP AMI Gate Array
HD44100H - 60-pin QFP Hitachi HD44100 LCD Driver
HD44780A00 - 80-pin TFP Hitachi HD44780 LCD Controller
diff --git a/src/mess/drivers/exelv.c b/src/mess/drivers/exelv.c
index b1b3b43318b..6761c49804f 100644
--- a/src/mess/drivers/exelv.c
+++ b/src/mess/drivers/exelv.c
@@ -223,7 +223,7 @@ static DEVICE_IMAGE_UNLOAD( exelv_cart )
READ8_MEMBER(exelv_state::mailbox_wx319_r)
{
- logerror("[TMS7220] reading mailbox %d", m_wx319);
+ logerror("[TMS7220] reading mailbox %d\n", m_wx319);
return m_wx319;
}
@@ -325,7 +325,7 @@ WRITE8_MEMBER(exelv_state::tms7041_portb_w)
m_tms5220c->rsq_w((data & 0x02) ? 1 : 0);
logerror("TMS7020 %s int1\n",((data & 0x04) ? "clear" : "assert"));
- m_maincpu->set_input_line(TMS7000_IRQ1_LINE, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
+ m_maincpu->set_input_line(TMS7000_INT1_LINE, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
/* Check for low->high transition on B6 */
if (!(m_tms7041_portb & 0x40) && (data & 0x40))
@@ -434,11 +434,6 @@ static ADDRESS_MAP_START(tms7020_port, AS_IO, 8, exelv_state)
AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7020_portb_w)
ADDRESS_MAP_END
-
-static ADDRESS_MAP_START(tms7041_map, AS_PROGRAM, 8, exelv_state)
- AM_RANGE(0x0080, 0x00ff) AM_RAM
-ADDRESS_MAP_END
-
static ADDRESS_MAP_START(tms7041_port, AS_IO, 8, exelv_state)
AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(tms7041_porta_r)
AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7041_portb_w)
@@ -462,11 +457,6 @@ static ADDRESS_MAP_START(tms7040_mem, AS_PROGRAM, 8, exelv_state)
ADDRESS_MAP_END
-static ADDRESS_MAP_START(tms7042_map, AS_PROGRAM, 8, exelv_state)
- AM_RANGE(0x0080, 0x00ff) AM_RAM
-ADDRESS_MAP_END
-
-
/* keyboard: ??? */
static INPUT_PORTS_START(exelv)
@@ -515,8 +505,7 @@ static MACHINE_CONFIG_START( exl100, exelv_state )
MCFG_CPU_IO_MAP(tms7020_port)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1)
- MCFG_CPU_ADD("tms7041", TMS7040, XTAL_4_9152MHz) // should be TMS7041
- MCFG_CPU_PROGRAM_MAP(tms7041_map)
+ MCFG_CPU_ADD("tms7041", TMS7041, XTAL_4_9152MHz)
MCFG_CPU_IO_MAP(tms7041_port)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
@@ -567,8 +556,7 @@ static MACHINE_CONFIG_START( exeltel, exelv_state )
MCFG_CPU_IO_MAP(tms7020_port)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1)
- MCFG_CPU_ADD("tms7042", TMS7040, XTAL_4_9152MHz) // should be TMS7042
- MCFG_CPU_PROGRAM_MAP(tms7042_map)
+ MCFG_CPU_ADD("tms7042", TMS7042, XTAL_4_9152MHz)
MCFG_CPU_IO_MAP(tms7041_port)
MCFG_QUANTUM_PERFECT_CPU("maincpu")