summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/clipper/clipper.h
diff options
context:
space:
mode:
author Patrick Mackinlay <pmackinlay@hotmail.com>2017-01-13 14:58:51 +0700
committer Patrick Mackinlay <pmackinlay@hotmail.com>2017-01-13 14:58:51 +0700
commitfb7c1e1d0a4f2f5e55e21688d546e1c8ee7f17c5 (patch)
tree3a537f96b0dffa8813e62bff9e770f9d9dd522dc /src/devices/cpu/clipper/clipper.h
parent361e48044d00c8e71c6c45648eb091f7715deaea (diff)
more minor tidy
Diffstat (limited to 'src/devices/cpu/clipper/clipper.h')
-rw-r--r--src/devices/cpu/clipper/clipper.h107
1 files changed, 54 insertions, 53 deletions
diff --git a/src/devices/cpu/clipper/clipper.h b/src/devices/cpu/clipper/clipper.h
index 6a9a55c8812..2a5202aae3d 100644
--- a/src/devices/cpu/clipper/clipper.h
+++ b/src/devices/cpu/clipper/clipper.h
@@ -5,7 +5,6 @@
#ifndef __CLIPPER_H__
#define __CLIPPER_H__
-// enumerate registers
enum clipper_registers
{
CLIPPER_R0, CLIPPER_R1, CLIPPER_R2, CLIPPER_R3, CLIPPER_R4, CLIPPER_R5, CLIPPER_R6, CLIPPER_R7,
@@ -14,44 +13,43 @@ enum clipper_registers
CLIPPER_F0, CLIPPER_F1, CLIPPER_F2, CLIPPER_F3, CLIPPER_F4, CLIPPER_F5, CLIPPER_F6, CLIPPER_F7,
CLIPPER_F8, CLIPPER_F9, CLIPPER_F10, CLIPPER_F11, CLIPPER_F12, CLIPPER_F13, CLIPPER_F14, CLIPPER_F15,
- CLIPPER_PSW, CLIPPER_SSW,
- CLIPPER_PC
+ CLIPPER_PSW,
+ CLIPPER_SSW,
+ CLIPPER_PC,
};
enum clipper_addressing_modes
{
- ADDR_MODE_PC32 = 0x10,
+ ADDR_MODE_PC32 = 0x10,
ADDR_MODE_ABS32 = 0x30,
ADDR_MODE_REL32 = 0x60,
- ADDR_MODE_PC16 = 0x90,
+ ADDR_MODE_PC16 = 0x90,
ADDR_MODE_REL12 = 0xa0,
ADDR_MODE_ABS16 = 0xb0,
- ADDR_MODE_PCX = 0xd0,
- ADDR_MODE_RELX = 0xe0
+ ADDR_MODE_PCX = 0xd0,
+ ADDR_MODE_RELX = 0xe0,
};
-#define PSW(mask) (m_psw & PSW_##mask)
-#define SSW(mask) (m_ssw & SSW_##mask)
-
-// macros for setting psw flags
-#define FLAGS(C,V,Z,N) \
- m_psw = (m_psw & ~(PSW_C | PSW_V | PSW_Z | PSW_N)) | (((C) << 3) | ((V) << 2) | ((Z) << 1) | ((N) << 0));
-#define FLAGS_CV(C,V) \
- m_psw = (m_psw & ~(PSW_C | PSW_V)) | (((C) << 3) | ((V) << 2));
-#define FLAGS_ZN(Z,N) \
- m_psw = (m_psw & ~(PSW_Z | PSW_N)) | (((Z) << 1) | ((N) << 0));
-
-// over/underflow for addition/subtraction from here: http://stackoverflow.com/questions/199333/how-to-detect-integer-overflow-in-c-c
-#define OF_ADD(a, b) ((b > 0) && (a > INT_MAX - b))
-#define UF_ADD(a, b) ((b < 0) && (a < INT_MIN - b))
-#define OF_SUB(a, b) ((b < 0) && (a > INT_MAX + b))
-#define UF_SUB(a, b) ((b > 0) && (a < INT_MIN + b))
-
-// CLIPPER logic for carry and overflow flags
-#define C_ADD(a, b) ((uint32_t)a + (uint32_t)b < (uint32_t)a)
-#define V_ADD(a, b) (OF_ADD((int32_t)a, (int32_t)b) || UF_ADD((int32_t)a, (int32_t)b))
-#define C_SUB(a, b) ((uint32_t)a < (uint32_t)b)
-#define V_SUB(a, b) (OF_SUB((int32_t)a, (int32_t)b) || UF_SUB((int32_t)a, (int32_t)b))
+// branch conditions
+enum clipper_branch_conditions
+{
+ BRANCH_T = 0x0,
+ BRANCH_LT = 0x1,
+ BRANCH_LE = 0x2,
+ BRANCH_EQ = 0x3,
+ BRANCH_GT = 0x4,
+ BRANCH_GE = 0x5,
+ BRANCH_NE = 0x6,
+ BRANCH_LTU = 0x7,
+ BRANCH_LEU = 0x8,
+ BRANCH_GTU = 0x9,
+ BRANCH_GEU = 0xa,
+ BRANCH_V = 0xb,
+ BRANCH_NV = 0xc,
+ BRANCH_N = 0xd,
+ BRANCH_NN = 0xe,
+ BRANCH_FN = 0xf,
+};
enum clipper_psw
{
@@ -71,12 +69,12 @@ enum clipper_psw
PSW_EFI = 0x00002000, // enable floating invalid operation trap
PSW_EFT = 0x00004000, // enable floating trap
PSW_FR = 0x00018000, // floating rounding mode (2 bits)
- PSW_GAP = 0x000e0000, // unused (3 bits)
+ // unused (3 bits)
PSW_DSP = 0x00300000, // c400 - delay slot pointer (2 bits)
PSW_BIG = 0x00400000, // c400 - big endian (hardware)
PSW_T = 0x00800000, // trace trap
PSW_CTS = 0x0f000000, // cpu trap status (4 bits)
- PSW_MTS = 0xf0000000 // memory trap status (4 bits)
+ PSW_MTS = 0xf0000000, // memory trap status (4 bits)
};
enum clipper_ssw
@@ -85,7 +83,7 @@ enum clipper_ssw
SSW_IL = 0x000000f0, // interrupt level (4 bits)
SSW_EI = 0x00000100, // enable interrupts
SSW_ID = 0x0001fe00, // cpu rev # and type (8 bits)
- SSW_GAP = 0x003e0000, // unused (5 bits)
+ // unused (5 bits)
SSW_FRD = 0x00400000, // floating registers dirty
SSW_TP = 0x00800000, // trace trap pending
SSW_ECM = 0x01000000, // enabled corrected memory error
@@ -98,27 +96,6 @@ enum clipper_ssw
SSW_P = 0x80000000, // previous mode
};
-// branch conditions
-enum clipper_branch_conditions
-{
- BRANCH_T = 0x0,
- BRANCH_LT = 0x1,
- BRANCH_LE = 0x2,
- BRANCH_EQ = 0x3,
- BRANCH_GT = 0x4,
- BRANCH_GE = 0x5,
- BRANCH_NE = 0x6,
- BRANCH_LTU = 0x7,
- BRANCH_LEU = 0x8,
- BRANCH_GTU = 0x9,
- BRANCH_GEU = 0xa,
- BRANCH_V = 0xb,
- BRANCH_NV = 0xc,
- BRANCH_N = 0xd,
- BRANCH_NN = 0xe,
- BRANCH_FN = 0xf
-};
-
enum clipper_exception_vectors
{
// data memory trap group
@@ -180,6 +157,30 @@ enum clipper_memory_trap_sources
MTS_WRITE_PROTECT_FAULT = 7 << 28,
};
+// convenience macros for dealing with the psw
+#define PSW(mask) (m_psw & PSW_##mask)
+#define SSW(mask) (m_ssw & SSW_##mask)
+
+// macros for setting psw condition codes
+#define FLAGS(C,V,Z,N) \
+ m_psw = (m_psw & ~(PSW_C | PSW_V | PSW_Z | PSW_N)) | (((C) << 3) | ((V) << 2) | ((Z) << 1) | ((N) << 0));
+#define FLAGS_CV(C,V) \
+ m_psw = (m_psw & ~(PSW_C | PSW_V)) | (((C) << 3) | ((V) << 2));
+#define FLAGS_ZN(Z,N) \
+ m_psw = (m_psw & ~(PSW_Z | PSW_N)) | (((Z) << 1) | ((N) << 0));
+
+// over/underflow for addition/subtraction from here: http://stackoverflow.com/questions/199333/how-to-detect-integer-overflow-in-c-c
+#define OF_ADD(a, b) ((b > 0) && (a > INT_MAX - b))
+#define UF_ADD(a, b) ((b < 0) && (a < INT_MIN - b))
+#define OF_SUB(a, b) ((b < 0) && (a > INT_MAX + b))
+#define UF_SUB(a, b) ((b > 0) && (a < INT_MIN + b))
+
+// CLIPPER logic for carry and overflow flags
+#define C_ADD(a, b) ((uint32_t)a + (uint32_t)b < (uint32_t)a)
+#define V_ADD(a, b) (OF_ADD((int32_t)a, (int32_t)b) || UF_ADD((int32_t)a, (int32_t)b))
+#define C_SUB(a, b) ((uint32_t)a < (uint32_t)b)
+#define V_SUB(a, b) (OF_SUB((int32_t)a, (int32_t)b) || UF_SUB((int32_t)a, (int32_t)b))
+
class clipper_device : public cpu_device
{
public: