diff options
Diffstat (limited to 'z80_decode.c')
-rw-r--r-- | z80_decode.c | 22 |
1 files changed, 12 insertions, 10 deletions
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; |