summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/i8085/i8085cpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/cpu/i8085/i8085cpu.h')
-rw-r--r--src/emu/cpu/i8085/i8085cpu.h183
1 files changed, 91 insertions, 92 deletions
diff --git a/src/emu/cpu/i8085/i8085cpu.h b/src/emu/cpu/i8085/i8085cpu.h
index bc4a5297082..f3f776ade46 100644
--- a/src/emu/cpu/i8085/i8085cpu.h
+++ b/src/emu/cpu/i8085/i8085cpu.h
@@ -39,26 +39,26 @@
#define M_MVI(R) R=ARG(cpustate)
/* rotate */
-#define M_RLC { \
- cpustate->AF.b.h = (cpustate->AF.b.h << 1) | (cpustate->AF.b.h >> 7); \
- cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h & CF); \
+#define M_RLC { \
+ cpustate->AF.b.h = (cpustate->AF.b.h << 1) | (cpustate->AF.b.h >> 7); \
+ cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h & CF); \
}
-#define M_RRC { \
- cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h & CF); \
- cpustate->AF.b.h = (cpustate->AF.b.h >> 1) | (cpustate->AF.b.h << 7); \
+#define M_RRC { \
+ cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h & CF); \
+ cpustate->AF.b.h = (cpustate->AF.b.h >> 1) | (cpustate->AF.b.h << 7); \
}
-#define M_RAL { \
- int c = cpustate->AF.b.l&CF; \
- cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h >> 7); \
- cpustate->AF.b.h = (cpustate->AF.b.h << 1) | c; \
+#define M_RAL { \
+ int c = cpustate->AF.b.l&CF; \
+ cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h >> 7); \
+ cpustate->AF.b.h = (cpustate->AF.b.h << 1) | c; \
}
-#define M_RAR { \
- int c = (cpustate->AF.b.l&CF) << 7; \
- cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h & CF); \
- cpustate->AF.b.h = (cpustate->AF.b.h >> 1) | c; \
+#define M_RAR { \
+ int c = (cpustate->AF.b.l&CF) << 7; \
+ cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | (cpustate->AF.b.h & CF); \
+ cpustate->AF.b.h = (cpustate->AF.b.h >> 1) | c; \
}
/* logical */
@@ -71,117 +71,116 @@
#define M_DCR(R) {UINT8 hc = ((R & 0x0f) != 0x00) ? HF : 0; --R; cpustate->AF.b.l= (cpustate->AF.b.l & CF ) | ZSP[R] | hc | VF; }
/* arithmetic */
-#define M_ADD(R) { \
- int q = cpustate->AF.b.h+R; \
- cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF); \
- cpustate->AF.b.h=q; \
+#define M_ADD(R) { \
+ int q = cpustate->AF.b.h+R; \
+ cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF); \
+ cpustate->AF.b.h=q; \
}
-#define M_ADC(R) { \
- int q = cpustate->AF.b.h+R+(cpustate->AF.b.l&CF); \
- cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF); \
- cpustate->AF.b.h=q; \
+#define M_ADC(R) { \
+ int q = cpustate->AF.b.h+R+(cpustate->AF.b.l&CF); \
+ cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF); \
+ cpustate->AF.b.h=q; \
}
-#define M_SUB(R) { \
- int q = cpustate->AF.b.h-R; \
- cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \
- cpustate->AF.b.h=q; \
+#define M_SUB(R) { \
+ int q = cpustate->AF.b.h-R; \
+ cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \
+ cpustate->AF.b.h=q; \
}
-#define M_SBB(R) { \
- int q = cpustate->AF.b.h-R-(cpustate->AF.b.l&CF); \
- cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \
- cpustate->AF.b.h=q; \
+#define M_SBB(R) { \
+ int q = cpustate->AF.b.h-R-(cpustate->AF.b.l&CF); \
+ cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \
+ cpustate->AF.b.h=q; \
}
-#define M_CMP(R) { \
- int q = cpustate->AF.b.h-R; \
- cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \
+#define M_CMP(R) { \
+ int q = cpustate->AF.b.h-R; \
+ cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \
}
-#define M_DAD(R) { \
- int q = cpustate->HL.d + cpustate->R.d; \
- cpustate->AF.b.l = (cpustate->AF.b.l & ~CF) | (q>>16 & CF ); \
- cpustate->HL.w.l = q; \
+#define M_DAD(R) { \
+ int q = cpustate->HL.d + cpustate->R.d; \
+ cpustate->AF.b.l = (cpustate->AF.b.l & ~CF) | (q>>16 & CF ); \
+ cpustate->HL.w.l = q; \
}
// DSUB is 8085-only, not sure if H flag handling is correct
-#define M_DSUB(cpustate) { \
- int q = cpustate->HL.b.l-cpustate->BC.b.l; \
- cpustate->AF.b.l=ZS[q&255]|((q>>8)&CF)|VF| \
- ((cpustate->HL.b.l^q^cpustate->BC.b.l)&HF)| \
- (((cpustate->BC.b.l^cpustate->HL.b.l)&(cpustate->HL.b.l^q)&SF)>>5); \
- cpustate->HL.b.l=q; \
- q = cpustate->HL.b.h-cpustate->BC.b.h-(cpustate->AF.b.l&CF); \
- cpustate->AF.b.l=ZS[q&255]|((q>>8)&CF)|VF| \
- ((cpustate->HL.b.h^q^cpustate->BC.b.h)&HF)| \
- (((cpustate->BC.b.h^cpustate->HL.b.h)&(cpustate->HL.b.h^q)&SF)>>5); \
- if (cpustate->HL.b.l!=0) cpustate->AF.b.l&=~ZF; \
+#define M_DSUB(cpustate) { \
+ int q = cpustate->HL.b.l-cpustate->BC.b.l; \
+ cpustate->AF.b.l=ZS[q&255]|((q>>8)&CF)|VF| \
+ ((cpustate->HL.b.l^q^cpustate->BC.b.l)&HF)| \
+ (((cpustate->BC.b.l^cpustate->HL.b.l)&(cpustate->HL.b.l^q)&SF)>>5); \
+ cpustate->HL.b.l=q; \
+ q = cpustate->HL.b.h-cpustate->BC.b.h-(cpustate->AF.b.l&CF); \
+ cpustate->AF.b.l=ZS[q&255]|((q>>8)&CF)|VF| \
+ ((cpustate->HL.b.h^q^cpustate->BC.b.h)&HF)| \
+ (((cpustate->BC.b.h^cpustate->HL.b.h)&(cpustate->HL.b.h^q)&SF)>>5); \
+ if (cpustate->HL.b.l!=0) cpustate->AF.b.l&=~ZF; \
}
/* i/o */
-#define M_IN \
- cpustate->STATUS = 0x42; \
- cpustate->WZ.d=ARG(cpustate); \
+#define M_IN \
+ cpustate->STATUS = 0x42; \
+ cpustate->WZ.d=ARG(cpustate); \
cpustate->AF.b.h=cpustate->io->read_byte(cpustate->WZ.d);
-#define M_OUT \
- cpustate->STATUS = 0x10; \
- cpustate->WZ.d=ARG(cpustate); \
+#define M_OUT \
+ cpustate->STATUS = 0x10; \
+ cpustate->WZ.d=ARG(cpustate); \
cpustate->io->write_byte(cpustate->WZ.d,cpustate->AF.b.h)
/* stack */
-#define M_PUSH(R) { \
- cpustate->STATUS = 0x04; \
- cpustate->program->write_byte(--cpustate->SP.w.l, cpustate->R.b.h); \
- cpustate->program->write_byte(--cpustate->SP.w.l, cpustate->R.b.l); \
+#define M_PUSH(R) { \
+ cpustate->STATUS = 0x04; \
+ cpustate->program->write_byte(--cpustate->SP.w.l, cpustate->R.b.h); \
+ cpustate->program->write_byte(--cpustate->SP.w.l, cpustate->R.b.l); \
}
-#define M_POP(R) { \
- cpustate->STATUS = 0x86; \
- cpustate->R.b.l = cpustate->program->read_byte(cpustate->SP.w.l++); \
- cpustate->R.b.h = cpustate->program->read_byte(cpustate->SP.w.l++); \
+#define M_POP(R) { \
+ cpustate->STATUS = 0x86; \
+ cpustate->R.b.l = cpustate->program->read_byte(cpustate->SP.w.l++); \
+ cpustate->R.b.h = cpustate->program->read_byte(cpustate->SP.w.l++); \
}
/* jumps */
// On 8085 jump if condition is not satisfied is shorter
-#define M_JMP(cc) { \
- if (cc) { \
- cpustate->PC.w.l = ARG16(cpustate); \
- } else { \
- cpustate->PC.w.l += 2; \
- cpustate->icount += (IS_8085(cpustate)) ? 3 : 0; \
- } \
+#define M_JMP(cc) { \
+ if (cc) { \
+ cpustate->PC.w.l = ARG16(cpustate); \
+ } else { \
+ cpustate->PC.w.l += 2; \
+ cpustate->icount += (IS_8085(cpustate)) ? 3 : 0; \
+ } \
}
// On 8085 call if condition is not satisfied is 9 ticks
-#define M_CALL(cc) \
-{ \
- if (cc) \
- { \
- UINT16 a = ARG16(cpustate); \
- cpustate->icount -= (IS_8085(cpustate)) ? 7 : 6 ; \
- M_PUSH(PC); \
- cpustate->PC.d = a; \
- } else { \
- cpustate->PC.w.l += 2; \
- cpustate->icount += (IS_8085(cpustate)) ? 2 : 0; \
- } \
+#define M_CALL(cc) \
+{ \
+ if (cc) \
+ { \
+ UINT16 a = ARG16(cpustate); \
+ cpustate->icount -= (IS_8085(cpustate)) ? 7 : 6 ; \
+ M_PUSH(PC); \
+ cpustate->PC.d = a; \
+ } else { \
+ cpustate->PC.w.l += 2; \
+ cpustate->icount += (IS_8085(cpustate)) ? 2 : 0; \
+ } \
}
// conditional RET only
-#define M_RET(cc) \
-{ \
- if (cc) \
- { \
- cpustate->icount -= 6; \
- M_POP(PC); \
- } \
+#define M_RET(cc) \
+{ \
+ if (cc) \
+ { \
+ cpustate->icount -= 6; \
+ M_POP(PC); \
+ } \
}
-#define M_RST(nn) { \
- M_PUSH(PC); \
- cpustate->PC.d = 8 * nn; \
+#define M_RST(nn) { \
+ M_PUSH(PC); \
+ cpustate->PC.d = 8 * nn; \
}
-