summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emma.c2
-rw-r--r--runall1
-rw-r--r--rundoc1
-rw-r--r--runprelim1
-rw-r--r--z80.c3
-rw-r--r--z80_decode.c47
-rw-r--r--z80_private.h14
7 files changed, 30 insertions, 39 deletions
diff --git a/emma.c b/emma.c
index c36e71e..d666771 100644
--- a/emma.c
+++ b/emma.c
@@ -53,7 +53,7 @@ Z80Byte Z80_MEMORY[0x10000];
static sig_atomic_t stop=FALSE;
static int quit=FALSE;
-static int quiet_run=FALSE;
+static int quiet_run=TRUE;
static int single_step=FALSE;
static int mem_trace=FALSE;
diff --git a/runall b/runall
index 272b974..f23b3ed 100644
--- a/runall
+++ b/runall
@@ -1,5 +1,4 @@
i emucpm.hex
l zexall.com 0x100
#D zexall.lbl
-s
r 0x100
diff --git a/rundoc b/rundoc
index 6bbbc55..b8dfd9b 100644
--- a/rundoc
+++ b/rundoc
@@ -1,7 +1,6 @@
i emucpm.hex
l zexdoc.com 0x100
#D zexdoc.lbl
-s
r 0x100
#p 0x100
#n
diff --git a/runprelim b/runprelim
index 609efd3..03c42c3 100644
--- a/runprelim
+++ b/runprelim
@@ -1,4 +1,3 @@
i emucpm.hex
l prelim.com 0x100
-s
r 0x100
diff --git a/z80.c b/z80.c
index 70363de..5843b0f 100644
--- a/z80.c
+++ b/z80.c
@@ -66,6 +66,7 @@ static void Z80_CheckInterrupt(Z80 *cpu)
PRIV->nmi=FALSE;
PUSH(cpu->PC);
cpu->PC=0x66;
+ PRIV->memptr.w=cpu->PC;
}
else if (cpu->IFF1)
{
@@ -93,11 +94,13 @@ static void Z80_CheckInterrupt(Z80 *cpu)
case 1:
PUSH(cpu->PC);
cpu->PC=0x38;
+ PRIV->memptr.w=cpu->PC;
break;
case 2:
PUSH(cpu->PC);
cpu->PC=(Z80Word)cpu->I*256+PRIV->devbyte;
+ PRIV->memptr.w=cpu->PC;
break;
}
}
diff --git a/z80_decode.c b/z80_decode.c
index f675fc5..445d122 100644
--- a/z80_decode.c
+++ b/z80_decode.c
@@ -441,6 +441,7 @@ do { \
#define BIT(REG,B) \
do { \
cpu->AF.b.lo&=C_Z80; \
+ cpu->AF.b.lo|=H_Z80; \
if ((REG)&(1<<B)) \
{ \
cpu->AF.b.lo|=S_Z80&REG; \
@@ -449,7 +450,6 @@ do { \
{ \
cpu->AF.b.lo|=Z_Z80|P_Z80; \
} \
- cpu->AF.b.lo|=H_Z80; \
SETHIDDEN(REG); \
} while(0)
@@ -879,7 +879,7 @@ do { \
\
case BASE+6: /* OP2 (HL) */ \
TSTATE(12); \
- OP_ON_MEM_WITH_ARG(OP2,cpu->HL.w,BIT_NO); \
+ OP_ON_MEM_WITH_ARG(OP2,cpu->HL.w,BIT_NO); \
break; \
\
case BASE+7: /* OP A */ \
@@ -1055,7 +1055,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
}
case 0x44: /* NEG */
- {
+ {
Z80Byte b;
TSTATE(8);
@@ -1064,7 +1064,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
cpu->AF.b.hi=0;
SUB8(b);
break;
- }
+ }
case 0x45: /* RETN */
TSTATE(14);
@@ -1134,6 +1134,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
CALLBACK(eZ80_RETI,0);
cpu->IFF1=cpu->IFF2;
POP(cpu->PC);
+ cpu->priv->memptr.w=cpu->PC;
break;
case 0x4e: /* IM 0/1 */
@@ -1182,7 +1183,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
}
case 0x54: /* NEG */
- {
+ {
Z80Byte b;
TSTATE(8);
@@ -1191,7 +1192,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
cpu->AF.b.hi=0;
SUB8(b);
break;
- }
+ }
case 0x55: /* RETN */
TSTATE(14);
@@ -1245,7 +1246,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
}
case 0x5c: /* NEG */
- {
+ {
Z80Byte b;
TSTATE(8);
@@ -1254,7 +1255,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
cpu->AF.b.hi=0;
SUB8(b);
break;
- }
+ }
case 0x5d: /* RETN */
TSTATE(14);
@@ -1383,7 +1384,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
}
case 0x6c: /* NEG */
- {
+ {
Z80Byte b;
TSTATE(8);
@@ -1392,7 +1393,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
cpu->AF.b.hi=0;
SUB8(b);
break;
- }
+ }
case 0x6d: /* RETN */
TSTATE(14);
@@ -1458,7 +1459,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
break;
case 0x74: /* NEG */
- {
+ {
Z80Byte b;
TSTATE(8);
@@ -1467,7 +1468,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
cpu->AF.b.hi=0;
SUB8(b);
break;
- }
+ }
case 0x75: /* RETN */
TSTATE(14);
@@ -1519,7 +1520,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
break;
case 0x7c: /* NEG */
- {
+ {
Z80Byte b;
TSTATE(8);
@@ -1528,7 +1529,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
cpu->AF.b.hi=0;
SUB8(b);
break;
- }
+ }
case 0x7d: /* RETN */
TSTATE(14);
@@ -1597,7 +1598,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode)
if (cpu->BC.w!=1)
{
- PRIV->memptr.w=cpu->PC-2;
+ PRIV->memptr.w=cpu->PC-1;
}
LDI;
@@ -1781,14 +1782,14 @@ static void ShiftedDecodeCB(Z80 *cpu, Z80Byte opcode, Z80Relative offset)
SHIFTED_CB_ALU_BLOCK(0x30,SLL)
SHIFTED_CB_ALU_BLOCK(0x38,SRL)
- SHIFTED_CB_BITMANIP_BLOCK(0x40,BIT,BIT_MEMPTR,0)
- SHIFTED_CB_BITMANIP_BLOCK(0x48,BIT,BIT_MEMPTR,1)
- SHIFTED_CB_BITMANIP_BLOCK(0x50,BIT,BIT_MEMPTR,2)
- SHIFTED_CB_BITMANIP_BLOCK(0x58,BIT,BIT_MEMPTR,3)
- SHIFTED_CB_BITMANIP_BLOCK(0x60,BIT,BIT_MEMPTR,4)
- SHIFTED_CB_BITMANIP_BLOCK(0x68,BIT,BIT_MEMPTR,5)
- SHIFTED_CB_BITMANIP_BLOCK(0x70,BIT,BIT_MEMPTR,6)
- SHIFTED_CB_BITMANIP_BLOCK(0x78,BIT,BIT_MEMPTR,7)
+ SHIFTED_CB_BITMANIP_BLOCK(0x40,BIT_MEMPTR,BIT_MEMPTR,0)
+ SHIFTED_CB_BITMANIP_BLOCK(0x48,BIT_MEMPTR,BIT_MEMPTR,1)
+ SHIFTED_CB_BITMANIP_BLOCK(0x50,BIT_MEMPTR,BIT_MEMPTR,2)
+ SHIFTED_CB_BITMANIP_BLOCK(0x58,BIT_MEMPTR,BIT_MEMPTR,3)
+ SHIFTED_CB_BITMANIP_BLOCK(0x60,BIT_MEMPTR,BIT_MEMPTR,4)
+ SHIFTED_CB_BITMANIP_BLOCK(0x68,BIT_MEMPTR,BIT_MEMPTR,5)
+ SHIFTED_CB_BITMANIP_BLOCK(0x70,BIT_MEMPTR,BIT_MEMPTR,6)
+ SHIFTED_CB_BITMANIP_BLOCK(0x78,BIT_MEMPTR,BIT_MEMPTR,7)
SHIFTED_CB_BITMANIP_BLOCK(0x80,BIT_RES,BIT_RES,0)
SHIFTED_CB_BITMANIP_BLOCK(0x88,BIT_RES,BIT_RES,1)
diff --git a/z80_private.h b/z80_private.h
index 2583766..86adaee 100644
--- a/z80_private.h
+++ b/z80_private.h
@@ -246,11 +246,7 @@ static inline Z80Word PEEKW(Z80Word addr)
PRIV->memptr.w=cpu->PC; \
} while(0)
-#define NOCALL do \
- { \
- PRIV->memptr.w=PEEKW(cpu->PC); \
- cpu->PC+=2; \
- } while(0)
+#define NOCALL cpu->PC+=2
#define JP do \
{ \
@@ -266,13 +262,7 @@ static inline Z80Word PEEKW(Z80Word addr)
PRIV->memptr.w=cpu->PC; \
} while(0)
-#define NOJR do \
- { \
- Z80Word addr=cpu->PC+ \
- (Z80Relative)PEEK(cpu->PC)+1; \
- PRIV->memptr.w=addr; \
- cpu->PC++; \
- } while(0)
+#define NOJR cpu->PC++
#define OUT(P,V) do \
{ \