Previous 199869 Revisions Next

r36273 Thursday 5th March, 2015 at 21:54:49 UTC by hap
added the rest of straightforward opcodes
[src/emu/cpu/hmcs40]hmcs40.c hmcs40op.inc

trunk/src/emu/cpu/hmcs40/hmcs40.c
r244784r244785
44
55  Hitachi HMCS40 MCU family cores
66
7  References:
8  - 1985 #AP1 Hitachi 4-bit Single-Chip Microcomputer Data Book
9  - 1988 HMCS400 Series Handbook (note: *400 is a newer MCU series, with similarities)
10
711*/
812
913#include "hmcs40.h"
trunk/src/emu/cpu/hmcs40/hmcs40op.inc
r244784r244785
242242void hmcs40_cpu_device::op_ai()
243243{
244244   // AI i: Add Immediate to A
245   op_illegal();
245   m_a += (m_op & 0xf);
246   m_s = m_a >> 4 & 1;
247   m_a &= 0xf;
246248}
247249
248250void hmcs40_cpu_device::op_ib()
249251{
250252   // IB: Increment B
251   op_illegal();
253   m_b = (m_b + 1) & 0xf;
254   m_s = (m_b != 0);
252255}
253256
254257void hmcs40_cpu_device::op_db()
255258{
256259   // DB: Decrement B
257   op_illegal();
260   m_b = (m_b - 1) & 0xf;
261   m_s = (m_b != 0xf);
258262}
259263
260264void hmcs40_cpu_device::op_amc()
261265{
262266   // AMC: Add A to Memory with Carry
263   op_illegal();
267   m_a += ram_r() + m_c;
268   m_c = m_a >> 4 & 1;
269   m_s = m_c;
270   m_a &= 0xf;
264271}
265272
266273void hmcs40_cpu_device::op_smc()
267274{
268275   // SMC: Subtract A from Memory with Carry
269   op_illegal();
276   m_a = ram_r() - m_a - (m_c ^ 1);
277   m_c = ~m_a >> 4 & 1;
278   m_s = m_c;
279   m_a &= 0xf;
270280}
271281
272282void hmcs40_cpu_device::op_am()
273283{
274284   // AM: Add A to Memory
275   op_illegal();
285   m_a += ram_r();
286   m_s = m_a >> 4 & 1;
287   m_a &= 0xf;
276288}
277289
278290void hmcs40_cpu_device::op_daa()
279291{
280292   // DAA: Decimal Adjust for Addition
281   op_illegal();
293   if (m_c || m_a > 9)
294   {
295      m_a = (m_a + 6) & 0xf;
296      m_c = 1;
297   }
282298}
283299
284300void hmcs40_cpu_device::op_das()
285301{
286302   // DAS: Decimal Adjust for Subtraction
287   op_illegal();
303   if (!m_c || m_a > 9)
304   {
305      m_a = (m_a + 10) & 0xf;
306      m_c = 0;
307   }
288308}
289309
290310void hmcs40_cpu_device::op_nega()
291311{
292312   // NEGA: Negate A
293   op_illegal();
313   m_a = (0 - m_a) & 0xf;
294314}
295315
296316void hmcs40_cpu_device::op_comb()
297317{
298318   // COMB: Complement B
299   op_illegal();
319   m_b ^= 0xf;
300320}
301321
302322void hmcs40_cpu_device::op_sec()
303323{
304324   // SEC: Set Carry
305   op_illegal();
325   m_c = 1;
306326}
307327
308328void hmcs40_cpu_device::op_rec()
309329{
310330   // REC: Reset Carry
311   op_illegal();
331   m_c = 0;
312332}
313333
314334void hmcs40_cpu_device::op_tc()
315335{
316336   // TC: Test Carry
317   op_illegal();
337   m_s = m_c;
318338}
319339
320340void hmcs40_cpu_device::op_rotl()
321341{
322342   // ROTL: Rotate Left A with Carry
323   op_illegal();
343   m_a = m_a << 1 | m_c;
344   m_c = m_a >> 4 & 1;
345   m_a &= 0xf;
324346}
325347
326348void hmcs40_cpu_device::op_rotr()
327349{
328350   // ROTR: Rotate Right A with Carry
329   op_illegal();
351   UINT8 c = m_a & 1;
352   m_a = m_a >> 1 | m_c << 3;
353   m_c = c;
330354}
331355
332356void hmcs40_cpu_device::op_or()
333357{
334358   // OR: OR A and B
335   op_illegal();
359   m_a |= m_b;
336360}
337361
338362
r244784r244785
341365void hmcs40_cpu_device::op_mnei()
342366{
343367   // MNEI i: Memory Not Equal to Immediate
344   op_illegal();
368   m_s = (ram_r() != (m_op & 0xf));
345369}
346370
347371void hmcs40_cpu_device::op_ynei()
348372{
349373   // YNEI i: Y Not Equal to Immediate
350   op_illegal();
374   m_s = (m_y != (m_op & 0xf));
351375}
352376
353377void hmcs40_cpu_device::op_anem()
354378{
355379   // ANEM: A Not Equal to Memory
356   op_illegal();
380   m_s = (m_a != ram_r());
357381}
358382
359383void hmcs40_cpu_device::op_bnem()
360384{
361385   // BNEM: B Not Equal to Memory
362   op_illegal();
386   m_s = (m_b != ram_r());
363387}
364388
365389void hmcs40_cpu_device::op_alei()
366390{
367391   // ALEI i: A Less or Equal to Immediate
368   op_illegal();
392   m_s = (m_a <= (m_op & 0xf));
369393}
370394
371395void hmcs40_cpu_device::op_alem()
372396{
373397   // ALEM: A Less or Equal to Memory
374   op_illegal();
398   m_s = (m_a <= ram_r());
375399}
376400
377401void hmcs40_cpu_device::op_blem()
378402{
379403   // BLEM: B Less or Equal to Memory
380   op_illegal();
404   m_s = (m_b <= ram_r());
381405}
382406
383407
r244784r244785
386410void hmcs40_cpu_device::op_sem()
387411{
388412   // SEM n: Set Memory Bit
389   op_illegal();
413   ram_w(ram_r() | (1 << (m_op & 3)));
390414}
391415
392416void hmcs40_cpu_device::op_rem()
393417{
394418   // REM n: Reset Memory Bit
395   op_illegal();
419   ram_w(ram_r() & ~(1 << (m_op & 3)));
396420}
397421
398422void hmcs40_cpu_device::op_tm()
399423{
400424   // TM n: Test Memory Bit
401   op_illegal();
425   m_s = ((ram_r() & (1 << (m_op & 3))) != 0);
402426}
403427
404428


Previous 199869 Revisions Next


© 1997-2024 The MAME Team