private void RegisterBox_KeyPress(object sender, KeyPressEventArgs e) { if (_debugger == null) { return; } if (e.KeyChar == (char)Keys.Enter) { IZ80 cpu = _debugger.CPU; cpu.AF = Convert.ToUInt16(afBox.Text, 16); cpu.BC = Convert.ToUInt16(bcBox.Text, 16); cpu.DE = Convert.ToUInt16(deBox.Text, 16); cpu.HL = Convert.ToUInt16(hlBox.Text, 16); cpu.IX = Convert.ToUInt16(ixBox.Text, 16); cpu.IY = Convert.ToUInt16(iyBox.Text, 16); cpu.AFP = Convert.ToUInt16(afpBox.Text, 16); cpu.BCP = Convert.ToUInt16(bcpBox.Text, 16); cpu.DEP = Convert.ToUInt16(depBox.Text, 16); cpu.HLP = Convert.ToUInt16(hlpBox.Text, 16); cpu.SP = Convert.ToUInt16(spBox.Text, 16); cpu.PC = Convert.ToUInt16(pcBox.Text, 16); UpdateRegisters(); } if (e.KeyChar == (char)Keys.Cancel || e.KeyChar == (char)Keys.Escape) { UpdateRegisters(); } }
private void zflagBox_CheckedChanged(object sender, EventArgs e) { if (_updating || _debugger == null) { return; } IZ80 cpu = _debugger.CPU; ushort f = (ushort)(Convert.ToUInt16(cflagBox.Checked) + Convert.ToUInt16(nflagBox.Checked) * 2 + Convert.ToUInt16(pvflagBox.Checked) * 4 + 8 + Convert.ToUInt16(hcflagBox.Checked) * 16 + 32 + Convert.ToUInt16(zflagBox.Checked) * 64 + Convert.ToUInt16(sflagBox.Checked) * 128); cpu.AF &= 0xFF00; cpu.AF |= f; UpdateFlags(); }
private void UpdateRegisters() { IZ80 cpu = _debugger.CPU; afBox.Text = cpu.AF.ToString("X4"); afpBox.Text = cpu.AFP.ToString("X4"); bcBox.Text = cpu.BC.ToString("X4"); bcpBox.Text = cpu.BCP.ToString("X4"); deBox.Text = cpu.DE.ToString("X4"); depBox.Text = cpu.DEP.ToString("X4"); hlBox.Text = cpu.HL.ToString("X4"); hlpBox.Text = cpu.HLP.ToString("X4"); ixBox.Text = cpu.IX.ToString("X4"); iyBox.Text = cpu.IY.ToString("X4"); pcBox.Text = cpu.PC.ToString("X4"); spBox.Text = cpu.SP.ToString("X4"); }
private static bool EvalConditions(IZ80 cpu, BreakCondition condition) { bool isTrue = true; if (condition.A >= 0xFFFF) { isTrue &= (cpu.AF >> 16) == (ushort)(condition.A >> 8); } if (condition.B >= 0xFFFF) { isTrue &= (cpu.BC >> 16) == (ushort)(condition.B >> 8); } if (condition.C >= 0xFFFF) { isTrue &= (cpu.BC & 0xFF) == (ushort)(condition.C >> 16); } if (condition.D >= 0xFFFF) { isTrue &= (cpu.DE >> 16) == (ushort)(condition.D >> 8); } if (condition.E >= 0xFFFF) { isTrue &= (cpu.DE & 0xFF) == (ushort)(condition.E >> 16); } if (condition.H >= 0xFFFF) { isTrue &= cpu.HL >> 8 == (ushort)(condition.H >> 16); } if (condition.L >= 0xFFFF) { isTrue &= (cpu.HL & 0xFF) == (ushort)(condition.L >> 16); } if (condition.IX >= 0xFFFF) { isTrue &= cpu.IX == (ushort)condition.IX; } if (condition.IY >= 0xFFFF) { isTrue &= cpu.IY == (ushort)(condition.IY >> 16); } if (condition.SP >= 0xFFFF) { isTrue &= cpu.SP == (ushort)(condition.SP >> 16); } if (condition.CFlag > 2) { isTrue &= (cpu.AF & 1) == condition.CFlag; } if (condition.NFlag >= 2) { isTrue &= (cpu.AF & 2) == condition.NFlag; } if (condition.PVFlag >= 2) { isTrue &= (cpu.AF & 4) == condition.PVFlag; } if (condition.HFlag >= 2) { isTrue &= (cpu.AF & 16) == condition.HFlag; } if (condition.ZFlag >= 2) { isTrue &= (cpu.AF & 64) == condition.ZFlag; } if (condition.SFlag >= 2) { isTrue &= (cpu.AF & 128) == condition.SFlag; } return(isTrue); }
public bool EvalulateAllConditions(IZ80 cpu) { return(_breakConditions.All(condition => EvalConditions(cpu, condition))); }