protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.F2) { State.StateSystem.saveState("save.state"); } if (keyData == Keys.F3) { State.StateSystem.loadState("save.state"); } if (keyData == Keys.F11) { DebugFunctions.Z80Form().DoStepInto(); DebugFunctions.CodeViewForm().GotoPC(); return(true); // indicate that you handled this keystroke } if (keyData == Keys.F10) { DebugFunctions.Z80Form().DoStepOver(); DebugFunctions.CodeViewForm().GotoPC(); return(true); // indicate that you handled this keystroke } if (keyData == Keys.F5) { DebugFunctions.Z80Form().DoStart(); return(true); // indicate that you handled this keystroke } if (keyData == Keys.F6) { DebugFunctions.Z80Form().DoStop(); return(true); // indicate that you handled this keystroke } // Call the base class return(base.ProcessCmdKey(ref msg, keyData)); }
////////////////////////////////////////////////////////////////////// // //@return true / if instruction was NOP // ////////////////////////////////////////////////////////////////////// public bool RunOneInstruction(bool bDebugEnabled) { if (m_started || m_runOnce || m_runToStepOver) { bool bCanRun = bDebugEnabled ? DebugFunctions.Z80Form().CanStep() : true; if (bCanRun && (m_curInstruction == null || m_curInstructionCurCycle >= m_curInstructionNbCycles)) { if (m_interruptsMgr.Update()) { return(true); } else { byte opcode = 0; opcode = GameBoy.Ram.ReadByteAt(m_PC); m_curInstruction = m_decoder.GetNextInstruction(); if (m_curInstruction == null) { ThrowNullInstructionException(opcode, m_PC, bDebugEnabled); return(true); } if (m_runOnce) { m_runOnce = false; m_curInstructionCurCycle = m_curInstructionNbCycles; } if (bDebugEnabled) { DebugFunctions.CallStackForm().AddToCallstack(); } ushort oldPc = m_PC; m_PC = m_curInstruction.Exec(m_PC); m_curInstructionNbCycles = m_curInstruction.GetCurNbCycles(oldPc); m_curInstructionCurCycle = 4; GameBoy.Cpu.IncInstructionNumber(); if (m_runToStepOver && opcode == 0xC9) { m_runToStepOver = false; Stop(); } } } else { if (!m_halted) { //on avance 4 cycles par 4 cycles car le timer est a 1Mhz, donc x4 pour les 4Mhz de la GB m_curInstructionCurCycle += 4; } } return(true); } return(false); }
////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// public void ReInitDebug() { #if DEBUG DebugFunctions.Z80Form().ResetStep(); #endif }