summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/z80_private.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/include/z80_private.h b/include/z80_private.h
index a7022d8..86adaee 100644
--- a/include/z80_private.h
+++ b/include/z80_private.h
@@ -19,14 +19,14 @@
-------------------------------------------------------------------------
- $Id: z80_private.h 13 2006-10-12 16:38:57Z ianc $
+ $Id$
Private macros for Z80
*/
#ifndef Z80_PRIVATE_H
-#define Z80_PRIVATE_H "$Id: z80_private.h 13 2006-10-12 16:38:57Z ianc $"
+#define Z80_PRIVATE_H "$Id$"
#include "z80_config.h"
@@ -71,6 +71,8 @@ struct Z80Private
Z80Callback callback[eZ80_NO_CALLBACK][MAX_PER_CALLBACK];
int last_cb;
+
+ Z80Reg memptr;
};
#define PRIV cpu->priv
@@ -116,6 +118,7 @@ extern Z80Byte Z80_MEMORY[];
#define B3_Z80 0x08
#define B5_Z80 0x20
+#define HIDDEN_Z80 (B3_Z80|B5_Z80)
#define SET(v,b) (v)|=b
@@ -180,7 +183,19 @@ static inline Z80Word PEEKW(Z80Word addr)
#define CARRY IS_C
#define IS_IX_IY (PRIV->shift==0xdd || PRIV->shift==0xfd)
-#define OFFSET(off) off=(IS_IX_IY ? (Z80Relative)FETCH_BYTE:0)
+
+#define OFFSET(base,off) do \
+ { \
+ if (IS_IX_IY) \
+ { \
+ off=(Z80Relative)FETCH_BYTE; \
+ PRIV->memptr.w=base+off; \
+ } \
+ else \
+ { \
+ off=0; \
+ } \
+ } while(0)
#define TSTATE(n) do \
{ \
@@ -228,12 +243,25 @@ static inline Z80Word PEEKW(Z80Word addr)
{ \
PUSH(cpu->PC+2); \
cpu->PC=PEEKW(cpu->PC); \
+ PRIV->memptr.w=cpu->PC; \
} while(0)
#define NOCALL cpu->PC+=2
-#define JP cpu->PC=PEEKW(cpu->PC)
-#define NOJP cpu->PC+=2
-#define JR cpu->PC+=(Z80Relative)PEEK(cpu->PC)+1
+
+#define JP do \
+ { \
+ cpu->PC=PEEKW(cpu->PC); \
+ PRIV->memptr.w=cpu->PC; \
+ } while(0)
+
+#define NOJP NOCALL
+
+#define JR do \
+ { \
+ cpu->PC+=(Z80Relative)PEEK(cpu->PC)+1; \
+ PRIV->memptr.w=cpu->PC; \
+ } while(0)
+
#define NOJR cpu->PC++
#define OUT(P,V) do \