Previous 199869 Revisions Next

r36288 Friday 6th March, 2015 at 16:47:07 UTC by hap
added i/o opcodes
[src/emu/cpu/hmcs40]hmcs40.c hmcs40.h hmcs40op.inc

trunk/src/emu/cpu/hmcs40/hmcs40.c
r244799r244800
1010
1111*/
1212
13enum
14{
15   FAMILY_HMCS42 = 0,
16   FAMILY_HMCS43,
17   FAMILY_HMCS44,
18   FAMILY_HMCS45,
19   FAMILY_HMCS46,
20   FAMILY_HMCS47,
21};
22
23#define IS_CMOS true
24#define IS_PMOS false
25
1326#include "hmcs40.h"
1427#include "debugger.h"
1528
r244799r244800
7588
7689
7790// device definitions
91hmcs43_cpu_device::hmcs43_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname)
92   : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS43, is_cmos, 3, 12, ADDRESS_MAP_NAME(program_1k), 7, ADDRESS_MAP_NAME(data_80x4), shortname, __FILE__)
93{ }
94
7895hd38750_device::hd38750_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
79   : hmcs40_cpu_device(mconfig, HD38750, "HD38750", tag, owner, clock, 3, 12, ADDRESS_MAP_NAME(program_1k), 7, ADDRESS_MAP_NAME(data_80x4), "hd38750", __FILE__)
96   : hmcs43_cpu_device(mconfig, HD38750, "HD38750", tag, owner, clock, IS_PMOS, "hd38750")
8097{ }
8198
99
100hmcs44_cpu_device::hmcs44_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname)
101   : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS44, is_cmos, 4, 13, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__)
102{ }
103
82104hd38800_device::hd38800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
83   : hmcs40_cpu_device(mconfig, HD38800, "HD38800", tag, owner, clock, 4, 13, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), "hd38800", __FILE__)
105   : hmcs44_cpu_device(mconfig, HD38800, "HD38800", tag, owner, clock, IS_PMOS, "hd38800")
84106{ }
85107
108
109hmcs45_cpu_device::hmcs45_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname)
110   : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS45, is_cmos, 4, 13, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__)
111{ }
112
86113hd38820_device::hd38820_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
87   : hmcs40_cpu_device(mconfig, HD38820, "HD38820", tag, owner, clock, 4, 13, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), "hd38820", __FILE__)
114   : hmcs45_cpu_device(mconfig, HD38820, "HD38820", tag, owner, clock, IS_PMOS, "hd38820")
88115{ }
89116
90117
r244799r244800
101128         break;
102129
103130      case STATE_GENPC:
104         string.printf("%03X", m_pc << 1);
131         string.printf("%04X", m_pc << 1);
105132         break;
106133
107134      default: break;
r244799r244800
132159   m_data = &space(AS_DATA);
133160   m_prgmask = (1 << m_prgwidth) - 1;
134161   m_datamask = (1 << m_datawidth) - 1;
135   m_xmask = (1 << (m_datawidth - 4)) - 1;
162   
163   UINT8 defval = (m_is_cmos) ? 0xf : 0;
164   m_read_r0.resolve_safe(defval);
165   m_read_r1.resolve_safe(defval);
166   m_read_r2.resolve_safe(defval);
167   m_read_r3.resolve_safe(defval);
168   m_read_r4.resolve_safe(defval);
169   m_read_r5.resolve_safe(defval);
170   m_read_r6.resolve_safe(defval);
171   m_read_r7.resolve_safe(defval);
172   
173   m_write_r0.resolve_safe();
174   m_write_r1.resolve_safe();
175   m_write_r2.resolve_safe();
176   m_write_r3.resolve_safe();
177   m_write_r4.resolve_safe();
178   m_write_r5.resolve_safe();
179   m_write_r6.resolve_safe();
180   m_write_r7.resolve_safe();
136181
137   m_read_d.resolve_safe(0);
182   m_read_d.resolve_safe((m_is_cmos) ? 0xffff : 0);
138183   m_write_d.resolve_safe();
139184
140185   // zerofill
141186   memset(m_stack, 0, sizeof(m_stack));
142187   m_op = 0;
143188   m_prev_op = 0;
144   m_arg = 0;
145189   m_pc = 0;
190   m_prev_pc = 0;
146191   m_page = 0;
147192   m_a = 0;
148193   m_b = 0;
r244799r244800
150195   m_spx = 0;
151196   m_y = 0;
152197   m_spy = 0;
153   m_s = 0;
198   m_s = 1;
154199   m_c = 0;
200   memset(m_r, 0, sizeof(m_r));
201   m_d = 0;
155202
156203   // register for savestates
157204   save_item(NAME(m_stack));
158205   save_item(NAME(m_op));
159206   save_item(NAME(m_prev_op));
160   save_item(NAME(m_arg));
161207   save_item(NAME(m_pc));
208   save_item(NAME(m_prev_pc));
162209   save_item(NAME(m_page));
163210   save_item(NAME(m_a));
164211   save_item(NAME(m_b));
r244799r244800
168215   save_item(NAME(m_spy));
169216   save_item(NAME(m_s));
170217   save_item(NAME(m_c));
218   save_item(NAME(m_r));
219   save_item(NAME(m_d));
171220
172221   // register state for debugger
173222   state_add(HMCS40_PC,  "PC",  m_pc).formatstr("%04X");
r244799r244800
178227   state_add(HMCS40_Y,   "Y",   m_y).formatstr("%01X");
179228   state_add(HMCS40_SPY, "SPY", m_spy).formatstr("%01X");
180229
181   state_add(STATE_GENPC, "curpc", m_pc).formatstr("%03X").noshow();
230   state_add(STATE_GENPC, "curpc", m_pc).formatstr("%04X").noshow();
182231   state_add(STATE_GENFLAGS, "GENFLAGS", m_s).formatstr("%2s").noshow();
183232
184233   m_icountptr = &m_icount;
r244799r244800
192241
193242void hmcs40_cpu_device::device_reset()
194243{
195   m_pc = 0xffff & m_prgmask;
196   m_op = 0;
244   m_pc = m_prgmask;
245   m_prev_op = m_op = 0;
246   
247   // clear i/o
248   m_d = (m_is_cmos) ? 0xffff : 0;
249   for (int i = 0; i < 16; i++)
250      hmcs40_cpu_device::write_d(i, (m_is_cmos) ? 1 : 0);
251   
252   for (int i = 0; i < 8; i++)
253      hmcs40_cpu_device::write_r(i, (m_is_cmos) ? 0xf : 0);
197254}
198255
199256
r244799r244800
217274   m_pc = (m_pc & ~mask) | ((m_pc << 1 | fb) & mask);
218275}
219276
220inline void hmcs40_cpu_device::fetch_arg()
221{
222   // P is the only 2-byte opcode
223   if ((m_op & 0x3f8) == 0x368)
224   {
225      m_icount--;
226      m_arg = m_program->read_word(m_pc << 1);
227      increment_pc();
228   }
229}
230
231277void hmcs40_cpu_device::execute_run()
232278{
233279   while (m_icount > 0)
r244799r244800
238284      if ((m_prev_op & 0x3e0) == 0x340)
239285         m_pc = ((m_page << 6) | (m_pc & 0x3f)) & m_prgmask;
240286
241      // remember previous opcode
287      // remember previous state
242288      m_prev_op = m_op;
289      m_prev_pc = m_pc;
243290     
244291      // fetch next opcode
245292      debugger_instruction_hook(this, m_pc << 1);
246293      m_op = m_program->read_word(m_pc << 1);
247294      increment_pc();
248      fetch_arg();
249295   }
250296}
trunk/src/emu/cpu/hmcs40/hmcs40.h
r244799r244800
1313
1414
1515// I/O ports setup
16
17// max 8 4-bit R ports
18#define MCFG_HMCS40_READ_R_CB(_r, _devcb) \
19   hmcs40_cpu_device::set_read_r##_r_callback(*device, DEVCB_##_devcb);
20#define MCFG_HMCS40_WRITE_R_CB(_r, _devcb) \
21   hmcs40_cpu_device::set_write_r##_r_callback(*device, DEVCB_##_devcb);
22
23// 16-bit discrete
1624#define MCFG_HMCS40_READ_A_CB(_devcb) \
1725   hmcs40_cpu_device::set_read_d_callback(*device, DEVCB_##_devcb);
1826#define MCFG_HMCS40_WRITE_D_CB(_devcb) \
r244799r244800
2432{
2533public:
2634   // construction/destruction
27   hmcs40_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
35   hmcs40_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int family, bool is_cmos, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
2836      : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
2937      , m_program_config("program", ENDIANNESS_LITTLE, 16, prgwidth, 0, program)
3038      , m_data_config("data", ENDIANNESS_LITTLE, 8, datawidth, 0, data)
3139      , m_prgwidth(prgwidth-1)
3240      , m_datawidth(datawidth)
41      , m_family(family)
42      , m_is_cmos(is_cmos)
3343      , m_stack_levels(stack_levels)
44      , m_read_r0(*this), m_read_r1(*this), m_read_r2(*this), m_read_r3(*this), m_read_r4(*this), m_read_r5(*this), m_read_r6(*this), m_read_r7(*this)
45      , m_write_r0(*this), m_write_r1(*this), m_write_r2(*this), m_write_r3(*this), m_write_r4(*this), m_write_r5(*this), m_write_r6(*this), m_write_r7(*this)
3446      , m_read_d(*this)
3547      , m_write_d(*this)
3648   { }
3749
3850   // static configuration helpers
51   template<class _Object> static devcb_base &set_read_r0_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r0.set_callback(object); }
52   template<class _Object> static devcb_base &set_read_r1_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r1.set_callback(object); }
53   template<class _Object> static devcb_base &set_read_r2_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r2.set_callback(object); }
54   template<class _Object> static devcb_base &set_read_r3_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r3.set_callback(object); }
55   template<class _Object> static devcb_base &set_read_r4_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r4.set_callback(object); }
56   template<class _Object> static devcb_base &set_read_r5_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r5.set_callback(object); }
57   template<class _Object> static devcb_base &set_read_r6_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r6.set_callback(object); }
58   template<class _Object> static devcb_base &set_read_r7_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_r7.set_callback(object); }
59
60   template<class _Object> static devcb_base &set_write_r0_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r0.set_callback(object); }
61   template<class _Object> static devcb_base &set_write_r1_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r1.set_callback(object); }
62   template<class _Object> static devcb_base &set_write_r2_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r2.set_callback(object); }
63   template<class _Object> static devcb_base &set_write_r3_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r3.set_callback(object); }
64   template<class _Object> static devcb_base &set_write_r4_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r4.set_callback(object); }
65   template<class _Object> static devcb_base &set_write_r5_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r5.set_callback(object); }
66   template<class _Object> static devcb_base &set_write_r6_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r6.set_callback(object); }
67   template<class _Object> static devcb_base &set_write_r7_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_r7.set_callback(object); }
68
3969   template<class _Object> static devcb_base &set_read_d_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_read_d.set_callback(object); }
4070   template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<hmcs40_cpu_device &>(device).m_write_d.set_callback(object); }
4171
r244799r244800
5484   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return(spacenum == AS_PROGRAM) ? &m_program_config :((spacenum == AS_DATA) ? &m_data_config : NULL); }
5585
5686   // device_disasm_interface overrides
57   virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
87   virtual UINT32 disasm_min_opcode_bytes() const { return 2; }
5888   virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
5989   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
6090   void state_string_export(const device_state_entry &entry, astring &string);
r244799r244800
6898   int m_datawidth;
6999   int m_prgmask;
70100   int m_datamask;
71   int m_xmask;
101   int m_family;       // MCU family (42-47)
102   bool m_is_cmos;
72103   int m_stack_levels; // number of callstack levels
73104   UINT16 m_stack[4];  // max 4
74   UINT16 m_op;
105   UINT16 m_op;        // current opcode
75106   UINT16 m_prev_op;
76   UINT16 m_arg;
77107   int m_icount;
78108   
79109   UINT16 m_pc;        // Program Counter
110   UINT16 m_prev_pc;
80111   UINT8 m_page;       // LPU prepared page
81112   UINT8 m_a;          // 4-bit Accumulator
82113   UINT8 m_b;          // 4-bit B register
r244799r244800
86117   UINT8 m_spy;        // 4-bit SPY register
87118   UINT8 m_s;          // Status F/F
88119   UINT8 m_c;          // Carry F/F
120   UINT8 m_r[8];       // R outputs state
121   UINT16 m_d;         // D pins state
89122
90123   // i/o handlers
124   devcb_read8 m_read_r0, m_read_r1, m_read_r2, m_read_r3, m_read_r4, m_read_r5, m_read_r6, m_read_r7;
125   devcb_write8 m_write_r0, m_write_r1, m_write_r2, m_write_r3, m_write_r4, m_write_r5, m_write_r6, m_write_r7;
91126   devcb_read16 m_read_d;
92127   devcb_write16 m_write_d;
93128
94129   // misc internal helpers
95130   void increment_pc();
96   void fetch_arg();
97
131   
98132   UINT8 ram_r();
99133   void ram_w(UINT8 data);
100134   void pop_stack();
101135   void push_stack();
102136
137   virtual UINT8 read_r(int index);
138   virtual void write_r(int index, UINT8 data);
139   virtual int read_d(int index);
140   virtual void write_d(int index, int state);
141
103142   // opcode handlers
104143   void op_lab();
105144   void op_lba();
r244799r244800
202241};
203242
204243
205class hd38750_device : public hmcs40_cpu_device
244class hmcs43_cpu_device : public hmcs40_cpu_device
206245{
207246public:
247   hmcs43_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname);
248
249protected:
250   // overrides
251   virtual UINT8 read_r(int index);
252   virtual void write_r(int index, UINT8 data);
253   virtual int read_d(int index);
254};
255
256class hd38750_device : public hmcs43_cpu_device
257{
258public:
208259   hd38750_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
209260};
210261
211262
212class hd38800_device : public hmcs40_cpu_device
263class hmcs44_cpu_device : public hmcs40_cpu_device
213264{
214265public:
266   hmcs44_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname);
267
268protected:
269   // overrides
270   virtual UINT8 read_r(int index);
271   virtual void write_r(int index, UINT8 data);
272};
273
274class hd38800_device : public hmcs44_cpu_device
275{
276public:
215277   hd38800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
216278};
217279
218280
219class hd38820_device : public hmcs40_cpu_device
281class hmcs45_cpu_device : public hmcs40_cpu_device
220282{
221283public:
284   hmcs45_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname);
285
286protected:
287   // overrides
288   virtual UINT8 read_r(int index);
289   virtual void write_r(int index, UINT8 data);
290};
291
292class hd38820_device : public hmcs45_cpu_device
293{
294public:
222295   hd38820_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
223296};
224297
trunk/src/emu/cpu/hmcs40/hmcs40op.inc
r244799r244800
2828   m_stack[0] = m_pc;
2929}
3030
31void hmcs40_cpu_device::op_illegal()
31
32// i/o
33
34UINT8 hmcs40_cpu_device::read_r(int index)
3235{
33   logerror("%s unknown opcode $%03X at $%04X\n", tag(), m_op, m_pc);
36   index &= 7;
37   UINT8 inp = 0xf;
38   
39   switch (index)
40   {
41      case 0: inp = m_read_r0(index, 0xff); break;
42      case 1: inp = m_read_r1(index, 0xff); break;
43      case 2: inp = m_read_r2(index, 0xff); break;
44      case 3: inp = m_read_r3(index, 0xff); break;
45      case 4: inp = m_read_r4(index, 0xff); break;
46      case 5: inp = m_read_r5(index, 0xff); break;
47      case 6: inp = m_read_r6(index, 0xff); break;
48      case 7: inp = m_read_r7(index, 0xff); break;
49   }
50   
51   if (m_is_cmos)
52      return inp & m_r[index];
53   else
54      return inp | m_r[index];
3455}
3556
57void hmcs40_cpu_device::write_r(int index, UINT8 data)
58{
59   index &= 7;
60   m_r[index] = data & 0xf;
61   
62   switch (index)
63   {
64      case 0: m_write_r0(index, m_r[index], 0xff); break;
65      case 1: m_write_r1(index, m_r[index], 0xff); break;
66      case 2: m_write_r2(index, m_r[index], 0xff); break;
67      case 3: m_write_r3(index, m_r[index], 0xff); break;
68      case 4: m_write_r4(index, m_r[index], 0xff); break;
69      case 5: m_write_r5(index, m_r[index], 0xff); break;
70      case 6: m_write_r6(index, m_r[index], 0xff); break;
71      case 7: m_write_r7(index, m_r[index], 0xff); break;
72   }
73}
3674
75int hmcs40_cpu_device::read_d(int index)
76{
77   index &= 15;
78   
79   if (m_is_cmos)
80      return (m_read_d(index, 0xffff) & m_d) >> index & 1;
81   else
82      return (m_read_d(index, 0xffff) | m_d) >> index & 1;
83}
3784
85void hmcs40_cpu_device::write_d(int index, int state)
86{
87   index &= 15;
88   
89   m_d = (m_d & ~(1 << index)) | (state << index);
90   m_write_d(index, m_d, 0xffff);
91}
92
93// HMCS43:
94// R0 is input-only, R1 is i/o, R2,R3 are output-only, no R4-R7
95// D0-D3 are i/o, D4-D15 are output-only
96
97UINT8 hmcs43_cpu_device::read_r(int index)
98{
99   if ((index & 7) >= 4)
100      logerror("%s read from unknown port R%d at $%04X\n", tag(), index & 7, m_prev_pc << 1);
101   
102   return hmcs40_cpu_device::read_r(index);
103}
104
105void hmcs43_cpu_device::write_r(int index, UINT8 data)
106{
107   index &= 7;
108
109   if (index != 0 && index < 4)
110      hmcs40_cpu_device::write_r(index, data);
111   else
112      logerror("%s ineffective write to port R%d = $%X at $%04X\n", tag(), index, data & 0xf, m_prev_pc << 1);
113}
114
115int hmcs43_cpu_device::read_d(int index)
116{
117   if ((index & 15) >= 4)
118      return m_d >> index & 1;
119   else
120      return hmcs40_cpu_device::read_d(index);
121}
122
123// HMCS44:
124// R0-R3 are i/o, R4,R5 are extra registers, no R6,R7
125// D0-D15 are i/o
126
127UINT8 hmcs44_cpu_device::read_r(int index)
128{
129   if ((index & 7) >= 6)
130      logerror("%s read from unknown port R%d at $%04X\n", tag(), index & 7, m_prev_pc << 1);
131   
132   return hmcs40_cpu_device::read_r(index);
133}
134
135void hmcs44_cpu_device::write_r(int index, UINT8 data)
136{
137   index &= 7;
138
139   if (index < 6)
140      hmcs40_cpu_device::write_r(index, data);
141   else
142      logerror("%s ineffective write to port R%d = $%X at $%04X\n", tag(), index, data & 0xf, m_prev_pc << 1);
143}
144
145// HMCS45:
146// R0-R5 are i/o, R6 is output-only, no R7
147// D0-D15 are i/o
148
149UINT8 hmcs45_cpu_device::read_r(int index)
150{
151   if ((index & 7) == 7)
152      logerror("%s read from unknown port R%d at $%04X\n", tag(), index & 7, m_prev_pc << 1);
153   
154   return hmcs40_cpu_device::read_r(index);
155}
156
157void hmcs45_cpu_device::write_r(int index, UINT8 data)
158{
159   index &= 7;
160
161   if (index != 7)
162      hmcs40_cpu_device::write_r(index, data);
163   else
164      logerror("%s ineffective write to port R%d = $%X at $%04X\n", tag(), index, data & 0xf, m_prev_pc << 1);
165}
166
167
168
169
170
38171// instruction set
39172
40173// Register-to-Register Instruction
r244799r244800
461594void hmcs40_cpu_device::op_tbr()
462595{
463596   // TBR p: Table Branch
464   m_pc = (m_a | m_b << 4 | m_c << 8 | ((m_op & 7) << 9)) & m_prgmask;
597   m_pc = (m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9) & m_prgmask;
465598}
466599
467600void hmcs40_cpu_device::op_rtn()
r244799r244800
593726void hmcs40_cpu_device::op_sed()
594727{
595728   // SED: Set Discrete I/O Latch
596   op_illegal();
729   write_d(m_y, 1);
597730}
598731
599732void hmcs40_cpu_device::op_red()
600733{
601734   // RED: Reset Discrete I/O Latch
602   op_illegal();
735   write_d(m_y, 0);
603736}
604737
605738void hmcs40_cpu_device::op_td()
606739{
607740   // TD: Test Discrete I/O Latch
608   op_illegal();
741   m_s = read_d(m_y);
609742}
610743
611744void hmcs40_cpu_device::op_sedd()
612745{
613746   // SEDD n: Set Discrete I/O Latch Direct
614   op_illegal();
747   write_d(m_op & 0xf, 1);
615748}
616749
617750void hmcs40_cpu_device::op_redd()
618751{
619752   // REDD n: Reset Discrete I/O Latch Direct
620   op_illegal();
753   write_d(m_op & 0xf, 0);
621754}
622755
623756void hmcs40_cpu_device::op_lar()
624757{
625758   // LAR p: Load A from R-Port Register
626   op_illegal();
759   m_a = read_r(m_op & 7);
627760}
628761
629762void hmcs40_cpu_device::op_lbr()
630763{
631764   // LBR p: Load B from R-Port Register
632   op_illegal();
765   m_b = read_r(m_op & 7);
633766}
634767
635768void hmcs40_cpu_device::op_lra()
636769{
637770   // LRA p: Load R-Port Register from A
638   op_illegal();
771   write_r(m_op & 7, m_a);
639772}
640773
641774void hmcs40_cpu_device::op_lrb()
642775{
643776   // LRB p: Load R-Port Register from B
644   op_illegal();
777   write_r(m_op & 7, m_b);
645778}
646779
647780void hmcs40_cpu_device::op_p()
648781{
649782   // P p: Pattern Generation
650   op_illegal();
783   m_icount--;
784   UINT16 address = (m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9) | (m_pc & ~0x3f);
785   UINT16 o = m_program->read_word(address << 1);
786   
787   // destination is determined by the 2 highest bits
788   if (o & 0x100)
789   {
790      m_a = o & 0xf;
791      m_b = o >> 4 & 0xf;
792   }
793   if (o & 0x200)
794   {
795      write_r(2, o >> 4 & 0xf);
796      write_r(3, o & 0xf);
797   }
651798}
652799
653800
r244799r244800
657804{
658805   // NOP: No Operation
659806}
807
808
809void hmcs40_cpu_device::op_illegal()
810{
811   logerror("%s unknown opcode $%03X at $%04X\n", tag(), m_op, m_prev_pc << 1);
812}


Previous 199869 Revisions Next


© 1997-2024 The MAME Team