z80: Fix remaining flags and WZ
This commit is contained in:
parent
275092528a
commit
afd1ba38d8
|
@ -505,9 +505,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
||||||
Regs[Z] = cur_instr[instr_pntr++];
|
Regs[Z] = cur_instr[instr_pntr++];
|
||||||
Regs[W] = 0;
|
Regs[W] = 0;
|
||||||
break;
|
break;
|
||||||
case REP_OP_I:
|
case REP_OP_I:
|
||||||
|
|
||||||
|
|
||||||
Write_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
|
Write_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
|
||||||
|
|
||||||
ushort temp4 = cur_instr[instr_pntr++];
|
ushort temp4 = cur_instr[instr_pntr++];
|
||||||
|
@ -519,30 +517,23 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
||||||
DEC8_Func(B);
|
DEC8_Func(B);
|
||||||
|
|
||||||
// take care of other flags
|
// take care of other flags
|
||||||
// taken from 'undocumented z80 documented'
|
// taken from 'undocumented z80 documented' and Fuse
|
||||||
FlagN = Regs[ALU].Bit(7);
|
FlagN = Regs[ALU].Bit(7);
|
||||||
FlagH = FlagC = (Regs[ALU] + (Regs[C] - 1) & 0xFF) > 0xFF;
|
FlagH = FlagC = ((Regs[ALU] + Regs[C] - 1) & 0xFF) < Regs[ALU];
|
||||||
FlagP = TableParity[((Regs[ALU] + (Regs[C] - 1) & 0xFF) & 7) ^ (Regs[B])];
|
FlagP = TableParity[((Regs[ALU] + Regs[C] - 1) & 7) ^ Regs[B]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INC16_Func(L, H);
|
INC16_Func(L, H);
|
||||||
|
|
||||||
TR16_Func(Z, W, C, B);
|
TR16_Func(Z, W, C, B);
|
||||||
INC16_Func(Z, W);
|
INC16_Func(Z, W);
|
||||||
DEC8_Func(B);
|
DEC8_Func(B);
|
||||||
|
|
||||||
//Read_Func(scratch, L, H);
|
|
||||||
if (opcode == 0xA2)
|
|
||||||
{
|
|
||||||
Console.Write(Regs[ALU]);
|
|
||||||
Console.Write(" ");
|
|
||||||
}
|
|
||||||
// take care of other flags
|
// take care of other flags
|
||||||
// taken from 'undocumented z80 documented'
|
// taken from 'undocumented z80 documented' and Fuse
|
||||||
FlagN = Regs[ALU].Bit(7);
|
FlagN = Regs[ALU].Bit(7);
|
||||||
FlagH = FlagC = (Regs[ALU] + (Regs[W]) & 0xFF) > 0xFF;
|
FlagH = FlagC = ((Regs[ALU] + Regs[C] + 1) & 0xFF) < Regs[ALU];
|
||||||
FlagP = TableParity[((Regs[ALU] + (Regs[W]) & 0xFF) & 7) ^ Regs[Z]];
|
FlagP = TableParity[((Regs[ALU] + Regs[C] + 1) & 7) ^ Regs[B]];
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeat_Op();
|
Repeat_Op();
|
||||||
|
|
Loading…
Reference in New Issue