diff -Nru src/emu/cpu/z80/z80.c 2/src/emu/cpu/z80/z80.c --- src/emu/cpu/z80/z80.c 2008-12-08 16:13:46.000000000 +0100 +++ src/emu/cpu/z80/z80.c 2008-12-09 15:56:22.000000000 +0100 @@ -1,7 +1,7 @@ /***************************************************************************** * * z80.c - * Portable Z80 emulator V3.8 + * Portable Z80 emulator V3.9 * * Copyright Juergen Buchmueller, all rights reserved. * @@ -17,6 +17,12 @@ * terms of its usage and license at any time, including retroactively * - This entire notice must remain in the source code. * + * Changes in 3.9 + * - Fixed undocumented X and Y flags handling on SCF and CCF opcodes. [hap] + * It's slightly different depending on Z80 brand: + * SGS/SHARP/ZiLOG: (z80->A & (YF|XF)) | (z80->F & (YF|XF)) == implemented + * NEC: z80->A & z80->F & (YF|XF) + * T9769C (Toshiba IC in MSX turboR): (z80->A & XF) | (z80->F & (YF|XF)) * Changes in 3.8 [Miodrag Milanovic] * - Added MEMPTR register (according to informations provided * by Vladimir Kladov @@ -2959,7 +2965,7 @@ OP(op,34) { WM(z80, z80->HL, INC(z80, RM(z80, z80->HL))); } /* INC (HL) */ OP(op,35) { WM(z80, z80->HL, DEC(z80, RM(z80, z80->HL))); } /* DEC (HL) */ OP(op,36) { WM(z80, z80->HL, ARG(z80)); } /* LD (HL),n */ -OP(op,37) { z80->F = (z80->F & (SF|ZF|PF)) | CF | (z80->A & (YF|XF)); } /* SCF */ +OP(op,37) { z80->F = (z80->F & (SF|ZF|YF|XF|PF)) | CF | (z80->A & (YF|XF)); } /* SCF */ OP(op,38) { JR_COND(z80, z80->F & CF, 0x38); } /* JR C,o */ OP(op,39) { ADD16(z80, hl, sp); } /* ADD HL,SP */ @@ -2968,7 +2974,7 @@ OP(op,3c) { z80->A = INC(z80, z80->A); } /* INC A */ OP(op,3d) { z80->A = DEC(z80, z80->A); } /* DEC A */ OP(op,3e) { z80->A = ARG(z80); } /* LD A,n */ -OP(op,3f) { z80->F = ((z80->F&(SF|ZF|PF|CF))|((z80->F&CF)<<4)|(z80->A&(YF|XF)))^CF; } /* CCF */ +OP(op,3f) { z80->F = ((z80->F&(SF|ZF|YF|XF|PF|CF))|((z80->F&CF)<<4)|(z80->A&(YF|XF)))^CF; } /* CCF */ OP(op,40) { } /* LD B,B */ OP(op,41) { z80->B = z80->C; } /* LD B,C */