summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/ucom4
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-02-25 08:09:13 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-02-25 08:09:13 +0100
commit6ae44e46f91aa2bd74d9895e6bfd345baebd3d22 (patch)
tree70be3ad6f499bb138c0335e8d2d16790f6f971b3 /src/emu/cpu/ucom4
parent33c8d18d612786130c2baafd644604137f6f4ef8 (diff)
Cleanups and version bumpmame0159
Diffstat (limited to 'src/emu/cpu/ucom4')
-rw-r--r--src/emu/cpu/ucom4/ucom4.c24
-rw-r--r--src/emu/cpu/ucom4/ucom4.h4
-rw-r--r--src/emu/cpu/ucom4/ucom4d.c4
-rw-r--r--src/emu/cpu/ucom4/ucom4op.inc50
4 files changed, 41 insertions, 41 deletions
diff --git a/src/emu/cpu/ucom4/ucom4.c b/src/emu/cpu/ucom4/ucom4.c
index e7f25a26661..b415595a5b0 100644
--- a/src/emu/cpu/ucom4/ucom4.c
+++ b/src/emu/cpu/ucom4/ucom4.c
@@ -3,7 +3,7 @@
/*
NEC uCOM-4 MCU family cores
-
+
References:
- 1981 NEC Microcomputers Catalog (later editions may have errors!)
- Supplement to uCOM-43 Single Chip Microcomputer Users' Manual
@@ -20,7 +20,7 @@ enum
NEC_UCOM43 = 0,
NEC_UCOM44,
NEC_UCOM45
-};
+};
#include "ucom4.h"
#include "debugger.h"
@@ -115,7 +115,7 @@ enum
void ucom4_cpu_device::device_start()
{
assert(NEC_UCOM4_PORTA == 0);
-
+
m_program = &space(AS_PROGRAM);
m_data = &space(AS_DATA);
m_prgmask = (1 << m_prgwidth) - 1;
@@ -195,12 +195,12 @@ void ucom4_cpu_device::device_reset()
m_skip = false;
m_timer->adjust(attotime::never);
-
+
// clear interrupt
m_int_line = CLEAR_LINE;
m_int_f = 0;
m_inte_f = (m_family == NEC_UCOM43) ? 0 : 1;
-
+
// clear i/o
for (int i = NEC_UCOM4_PORTC; i <= NEC_UCOM4_PORTI; i++)
output_w(i, 0xf);
@@ -221,9 +221,9 @@ void ucom4_cpu_device::execute_set_input(int line, int state)
if (m_int_line == CLEAR_LINE && state)
m_int_f = 1;
m_int_line = state;
-
+
break;
-
+
default:
break;
}
@@ -273,13 +273,13 @@ void ucom4_cpu_device::execute_run()
m_bitmask = 1 << (m_op & 0x03);
increment_pc();
fetch_arg();
-
+
if (m_skip)
{
m_skip = false;
m_op = 0; // nop
}
-
+
// handle opcode
switch (m_op & 0xf0)
{
@@ -287,9 +287,9 @@ void ucom4_cpu_device::execute_run()
case 0x90: op_li(); break;
case 0xa0: op_jmpcal(); break;
case 0xb0: op_czp(); break;
-
+
case 0xc0: case 0xd0: case 0xe0: case 0xf0: op_jcp(); break;
-
+
default:
switch (m_op)
{
@@ -374,7 +374,7 @@ void ucom4_cpu_device::execute_run()
case 0x7c: op_sfb(); break;
}
break; // 0xfc
-
+
}
break; // 0xff
diff --git a/src/emu/cpu/ucom4/ucom4.h b/src/emu/cpu/ucom4/ucom4.h
index 07d80603c67..c215b2336f2 100644
--- a/src/emu/cpu/ucom4/ucom4.h
+++ b/src/emu/cpu/ucom4/ucom4.h
@@ -143,7 +143,7 @@ protected:
bool m_skip; // skip next opcode
int m_icount;
emu_timer *m_timer;
-
+
UINT16 m_pc; // program counter
UINT8 m_acc; // 4-bit accumulator
UINT8 m_dpl; // 4-bit data pointer low (RAM x)
@@ -169,7 +169,7 @@ protected:
devcb_write8 m_write_g;
devcb_write8 m_write_h;
devcb_write8 m_write_i;
-
+
// misc internal helpers
void increment_pc();
void fetch_arg();
diff --git a/src/emu/cpu/ucom4/ucom4d.c b/src/emu/cpu/ucom4/ucom4d.c
index 531be0ed58c..14adfefbc79 100644
--- a/src/emu/cpu/ucom4/ucom4d.c
+++ b/src/emu/cpu/ucom4/ucom4d.c
@@ -121,7 +121,7 @@ CPU_DISASSEMBLE(ucom4)
char *dst = buffer;
dst += sprintf(dst, "%-4s ", s_mnemonics[instr]);
-
+
// opcode parameter
int bits = s_bits[instr];
if (bits)
@@ -133,7 +133,7 @@ CPU_DISASSEMBLE(ucom4)
param = (param << (bits / 10)) | (op2 & ((1 << (bits / 10)) - 1));
bits = (bits % 10) + (bits / 10);
}
-
+
// special case for CZP
if (instr == mCZP)
{
diff --git a/src/emu/cpu/ucom4/ucom4op.inc b/src/emu/cpu/ucom4/ucom4op.inc
index 8de834438b5..8ac0a462145 100644
--- a/src/emu/cpu/ucom4/ucom4op.inc
+++ b/src/emu/cpu/ucom4/ucom4op.inc
@@ -32,7 +32,7 @@ UINT8 ucom4_cpu_device::input_r(int index)
{
index &= 0xf;
UINT8 inp = 0xf;
-
+
switch (index)
{
case NEC_UCOM4_PORTA: inp = m_read_a(index, 0xff); break;
@@ -62,7 +62,7 @@ void ucom4_cpu_device::output_w(int index, UINT8 data)
case NEC_UCOM4_PORTG: m_write_g(index, data, 0xff); break;
case NEC_UCOM4_PORTH: m_write_h(index, data, 0xff); break;
case NEC_UCOM4_PORTI: m_write_i(index, data & 7, 0xff); break;
-
+
default:
logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data & 0xf, m_pc);
break;
@@ -370,7 +370,7 @@ void ucom4_cpu_device::op_ci()
{
// CI X: skip next on ACC equals X
m_skip = (m_acc == (m_arg & 0x0f));
-
+
if ((m_arg & 0xf0) != 0xc0)
logerror("%s CI opcode unexpected upper arg $%02X at $%03X\n", tag(), m_arg & 0xf0, m_pc);
}
@@ -397,7 +397,7 @@ void ucom4_cpu_device::op_cli()
{
// CLI X: skip next on DPl equals X
m_skip = (m_dpl == (m_arg & 0x0f));
-
+
if ((m_arg & 0xf0) != 0xe0)
logerror("%s CLI opcode unexpected upper arg $%02X at $%03X\n", tag(), m_arg & 0xf0, m_pc);
}
@@ -530,7 +530,7 @@ void ucom4_cpu_device::op_taw()
void ucom4_cpu_device::op_taz()
{
if (!check_op_43()) return;
-
+
// TAZ: Transfer ACC to Z
m_icount--;
ucom43_reg_w(UCOM43_Z, m_acc);
@@ -539,7 +539,7 @@ void ucom4_cpu_device::op_taz()
void ucom4_cpu_device::op_thx()
{
if (!check_op_43()) return;
-
+
// THX: Transfer DPh to X
m_icount--;
ucom43_reg_w(UCOM43_X, m_dph);
@@ -548,7 +548,7 @@ void ucom4_cpu_device::op_thx()
void ucom4_cpu_device::op_tly()
{
if (!check_op_43()) return;
-
+
// TLY: Transfer DPl to Y
m_icount--;
ucom43_reg_w(UCOM43_Y, m_dpl);
@@ -560,7 +560,7 @@ void ucom4_cpu_device::op_tly()
void ucom4_cpu_device::op_xaw()
{
if (!check_op_43()) return;
-
+
// XAW: Exchange ACC with W
m_icount--;
UINT8 old_acc = m_acc;
@@ -571,7 +571,7 @@ void ucom4_cpu_device::op_xaw()
void ucom4_cpu_device::op_xaz()
{
if (!check_op_43()) return;
-
+
// XAZ: Exchange ACC with Z
m_icount--;
UINT8 old_acc = m_acc;
@@ -582,7 +582,7 @@ void ucom4_cpu_device::op_xaz()
void ucom4_cpu_device::op_xhr()
{
if (!check_op_43()) return;
-
+
// XHR: Exchange DPh with R
m_icount--;
UINT8 old_dph = m_dph;
@@ -593,7 +593,7 @@ void ucom4_cpu_device::op_xhr()
void ucom4_cpu_device::op_xhx()
{
if (!check_op_43()) return;
-
+
// XHX: Exchange DPh with X
m_icount--;
UINT8 old_dph = m_dph;
@@ -604,7 +604,7 @@ void ucom4_cpu_device::op_xhx()
void ucom4_cpu_device::op_xls()
{
if (!check_op_43()) return;
-
+
// XLS: Exchange DPl with S
m_icount--;
UINT8 old_dpl = m_dpl;
@@ -615,7 +615,7 @@ void ucom4_cpu_device::op_xls()
void ucom4_cpu_device::op_xly()
{
if (!check_op_43()) return;
-
+
// XLY: Exchange DPl with Y
m_icount--;
UINT8 old_dpl = m_dpl;
@@ -626,7 +626,7 @@ void ucom4_cpu_device::op_xly()
void ucom4_cpu_device::op_xc()
{
if (!check_op_43()) return;
-
+
// XC: Exchange Carry F/F with Carry Save F/F
UINT8 c = m_carry_f;
m_carry_f = m_carry_s_f;
@@ -639,7 +639,7 @@ void ucom4_cpu_device::op_xc()
void ucom4_cpu_device::op_sfb()
{
if (!check_op_43()) return;
-
+
// SFB B: Set a single bit of FLAG
m_icount--;
ucom43_reg_w(UCOM43_F, ucom43_reg_r(UCOM43_F) | m_bitmask);
@@ -648,7 +648,7 @@ void ucom4_cpu_device::op_sfb()
void ucom4_cpu_device::op_rfb()
{
if (!check_op_43()) return;
-
+
// RFB B: Reset a single bit of FLAG
m_icount--;
ucom43_reg_w(UCOM43_F, ucom43_reg_r(UCOM43_F) & ~m_bitmask);
@@ -657,7 +657,7 @@ void ucom4_cpu_device::op_rfb()
void ucom4_cpu_device::op_fbt()
{
if (!check_op_43()) return;
-
+
// FBT B: skip next on bit(FLAG)
m_icount--;
m_skip = ((ucom43_reg_r(UCOM43_F) & m_bitmask) != 0);
@@ -666,7 +666,7 @@ void ucom4_cpu_device::op_fbt()
void ucom4_cpu_device::op_fbf()
{
if (!check_op_43()) return;
-
+
// FBF B: skip next on not bit(FLAG)
m_icount--;
m_skip = ((ucom43_reg_r(UCOM43_F) & m_bitmask) == 0);
@@ -678,7 +678,7 @@ void ucom4_cpu_device::op_fbf()
void ucom4_cpu_device::op_rar()
{
if (!check_op_43()) return;
-
+
// RAR: Rotate ACC Right through Carry F/F
UINT8 c = m_acc & 1;
m_acc = m_acc >> 1 | m_carry_f << 3;
@@ -691,7 +691,7 @@ void ucom4_cpu_device::op_rar()
void ucom4_cpu_device::op_inm()
{
if (!check_op_43()) return;
-
+
// INM: Increment RAM, skip next on carry
UINT8 val = (ram_r() + 1) & 0xf;
ram_w(val);
@@ -701,7 +701,7 @@ void ucom4_cpu_device::op_inm()
void ucom4_cpu_device::op_dem()
{
if (!check_op_43()) return;
-
+
// DEM: Decrement RAM, skip next on carry
UINT8 val = (ram_r() - 1) & 0xf;
ram_w(val);
@@ -714,7 +714,7 @@ void ucom4_cpu_device::op_dem()
void ucom4_cpu_device::op_stm()
{
if (!check_op_43()) return;
-
+
// STM X: Reset Timer F/F, Start Timer with X
m_timer_f = 0;
@@ -730,7 +730,7 @@ void ucom4_cpu_device::op_stm()
void ucom4_cpu_device::op_ttm()
{
if (!check_op_43()) return;
-
+
// TTM: skip next on Timer F/F
m_skip = (m_timer_f != 0);
}
@@ -741,7 +741,7 @@ void ucom4_cpu_device::op_ttm()
void ucom4_cpu_device::op_ei()
{
if (!check_op_43()) return;
-
+
// EI: Set Interrupt Enable F/F
m_inte_f = 1;
}
@@ -749,7 +749,7 @@ void ucom4_cpu_device::op_ei()
void ucom4_cpu_device::op_di()
{
if (!check_op_43()) return;
-
+
// DI: Reset Interrupt Enable F/F
m_inte_f = 0;
}