Exemple #1
0
 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
     }
 }
Exemple #2
0
 public Form1()
 {
     a = new Assembler85();   // create an object for assembler
     InitializeComponent();
     showMemoryPanel(0x2000); // draw memory panel from location 0x2000
     showPortPanel(0x00);     // draw port panel from location 0x00
     programBackup = richTextBox1.Text;
 }
Exemple #3
0
 private void newFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     a = new Assembler85();
     showMemoryPanel(0x2000);
     showPortPanel(0x00);
     updateRegisters();
     updateFlags();
     toolStripButtonStartDebug.Visible = false;
     toolStripButtonStepIn.Visible     = false;
     richTextBox1.Clear();
 }
Exemple #4
0
 private void resetSimulatorToolStripMenuItem_Click(object sender, EventArgs e)
 {
     programBackup = richTextBox1.Text;
     a             = new Assembler85();
     showMemoryPanel(0x2000);
     showPortPanel(0x00);
     updateRegisters();
     updateFlags();
     toolStripButtonStartDebug.Visible = false;
     toolStripButtonStepIn.Visible     = false;
     richTextBox1.Text = programBackup;
 }
Exemple #5
0
 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;
     }
 }
Exemple #6
0
 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]);
 }