Beispiel #1
0
 void LoadProgram()
 {
     if (dlgOpen.ShowDialog() == DialogResult.OK)
     {
         List <byte> flashBytes = HexDecoder.Decode(dlgOpen.FileName); //Application.StartupPath + "\\sketch\\sketch.ino.eightanaloginputs.hex"
         SetStatusText(flashBytes.Count);
         AVR.SRAM = new byte[currentDevice.SRamSize + 0x100];
         avr      = new AVR()
         {
             FLASH = new AVR.Flash(currentDevice.FlashSize, flashBytes),
             GPR   = new AVR.Registers(currentDevice.GPRStart),
             IOR   = new AVR.Registers(currentDevice.IORStart)
         };
         isProgramLoaded = true;
         grp1.Enabled    = true;
         RefreshTextboxes();
         btnStep.Enabled = true;
         btnRun.Enabled  = true;
         btnStop.Enabled = true;
         isStarted       = true;
     }
 }
Beispiel #2
0
 void ClearAll()
 {
     if (isProgramLoaded)
     {
         avr.isHalted       = true;
         tmrRefresh.Enabled = false;
         if (cpuThread != null && cpuThread.IsAlive)
         {
             cpuThread.Abort();
         }
         txtStatus.Text   = "";
         txtPc.Text       = "";
         txtCycles.Text   = "";
         txtInstr.Text    = "";
         txtNextInst.Text = "";
         txtWords.Text    = "";
         txtSreg.Text     = "";
         grp1.Enabled     = false;
         ChangeLabelState(sregI, false);
         ChangeLabelState(sregT, false);
         ChangeLabelState(sregH, false);
         ChangeLabelState(sregS, false);
         ChangeLabelState(sregV, false);
         ChangeLabelState(sregN, false);
         ChangeLabelState(sregZ, false);
         ChangeLabelState(sregC, false);
         avr             = null;
         cpuThread       = null;
         isProgramLoaded = false;
         isStarted       = false;
     }
     else
     {
         MessageBox.Show("Please load a program first!", "No program", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }