private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { a.clearRAM(); a = new Assembler85(); nextInstrAddress = Convert.ToInt32(textBoxMemoryStartAddress.Text, 16); // set the start address for debugger toolStripButtonStartDebug.Visible = true; // make the Start Debug button Visible try { a.changeProgramLength = richTextBox1.Lines.Length;// get the number of lines of program a.changeStartLocation = Convert.ToInt32(textBoxMemoryStartAddress.Text, 16); // change start location of the program in RAM a.FirstPass(richTextBox1.Lines); // run the first Pass of assembler usedRamSize = a.SecondPass(); // run second pass and store the used RAM showMemoryPanel(getTextBoxMemoryStartAddress(textBoxMemoryStartAddress.Text)); // show updated memory } catch (AssemblerErrorException) { } a.runProgram((Convert.ToInt32(textBoxMemoryStartAddress.Text, 16)), usedRamSize); // run the program // program will run correctly because // usedRamSize is always greater than instructions in RAM showMemoryPanel(Convert.ToInt32(textBoxMemoryStartAddress.Text, 16)); showPortPanel(0x00); updateRegisters(); // update register labels updateFlags(); // update falg labels } }
private void toolStripButtonStepIn_Click(object sender, EventArgs e) { if (nextInstrAddress != 0xffff) { nextInstrAddress = a.runProgram(nextInstrAddress, 1); updateRegisters(); // update register labels updateFlags(); // update flag labels if (nextInstrAddress != 0xffff && nextInstrAddress <= 0xffff) { changeColorRTBLine(a.RAMprogramLine[nextInstrAddress]); } if (richTextBox1.SelectionStart == 0) { a = new Assembler85(); nextInstrAddress = Convert.ToInt32(textBoxMemoryStartAddress.Text, 16); // set the start address for debugger toolStripButtonStartDebug.Visible = true; // make the Start Debug button Visible try { a.changeProgramLength = richTextBox1.Lines.Length;// get the number of lines of program a.changeStartLocation = Convert.ToInt32(textBoxMemoryStartAddress.Text, 16); // change start location of the program in RAM a.FirstPass(richTextBox1.Lines); // run the first Pass of assembler usedRamSize = a.SecondPass(); // run second pass and store the used RAM showMemoryPanel(getTextBoxMemoryStartAddress(textBoxMemoryStartAddress.Text)); // show updated memory } catch (AssemblerErrorException) { } toolStripButtonStepIn.Visible = false; MessageBox.Show(a.createListProgram(richTextBox1.Lines)); } } else { // labelLineNumber.Visible = true; // labelColumnNumber.Visible = true; MessageBox.Show("Debugging Over"); richTextBox1.Clear(); richTextBox1.Text = programBackup; toolStripButtonStepIn.Visible = false; toolStripButtonStartDebug.Visible = true; } }
private void toolStripButtonStartDebug_Click(object sender, EventArgs e) { a = new Assembler85(); nextInstrAddress = Convert.ToInt32(textBoxMemoryStartAddress.Text, 16); try { a.changeProgramLength = richTextBox1.Lines.Length;// get the number of lines of program a.changeStartLocation = Convert.ToInt32(textBoxMemoryStartAddress.Text, 16); // change start location of the program in RAM a.FirstPass(richTextBox1.Lines); // run the first Pass of assembler usedRamSize = a.SecondPass(); // run second pass and store the used RAM showMemoryPanel(getTextBoxMemoryStartAddress(textBoxMemoryStartAddress.Text)); // show updated memory } catch (AssemblerErrorException) { } nextInstrAddress = Convert.ToInt32(textBoxMemoryStartAddress.Text, 16); programBackup = richTextBox1.Text; // labelLineNumber.Visible = false; // labelColumnNumber.Visible = false; toolStripButtonStepIn.Visible = true; toolStripButtonStartDebug.Visible = false; changeColorRTBLine(a.RAMprogramLine[nextInstrAddress]); }