summaryrefslogtreecommitdiff
path: root/include/z80_private.h
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2021-08-03 21:43:06 +0000
committerIan C <ianc@noddybox.co.uk>2021-08-03 21:43:06 +0000
commit0d08766ccc80cacfe0690cb8a1ea8f13038e404b (patch)
tree15eb862285cf96fef26b8fffb31dc60cd233a51c /include/z80_private.h
parentb7e8b634595445325d10f8fcddcb7d6cdaa8a922 (diff)
Sped up Z80 emulation
Diffstat (limited to 'include/z80_private.h')
-rw-r--r--include/z80_private.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/include/z80_private.h b/include/z80_private.h
index e0b3381..a7022d8 100644
--- a/include/z80_private.h
+++ b/include/z80_private.h
@@ -121,13 +121,15 @@ extern Z80Byte Z80_MEMORY[];
#define SET(v,b) (v)|=b
#define CLR(v,b) (v)&=~(b)
-#define SETFLAG(f) SET(cpu->AF.b[LO],f)
-#define CLRFLAG(f) CLR(cpu->AF.b[LO],f)
+#define SETFLAG(f) SET(cpu->AF.b.lo,f)
+#define CLRFLAG(f) CLR(cpu->AF.b.lo,f)
#ifdef ENABLE_ARRAY_MEMORY
#define PEEK(addr) Z80_MEMORY[addr]
+/* This can't be a macro as the macro is used as PEEKW(FETCH_WORD)
+*/
static inline Z80Word PEEKW(Z80Word addr)
{
return (PEEK(addr) | (Z80Word)PEEK(addr+1)<<8);
@@ -168,12 +170,12 @@ static inline Z80Word PEEKW(Z80Word addr)
#endif
-#define IS_C (cpu->AF.b[LO]&C_Z80)
-#define IS_N (cpu->AF.b[LO]&N_Z80)
-#define IS_P (cpu->AF.b[LO]&P_Z80)
-#define IS_H (cpu->AF.b[LO]&H_Z80)
-#define IS_Z (cpu->AF.b[LO]&Z_Z80)
-#define IS_S (cpu->AF.b[LO]&S_Z80)
+#define IS_C (cpu->AF.b.lo&C_Z80)
+#define IS_N (cpu->AF.b.lo&N_Z80)
+#define IS_P (cpu->AF.b.lo&P_Z80)
+#define IS_H (cpu->AF.b.lo&H_Z80)
+#define IS_Z (cpu->AF.b.lo&Z_Z80)
+#define IS_S (cpu->AF.b.lo&S_Z80)
#define CARRY IS_C
@@ -219,7 +221,7 @@ static inline Z80Word PEEKW(Z80Word addr)
cpu->SP+=2; \
} while(0)
-#define SETHIDDEN(res) cpu->AF.b[LO]=(cpu->AF.b[LO]&~(B3_Z80|B5_Z80))|\
+#define SETHIDDEN(res) cpu->AF.b.lo=(cpu->AF.b.lo&~(B3_Z80|B5_Z80))|\
((res)&(B3_Z80|B5_Z80))
#define CALL do \