summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tlcs870/tlcs870.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/tlcs870/tlcs870.h')
-rw-r--r--src/devices/cpu/tlcs870/tlcs870.h91
1 files changed, 72 insertions, 19 deletions
diff --git a/src/devices/cpu/tlcs870/tlcs870.h b/src/devices/cpu/tlcs870/tlcs870.h
index 8b3c9d83bd3..846cf818961 100644
--- a/src/devices/cpu/tlcs870/tlcs870.h
+++ b/src/devices/cpu/tlcs870/tlcs870.h
@@ -7,6 +7,25 @@
class tlcs870_device : public cpu_device
{
+public:
+ auto p0_in_cb() { return m_port_in_cb[0].bind(); }
+ auto p1_in_cb() { return m_port_in_cb[1].bind(); }
+ auto p2_in_cb() { return m_port_in_cb[2].bind(); }
+ auto p3_in_cb() { return m_port_in_cb[3].bind(); }
+ auto p4_in_cb() { return m_port_in_cb[4].bind(); }
+ auto p5_in_cb() { return m_port_in_cb[5].bind(); }
+ auto p6_in_cb() { return m_port_in_cb[6].bind(); }
+ auto p7_in_cb() { return m_port_in_cb[7].bind(); }
+
+ auto p0_out_cb() { return m_port_out_cb[0].bind(); }
+ auto p1_out_cb() { return m_port_out_cb[1].bind(); }
+ auto p2_out_cb() { return m_port_out_cb[2].bind(); }
+ auto p3_out_cb() { return m_port_out_cb[3].bind(); }
+ auto p4_out_cb() { return m_port_out_cb[4].bind(); }
+ auto p5_out_cb() { return m_port_out_cb[5].bind(); }
+ auto p6_out_cb() { return m_port_out_cb[6].bind(); }
+ auto p7_out_cb() { return m_port_out_cb[7].bind(); }
+
protected:
// construction/destruction
tlcs870_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program_map);
@@ -110,6 +129,35 @@ private:
address_space *m_io;
int m_icount;
+ devcb_read8 m_port_in_cb[8];
+ devcb_write8 m_port_out_cb[8];
+ uint8_t m_port_out_latch[8];
+ int m_read_input_port;
+ uint8_t m_port0_cr, m_port1_cr, m_port6_cr, m_port7_cr;
+
+ DECLARE_READ8_MEMBER(port0_r);
+ DECLARE_READ8_MEMBER(port1_r);
+ DECLARE_READ8_MEMBER(port2_r);
+ DECLARE_READ8_MEMBER(port3_r);
+ DECLARE_READ8_MEMBER(port4_r);
+ DECLARE_READ8_MEMBER(port5_r);
+ DECLARE_READ8_MEMBER(port6_r);
+ DECLARE_READ8_MEMBER(port7_r);
+
+ DECLARE_WRITE8_MEMBER(port0_w);
+ DECLARE_WRITE8_MEMBER(port1_w);
+ DECLARE_WRITE8_MEMBER(port2_w);
+ DECLARE_WRITE8_MEMBER(port3_w);
+ DECLARE_WRITE8_MEMBER(port4_w);
+ DECLARE_WRITE8_MEMBER(port5_w);
+ DECLARE_WRITE8_MEMBER(port6_w);
+ DECLARE_WRITE8_MEMBER(port7_w);
+
+ DECLARE_WRITE8_MEMBER(p0cr_w);
+ DECLARE_WRITE8_MEMBER(p1cr_w);
+ DECLARE_WRITE8_MEMBER(p6cr_w);
+ DECLARE_WRITE8_MEMBER(p7cr_w);
+
// Work registers
uint8_t m_cycles;
uint16_t m_tmppc;
@@ -162,6 +210,8 @@ private:
int is_CF() const { return ((m_F & FLAG_C) ? 1 : 0); }
int is_HF() const { return ((m_F & FLAG_H) ? 1 : 0); }
+ int get_base_srcdst_cycles(int i) const { const int SRC_DST_CYCLES[8] = { 1, 2, 0, 0, 2, 2, 1, 1 }; return SRC_DST_CYCLES[i]; }
+
bool stream_arg(std::ostream &stream, uint32_t pc, const char *pre, const uint16_t mode, const uint16_t r, const uint16_t rb);
// tlcs870_ops.cpp
@@ -232,12 +282,7 @@ private:
// tlcs870_ops_src.cpp
- void do_e0_opcode(const uint8_t opbyte0);
- void do_e1_to_e3_opcode(const uint8_t opbyte0);
- void do_e4_opcode(const uint8_t opbyte0);
- void do_e5_to_e7_opcode(const uint8_t opbyte0);
-
- void do_e0_to_e7_opcode(uint8_t opbyte0, uint16_t srcaddr);
+ void do_srcprefixtype_opcode(const uint8_t opbyte0);
void do_e0_to_e7_oprand_illegal(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr);
@@ -263,16 +308,8 @@ private:
void do_CALL_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr);
void do_JP_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr);
- uint16_t do_alu(int op, uint16_t param1, uint16_t param2);
-
// tlcs870_ops_dst.cpp
-
- void do_f0_opcode(const uint8_t opbyte0);
- void do_f2_to_f3_opcode(const uint8_t opbyte0);
- void do_f4_opcode(const uint8_t opbyte0);
- void do_f6_to_f7_opcode(const uint8_t opbyte0);
-
- void do_f0_to_f7_opcode(const uint8_t opbyte0, const uint16_t dstaddr);
+ void do_dstprefixtype_opcode(const uint8_t opbyte0);
void do_f0_to_f7_oprand_illegal_opcode(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t dstaddr);
@@ -310,9 +347,9 @@ private:
void do_ALUOP_g_n(const uint8_t opbyte0, const uint8_t opbyte1);
void do_SET_inppbit(const uint8_t opbyte0, const uint8_t opbyte1);
void do_CLR_inppbit(const uint8_t opbyte0, const uint8_t opbyte1);
- void do_CPL_inppbit(const uint8_t opbyte0, const uint8_t opbyte1);
- void do_LD_inppbit_CF(const uint8_t opbyte0, const uint8_t opbyte1);
- void do_LD_CF_inppbit(const uint8_t opbyte0, const uint8_t opbyte1);
+ void do_CPL_inpp_indirectbit(const uint8_t opbyte0, const uint8_t opbyte1);
+ void do_LD_inpp_indirectbit_CF(const uint8_t opbyte0, const uint8_t opbyte1);
+ void do_LD_CF_inpp_indirectbit(const uint8_t opbyte0, const uint8_t opbyte1);
void do_XCH_r_g(const uint8_t opbyte0, const uint8_t opbyte1);
void do_CPL_gbit(const uint8_t opbyte0, const uint8_t opbyte1);
void do_LD_gbit_CF(const uint8_t opbyte0, const uint8_t opbyte1);
@@ -323,10 +360,26 @@ private:
void do_CALL_gg(const uint8_t opbyte0, const uint8_t opbyte1);
void do_JP_gg(const uint8_t opbyte0, const uint8_t opbyte1);
+
+ // ALU related
+ uint16_t do_or(uint16_t param1, uint16_t param2);
+ uint16_t do_xor(uint16_t param1, uint16_t param2);
+ uint16_t do_and(uint16_t param1, uint16_t param2);
+
+ uint8_t do_add_8bit(uint16_t param1, uint16_t param2);
+ uint8_t do_sub_8bit(uint16_t param1, uint16_t param2);
+ void do_cmp_8bit(uint16_t param1, uint16_t param2);
+ uint8_t do_alu_8bit(int op, uint16_t param1, uint16_t param2);
+
+ uint8_t do_add_16bit(uint32_t param1, uint32_t param2);
+ uint8_t do_sub_16bit(uint32_t param1, uint32_t param2);
+ void do_cmp_16bit(uint32_t param1, uint32_t param2);
+ uint16_t do_alu_16bit(int op, uint32_t param1, uint32_t param2);
+
+ // Generic opcode helpers
void handle_div(const int reg);
void handle_mul(const int reg);
void handle_swap(const int reg);
-
uint8_t handle_SHLC(uint8_t val);
uint8_t handle_SHRC(uint8_t val);
uint8_t handle_DAS(uint8_t val);