diff options
-rw-r--r-- | runall | 1 | ||||
-rw-r--r-- | rundoc | 1 | ||||
-rw-r--r-- | runprelim | 1 | ||||
-rw-r--r-- | z80.c | 2 | ||||
-rw-r--r-- | z80_decode.c | 22 |
5 files changed, 16 insertions, 11 deletions
@@ -2,3 +2,4 @@ i emucpm.hex l zexall.com 0x100 #D zexall.lbl r 0x100 +q @@ -4,3 +4,4 @@ l zexdoc.com 0x100 r 0x100 #p 0x100 #n +q @@ -1,3 +1,4 @@ i emucpm.hex l prelim.com 0x100 r 0x100 +q @@ -200,7 +200,7 @@ void Z80Reset(Z80 *cpu) PRIV->raise=FALSE; PRIV->nmi=FALSE; - PRIV->memptr.w = 0xffff; + PRIV->memptr.w = 0x0000; } diff --git a/z80_decode.c b/z80_decode.c index bc2a627..23cf44f 100644 --- a/z80_decode.c +++ b/z80_decode.c @@ -590,6 +590,10 @@ do { \ b=PEEK(cpu->HL.w); \ \ CMP8(b); \ + Z80Byte a1=cpu->AF.b.hi-b-(IS_H?1:0); \ + \ + if (a1&2) SETFLAG(B5_Z80); else CLRFLAG(B5_Z80); \ + if (a1&B3_Z80) SETFLAG(B3_Z80); else CLRFLAG(B3_Z80); \ \ if (c) \ SETFLAG(C_Z80); \ @@ -613,7 +617,11 @@ do { \ b=PEEK(cpu->HL.w); \ \ CMP8(b); \ + Z80Byte a1=cpu->AF.b.hi-b-(IS_H?1:0); \ \ + if (a1&2) SETFLAG(B5_Z80); else CLRFLAG(B5_Z80); \ + if (a1&B3_Z80) SETFLAG(B3_Z80); else CLRFLAG(B3_Z80); \ +\ if (c) \ SETFLAG(C_Z80); \ else \ @@ -1596,17 +1604,14 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) case 0xb0: /* LDIR */ TSTATE(16); - if (cpu->BC.w!=1) - { - PRIV->memptr.w=cpu->PC-1; - } - LDI; if (cpu->BC.w) { TSTATE(5); cpu->PC-=2; + SETHIDDEN((cpu->PC)>>8); + PRIV->memptr.w=cpu->PC+1; } break; @@ -1650,17 +1655,14 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) case 0xb8: /* LDDR */ TSTATE(16); - if (cpu->BC.w!=1) - { - PRIV->memptr.w=cpu->PC-1; - } - LDD; if (cpu->BC.w) { TSTATE(5); cpu->PC-=2; + SETHIDDEN((cpu->PC)>>8); + PRIV->memptr.w=cpu->PC+1; } break; |