z80: minor cleanups and bug fixes

This commit is contained in:
alyosha-tas 2018-09-30 10:02:50 -05:00 committed by GitHub
parent 4cdcb80721
commit 7ba4e8a437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 26 deletions

View File

@ -108,8 +108,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
private void REG_OP_IR(ushort operation, ushort dest, ushort src)
{
cur_instr = new ushort[]
{operation, dest, src,
SET_FL_IR, dest };
{IDLE,
SET_FL_IR, dest, src };
BUSRQ = new ushort[] { 0, I };
MEMRQ = new ushort[] { 0, 0 };
@ -413,11 +413,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
WR_DEC, SPl, SPh, PCh,
RST, n,
WAIT,
WR_TR_PC, SPl, SPh, PCl,
TR16, PCl, PCh, Z, W,
WAIT,
OP_F,
OP };
WR_TR_PC, SPl, SPh, PCl };
BUSRQ = new ushort[] { 0, I, SPh, 0, 0, SPh, 0, 0 };
MEMRQ = new ushort[] { 0, 0, SPh, 0, 0, SPh, 0, 0 };

View File

@ -81,14 +81,12 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
public const ushort REP_OP_I = 66;
public const ushort REP_OP_O = 67;
public const ushort IN_A_N_INC = 68;
public const ushort IRQ_S_F = 69; // called when IRQ line is polled
public const ushort NMI_S_F = 70; // called for NMI
public const ushort RD_INC_TR_PC = 71; // transfer WZ to PC after read
public const ushort WR_TR_PC = 72; // transfer WZ to PC after write
public const ushort OUT_INC = 73;
public const ushort IN_INC = 74;
public const ushort WR_INC_WA = 75; // A -> W after WR_INC
public const ushort RD_OP = 76;
public const ushort RD_INC_TR_PC = 69; // transfer WZ to PC after read
public const ushort WR_TR_PC = 70; // transfer WZ to PC after write
public const ushort OUT_INC = 71;
public const ushort IN_INC = 72;
public const ushort WR_INC_WA = 73; // A -> W after WR_INC
public const ushort RD_OP = 74;
// non-state variables
public ushort Ztemp1, Ztemp2, Ztemp3, Ztemp4;
@ -176,7 +174,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
// do nothing
break;
case OP:
// should never reach here
break;
case OP_F:
@ -381,6 +379,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
EXCH_16_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++], cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
break;
case PREFIX:
ushort src_t = PRE_SRC;
NO_prefix = false;
if (PRE_SRC == CBpre) { CB_prefix = true; }
if (PRE_SRC == EXTDpre) { EXTD_prefix = true; }
@ -404,7 +404,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
I_skip = true;
// for prefetched case, the PC stays on the BUS one cycle longer
if ((PRE_SRC == IXCBpre) || (PRE_SRC == IXCBpre)) { BUSRQ[0] = PCh; }
if ((src_t == IXCBpre) || (src_t == IXCBpre)) { BUSRQ[0] = PCh; }
break;
case ASGN:
@ -508,7 +508,9 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
}
break;
case SET_FL_IR:
SET_FL_IR_Func(cur_instr[instr_pntr++]);
ushort dest_t = cur_instr[instr_pntr++];
TR_Func(dest_t, cur_instr[instr_pntr++]);
SET_FL_IR_Func(dest_t);
break;
case FTCH_DB:
FTCH_DB_Func();
@ -625,14 +627,6 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
I_skip = true;
}
break;
case IRQ_S_F:
break;
case NMI_S_F:
break;
}
if (I_skip)