summaryrefslogtreecommitdiff
path: root/z80_decode.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2006-08-21 22:34:54 +0000
committerIan C <ianc@noddybox.co.uk>2006-08-21 22:34:54 +0000
commit0034381aac6413def6960c7e4a1f8b84b5538549 (patch)
treee7b4cfca4e1148d03a1c00a252330e2099a277ce /z80_decode.c
parentf91ac106f900280537c0cf38ce3ab082eb4f9a33 (diff)
Edits
Diffstat (limited to 'z80_decode.c')
-rw-r--r--z80_decode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/z80_decode.c b/z80_decode.c
index 6bb34f5..c5688c8 100644
--- a/z80_decode.c
+++ b/z80_decode.c
@@ -210,8 +210,10 @@ static Z80Word ADC16(Z80 *cpu, Z80Word REG, Z80Word VAL)
{
Z80Val w;
w=REG+(Z80Val)VAL+CARRY;
- cpu->AF.b[LO]&=(S_Z80|Z_Z80|V_Z80);
+ cpu->AF.b[LO]=0;
+ if ((w&0xffff)==0) cpu->AF.b[LO]=Z_Z80;
if (w>0xffff) cpu->AF.b[LO]|=C_Z80;
+ if ((VAL^REG^0x8000)&(REG^w)&0x8000) cpu->AF.b[LO]|=P_Z80;
if ((REG^w^VAL)&0x1000) cpu->AF.b[LO]|=H_Z80;
SETHIDDEN(w>>8);
return w;
@@ -223,11 +225,12 @@ static Z80Word SBC16(Z80 *cpu, Z80Word REG, Z80Word VAL)
Z80Val w;
w=REG-(Z80Val)VAL-CARRY;
cpu->AF.b[LO]=N_Z80;
+ if ((w&0xffff)==0) cpu->AF.b[LO]=Z_Z80;
if (w&0x8000) cpu->AF.b[LO]|=S_Z80;
if ((w&0xffff)==0) cpu->AF.b[LO]|=Z_Z80;
if (w>0xffff) cpu->AF.b[LO]|=C_Z80;
- if ((REG^w^VAL)&0x1000) cpu->AF.b[LO]|=H_Z80;
if ((VAL^REG)&(VAL^w)&0x8000) cpu->AF.b[LO]|=P_Z80;
+ if ((REG^w^VAL)&0x1000) cpu->AF.b[LO]|=H_Z80;
SETHIDDEN(w>>8);
return w;
}