private void frmEmulate_FormClosing(object sender, FormClosingEventArgs e) { try { onHalt(); if (ExecuteThread.ThreadState == System.Threading.ThreadState.Running) { ExecuteThread.Suspend(); } ExecuteThread.Abort(); } catch { } ParsedOpcodeEvent.ParsedOpcode -= onParsedOpcode; CurrentOpcodeEvent.CurrentOpcode -= onCurrentOpcode; RegisterUpdateEvent.RegisterUpdate -= onRegisterUpdate; StackUpdateEvent.StackUpdate -= onStackUpdate; SetListviewBackColorEvent.SetListviewBackColor -= onSetListviewBackColor; ProcessStatusUpateEvent.ProcessUpdate -= onProcessStatusUpdate; FlagUpdateEvent.FlagUpdate -= onFlagUpdate; HaltEvent.Halt -= onHalt; if (virtualScreen != null) { virtualScreen.Close(); } asm = null; GlobalVariables.MainForm.DebugForm = null; }
private void toolStripButton2_Click(object sender, EventArgs e) { //try //{ if (DebugForm != null) { MessageBox.Show("Already debugging", "ASM.net", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TextboxHighlighting textbox = GetCurrentTextbox(); if (textbox != null) { AssemblerCompiler compiler = Build(textbox.Text, false, false); if (compiler.errors.Count == 0) { AssemblerExecute executor = new AssemblerExecute(); DebugForm = new frmEmulate(executor); executor.Execute(compiler.AssemblerBytes.ToArray()); DebugForm.Show(); } } /*} * catch(Exception ex) * { * MessageBox.Show(ex.StackTrace + "\r\n" + ex.Message); * }*/ }
public frmEmulate(AssemblerExecute asm) { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; ParsedOpcodeEvent.ParsedOpcode += onParsedOpcode; CurrentOpcodeEvent.CurrentOpcode += onCurrentOpcode; RegisterUpdateEvent.RegisterUpdate += onRegisterUpdate; StackUpdateEvent.StackUpdate += onStackUpdate; SetListviewBackColorEvent.SetListviewBackColor += onSetListviewBackColor; ProcessStatusUpateEvent.ProcessUpdate += onProcessStatusUpdate; FlagUpdateEvent.FlagUpdate += onFlagUpdate; this.asm = asm; virtualScreen = new VirtualScreen(new Size(0, 0)); StepDelay = 100; }