OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [emuThor/] [source/] [frmMain.h] - Diff between revs 30 and 32

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 30 Rev 32
Line 4... Line 4...
#include <fstream>
#include <fstream>
#include <iomanip>
#include <iomanip>
#include <string>
#include <string>
#include <vcclr.h>
#include <vcclr.h>
#include <string.h>
#include <string.h>
 
#include <math.h>
#include "frmRegisters.h"
#include "frmRegisters.h"
//#include "frmBreakpoint.h"
#include "frmBreakpoints.h"
#include "frmScreen.h"
#include "frmScreen.h"
#include "frmKeyboard.h"
#include "frmKeyboard.h"
 
#include "frmUart.h"
 
#include "fmrFreeRun.h"
 
#include "frmPCHistory.h"
#include "About.h"
#include "About.h"
//#include "fmrPCS.h"
//#include "fmrPCS.h"
//#include "frmInterrupts.h"
#include "frmInterrupts.h"
//#include "frmStack.h"
#include "frmStack.h"
#include "frmMemory.h"
#include "frmMemory.h"
//#include "Disassem.h"
//#include "Disassem.h"
#include "clsCPU.h"
#include "clsCPU.h"
#include "clsPIC.h"
#include "clsPIC.h"
#include "clsDisassem.h"
#include "clsDisassem.h"
 
 
clsDisassem da;
clsDisassem da;
extern clsThor cpu1;
 
extern clsPIC pic1;
 
extern clsSystem system1;
extern clsSystem system1;
extern unsigned int breakpoints[30];
extern unsigned int breakpoints[30];
 
extern unsigned __int64 ibreakpoints[10];
 
extern bool ib_active[10];
 
bool isRunning;
 
bool quit;
 
bool stepout, stepover;
 
unsigned int step_depth, stepover_depth;
 
unsigned int stepoverBkpt;
 
unsigned int stepover_pc;
 
bool animate;
 
bool fullspeed;
 
bool runstop;
 
 
namespace emuThor {
namespace emuThor {
 
 
        using namespace System;
        using namespace System;
        using namespace System::ComponentModel;
        using namespace System::ComponentModel;
Line 47... Line 60...
                {
                {
                        InitializeComponent();
                        InitializeComponent();
                        //
                        //
                        //TODO: Add the constructor code here
                        //TODO: Add the constructor code here
                        //
                        //
                        frmKeyboard^ keyboardFrm = gcnew frmKeyboard();
                        fullspeed = false;
 
                        runstop = false;
 
                        stepout = false;
 
                        stepover = false;
 
                        animate = false;
 
                        isRunning = false;
 
                        mut = gcnew Mutex(false, "emuThor");
 
                        frmKeyboard^ keyboardFrm = gcnew frmKeyboard(mut);
                             keyboardFrm->Show();
                             keyboardFrm->Show();
                        frmScreen^ screenFrm = gcnew frmScreen();
                        frmScreen^ screenFrm = gcnew frmScreen(mut, "Main Screen");
 
                            screenFrm->pVidMem = &system1.VideoMem[0];
 
                                screenFrm->pVidDirty = &system1.VideoMemDirty[0];
                                screenFrm->Show();
                                screenFrm->Show();
 
                        frmScreen^ DBGScreenFrm = gcnew frmScreen(mut, "Debug Screen");
 
                            DBGScreenFrm->pVidMem = &system1.DBGVideoMem[0];
 
                                DBGScreenFrm->pVidDirty = &system1.DBGVideoMemDirty[0];
 
                                DBGScreenFrm->Show();
 
                        frmUart^ uartFrm = gcnew frmUart(mut);
 
                                uartFrm->Show();
 
                                uartFrm->WindowState = FormWindowState::Minimized;
 
//                      myThreadDelegate = gcnew ThreadStart(this, &frmMain::Run);
 
//                      myThread = gcnew Thread(myThreadDelegate);                      
 
//                      myThread->Start();
 
 
 
//                      this->SetStyle(ControlStyles::AllPaintingInWmPaint |
 
//                      ControlStyles::Opaque, true);
                }
                }
 
 
        protected:
        protected:
                /// <summary>
                /// <summary>
                /// Clean up any resources being used.
                /// Clean up any resources being used.
                /// </summary>
                /// </summary>
                ~frmMain()
                ~frmMain()
                {
                {
 
//                      this->backgroundWorker1->CancelAsync();
                        if (components)
                        if (components)
                        {
                        {
                                delete components;
                                delete components;
                        }
                        }
 
                        system1.quit = true;
                }
                }
        private: System::Windows::Forms::MenuStrip^  menuStrip1;
        private: System::Windows::Forms::MenuStrip^  menuStrip1;
        protected:
        protected:
        private: System::Windows::Forms::ToolStripMenuItem^  viewToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  viewToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  registersToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  registersToolStripMenuItem;
Line 90... Line 127...
        private: System::Windows::Forms::ListBox^  listBoxBytes;
        private: System::Windows::Forms::ListBox^  listBoxBytes;
        private: System::Windows::Forms::ListBox^  listBoxCode;
        private: System::Windows::Forms::ListBox^  listBoxCode;
        private: System::Windows::Forms::ToolStripMenuItem^  stepToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  stepToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  resetToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  resetToolStripMenuItem;
        private: System::Windows::Forms::Label^  lblLEDS;
        private: System::Windows::Forms::Label^  lblLEDS;
 
        private: System::Windows::Forms::ToolStripMenuItem^  breakpointsToolStripMenuItem;
 
        private: ThreadStart^ myThreadDelegate;
 
        private: Thread^ myThread;
 
        private: System::Windows::Forms::ToolStripMenuItem^  fullSpeedToolStripMenuItem;
 
        private: System::Windows::Forms::Timer^  timer1;
 
        private: System::Windows::Forms::ToolStripMenuItem^  animateFastToolStripMenuItem;
 
        private: System::Windows::Forms::TrackBar^  trackBar1;
 
        private: System::Windows::Forms::ToolStripMenuItem^  freeRunToolStripMenuItem;
 
        private: System::Windows::Forms::ToolStripMenuItem^  stackToolStripMenuItem;
 
        private: System::Windows::Forms::ToolStripMenuItem^  interruptToolStripMenuItem;
 
        private: System::Windows::Forms::ToolStripMenuItem^  pCHistoryToolStripMenuItem;
 
        private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
 
        private: Mutex^ mut;
 
        private: System::Windows::Forms::ToolStripButton^  toolStripButton8;
 
        private: System::Windows::Forms::ToolStripMenuItem^  keyboardToolStripMenuItem;
 
        private: System::Windows::Forms::Timer^  timer30;
 
        private: System::Windows::Forms::Timer^  timer1024;
 
 
 
        private: System::ComponentModel::IContainer^  components;
        private:
        private:
                /// <summary>
                /// <summary>
                /// Required designer variable.
                /// Required designer variable.
                /// </summary>
                /// </summary>
                System::ComponentModel::Container ^components;
 
 
 
#pragma region Windows Form Designer generated code
#pragma region Windows Form Designer generated code
                /// <summary>
                /// <summary>
                /// Required method for Designer support - do not modify
                /// Required method for Designer support - do not modify
                /// the contents of this method with the code editor.
                /// the contents of this method with the code editor.
                /// </summary>
                /// </summary>
                void InitializeComponent(void)
                void InitializeComponent(void)
                {
                {
 
                        this->components = (gcnew System::ComponentModel::Container());
                        System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(frmMain::typeid));
                        System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(frmMain::typeid));
                        this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
                        this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
                        this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->loadINTELHexFIleToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->loadINTELHexFIleToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->runToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->runToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->resetToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->resetToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->stepToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->stepToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->fullSpeedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->animateFastToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->freeRunToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->interruptToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->registersToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->registersToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->memoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->memoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->breakpointsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->stackToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->pCHistoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
 
                        this->keyboardToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
                        this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
                        this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton3 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton3 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton4 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton4 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton5 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton5 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton6 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton6 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton7 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripButton7 = (gcnew System::Windows::Forms::ToolStripButton());
 
                        this->toolStripButton8 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
                        this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
                        this->lblChecksumError = (gcnew System::Windows::Forms::Label());
                        this->lblChecksumError = (gcnew System::Windows::Forms::Label());
                        this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
                        this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
                        this->listBoxAdr = (gcnew System::Windows::Forms::ListBox());
                        this->listBoxAdr = (gcnew System::Windows::Forms::ListBox());
                        this->listBoxBytes = (gcnew System::Windows::Forms::ListBox());
                        this->listBoxBytes = (gcnew System::Windows::Forms::ListBox());
                        this->listBoxCode = (gcnew System::Windows::Forms::ListBox());
                        this->listBoxCode = (gcnew System::Windows::Forms::ListBox());
                        this->lblLEDS = (gcnew System::Windows::Forms::Label());
                        this->lblLEDS = (gcnew System::Windows::Forms::Label());
 
                        this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
 
                        this->trackBar1 = (gcnew System::Windows::Forms::TrackBar());
 
                        this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
 
                        this->timer30 = (gcnew System::Windows::Forms::Timer(this->components));
 
                        this->timer1024 = (gcnew System::Windows::Forms::Timer(this->components));
                        this->menuStrip1->SuspendLayout();
                        this->menuStrip1->SuspendLayout();
                        this->toolStrip1->SuspendLayout();
                        this->toolStrip1->SuspendLayout();
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
 
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->trackBar1))->BeginInit();
                        this->SuspendLayout();
                        this->SuspendLayout();
                        // 
                        // 
                        // menuStrip1
                        // menuStrip1
                        // 
                        // 
                        this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->fileToolStripMenuItem,
                        this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->fileToolStripMenuItem,
Line 161... Line 232...
                        this->loadINTELHexFIleToolStripMenuItem->Text = L"&Load INTEL Hex FIle";
                        this->loadINTELHexFIleToolStripMenuItem->Text = L"&Load INTEL Hex FIle";
                        this->loadINTELHexFIleToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::loadINTELHexFIleToolStripMenuItem_Click);
                        this->loadINTELHexFIleToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::loadINTELHexFIleToolStripMenuItem_Click);
                        // 
                        // 
                        // runToolStripMenuItem
                        // runToolStripMenuItem
                        // 
                        // 
                        this->runToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->resetToolStripMenuItem,
                        this->runToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->resetToolStripMenuItem,
                                this->stepToolStripMenuItem});
                                this->stepToolStripMenuItem, this->fullSpeedToolStripMenuItem, this->animateFastToolStripMenuItem, this->freeRunToolStripMenuItem,
 
                                this->interruptToolStripMenuItem});
                        this->runToolStripMenuItem->Name = L"runToolStripMenuItem";
                        this->runToolStripMenuItem->Name = L"runToolStripMenuItem";
                        this->runToolStripMenuItem->Size = System::Drawing::Size(40, 20);
                        this->runToolStripMenuItem->Size = System::Drawing::Size(40, 20);
                        this->runToolStripMenuItem->Text = L"&Run";
                        this->runToolStripMenuItem->Text = L"&Run";
                        // 
                        // 
                        // resetToolStripMenuItem
                        // resetToolStripMenuItem
                        // 
                        // 
                        this->resetToolStripMenuItem->Name = L"resetToolStripMenuItem";
                        this->resetToolStripMenuItem->Name = L"resetToolStripMenuItem";
                        this->resetToolStripMenuItem->Size = System::Drawing::Size(152, 22);
                        this->resetToolStripMenuItem->Size = System::Drawing::Size(143, 22);
                        this->resetToolStripMenuItem->Text = L"&Reset";
                        this->resetToolStripMenuItem->Text = L"&Reset";
                        this->resetToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::resetToolStripMenuItem_Click);
                        this->resetToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::resetToolStripMenuItem_Click);
                        // 
                        // 
                        // stepToolStripMenuItem
                        // stepToolStripMenuItem
                        // 
                        // 
                        this->stepToolStripMenuItem->Name = L"stepToolStripMenuItem";
                        this->stepToolStripMenuItem->Name = L"stepToolStripMenuItem";
                        this->stepToolStripMenuItem->Size = System::Drawing::Size(152, 22);
                        this->stepToolStripMenuItem->Size = System::Drawing::Size(143, 22);
                        this->stepToolStripMenuItem->Text = L"&Step";
                        this->stepToolStripMenuItem->Text = L"&Step";
                        this->stepToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::stepToolStripMenuItem_Click);
                        this->stepToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::stepToolStripMenuItem_Click);
                        // 
                        // 
 
                        // fullSpeedToolStripMenuItem
 
                        // 
 
                        this->fullSpeedToolStripMenuItem->Name = L"fullSpeedToolStripMenuItem";
 
                        this->fullSpeedToolStripMenuItem->Size = System::Drawing::Size(143, 22);
 
                        this->fullSpeedToolStripMenuItem->Text = L"&Full Speed";
 
                        this->fullSpeedToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::fullSpeedToolStripMenuItem_Click);
 
                        // 
 
                        // animateFastToolStripMenuItem
 
                        // 
 
                        this->animateFastToolStripMenuItem->Name = L"animateFastToolStripMenuItem";
 
                        this->animateFastToolStripMenuItem->Size = System::Drawing::Size(143, 22);
 
                        this->animateFastToolStripMenuItem->Text = L"&Animate Fast";
 
                        this->animateFastToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::animateFastToolStripMenuItem_Click);
 
                        // 
 
                        // freeRunToolStripMenuItem
 
                        // 
 
                        this->freeRunToolStripMenuItem->Name = L"freeRunToolStripMenuItem";
 
                        this->freeRunToolStripMenuItem->Size = System::Drawing::Size(143, 22);
 
                        this->freeRunToolStripMenuItem->Text = L"Free Run";
 
                        this->freeRunToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::freeRunToolStripMenuItem_Click);
 
                        // 
 
                        // interruptToolStripMenuItem
 
                        // 
 
                        this->interruptToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"interruptToolStripMenuItem.Image")));
 
                        this->interruptToolStripMenuItem->Name = L"interruptToolStripMenuItem";
 
                        this->interruptToolStripMenuItem->Size = System::Drawing::Size(143, 22);
 
                        this->interruptToolStripMenuItem->Text = L"&Interrupt";
 
                        this->interruptToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::interruptToolStripMenuItem_Click);
 
                        // 
                        // viewToolStripMenuItem
                        // viewToolStripMenuItem
                        // 
                        // 
                        this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->registersToolStripMenuItem,
                        this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->registersToolStripMenuItem,
                                this->memoryToolStripMenuItem});
                                this->memoryToolStripMenuItem, this->breakpointsToolStripMenuItem, this->stackToolStripMenuItem, this->pCHistoryToolStripMenuItem,
 
                                this->keyboardToolStripMenuItem});
                        this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
                        this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
                        this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
                        this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
                        this->viewToolStripMenuItem->Text = L"&View";
                        this->viewToolStripMenuItem->Text = L"&View";
                        // 
                        // 
                        // registersToolStripMenuItem
                        // registersToolStripMenuItem
                        // 
                        // 
                        this->registersToolStripMenuItem->Name = L"registersToolStripMenuItem";
                        this->registersToolStripMenuItem->Name = L"registersToolStripMenuItem";
                        this->registersToolStripMenuItem->Size = System::Drawing::Size(152, 22);
                        this->registersToolStripMenuItem->Size = System::Drawing::Size(136, 22);
                        this->registersToolStripMenuItem->Text = L"&Registers";
                        this->registersToolStripMenuItem->Text = L"&Registers";
                        this->registersToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::registersToolStripMenuItem_Click);
                        this->registersToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::registersToolStripMenuItem_Click);
                        // 
                        // 
                        // memoryToolStripMenuItem
                        // memoryToolStripMenuItem
                        // 
                        // 
                        this->memoryToolStripMenuItem->Name = L"memoryToolStripMenuItem";
                        this->memoryToolStripMenuItem->Name = L"memoryToolStripMenuItem";
                        this->memoryToolStripMenuItem->Size = System::Drawing::Size(152, 22);
                        this->memoryToolStripMenuItem->Size = System::Drawing::Size(136, 22);
                        this->memoryToolStripMenuItem->Text = L"&Memory";
                        this->memoryToolStripMenuItem->Text = L"&Memory";
                        this->memoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::memoryToolStripMenuItem_Click);
                        this->memoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::memoryToolStripMenuItem_Click);
                        // 
                        // 
 
                        // breakpointsToolStripMenuItem
 
                        // 
 
                        this->breakpointsToolStripMenuItem->Name = L"breakpointsToolStripMenuItem";
 
                        this->breakpointsToolStripMenuItem->Size = System::Drawing::Size(136, 22);
 
                        this->breakpointsToolStripMenuItem->Text = L"&Breakpoints";
 
                        this->breakpointsToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::breakpointsToolStripMenuItem_Click);
 
                        // 
 
                        // stackToolStripMenuItem
 
                        // 
 
                        this->stackToolStripMenuItem->Name = L"stackToolStripMenuItem";
 
                        this->stackToolStripMenuItem->Size = System::Drawing::Size(136, 22);
 
                        this->stackToolStripMenuItem->Text = L"&Stack";
 
                        this->stackToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::stackToolStripMenuItem_Click);
 
                        // 
 
                        // pCHistoryToolStripMenuItem
 
                        // 
 
                        this->pCHistoryToolStripMenuItem->Name = L"pCHistoryToolStripMenuItem";
 
                        this->pCHistoryToolStripMenuItem->Size = System::Drawing::Size(136, 22);
 
                        this->pCHistoryToolStripMenuItem->Text = L"&PC History";
 
                        this->pCHistoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::pCHistoryToolStripMenuItem_Click);
 
                        // 
 
                        // keyboardToolStripMenuItem
 
                        // 
 
                        this->keyboardToolStripMenuItem->Name = L"keyboardToolStripMenuItem";
 
                        this->keyboardToolStripMenuItem->Size = System::Drawing::Size(136, 22);
 
                        this->keyboardToolStripMenuItem->Text = L"&Keyboard";
 
                        this->keyboardToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::keyboardToolStripMenuItem_Click);
 
                        // 
                        // aboutToolStripMenuItem
                        // aboutToolStripMenuItem
                        // 
                        // 
                        this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
                        this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
                        this->aboutToolStripMenuItem->Size = System::Drawing::Size(52, 20);
                        this->aboutToolStripMenuItem->Size = System::Drawing::Size(52, 20);
                        this->aboutToolStripMenuItem->Text = L"&About";
                        this->aboutToolStripMenuItem->Text = L"&About";
                        this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::aboutToolStripMenuItem_Click);
                        this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::aboutToolStripMenuItem_Click);
                        // 
                        // 
                        // toolStrip1
                        // toolStrip1
                        // 
                        // 
                        this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(7) {this->toolStripButton1,
                        this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(8) {this->toolStripButton1,
                                this->toolStripButton2, this->toolStripButton3, this->toolStripButton4, this->toolStripButton5, this->toolStripButton6, this->toolStripButton7});
                                this->toolStripButton2, this->toolStripButton3, this->toolStripButton4, this->toolStripButton5, this->toolStripButton6, this->toolStripButton7,
 
                                this->toolStripButton8});
                        this->toolStrip1->Location = System::Drawing::Point(0, 24);
                        this->toolStrip1->Location = System::Drawing::Point(0, 24);
                        this->toolStrip1->Name = L"toolStrip1";
                        this->toolStrip1->Name = L"toolStrip1";
                        this->toolStrip1->Size = System::Drawing::Size(684, 25);
                        this->toolStrip1->Size = System::Drawing::Size(684, 25);
                        this->toolStrip1->TabIndex = 1;
                        this->toolStrip1->TabIndex = 1;
                        this->toolStrip1->Text = L"toolStrip1";
                        this->toolStrip1->Text = L"toolStrip1";
Line 238... Line 369...
                        this->toolStripButton2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton2.Image")));
                        this->toolStripButton2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton2.Image")));
                        this->toolStripButton2->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton2->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton2->Name = L"toolStripButton2";
                        this->toolStripButton2->Name = L"toolStripButton2";
                        this->toolStripButton2->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton2->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton2->Text = L"Step Over (Bounce)";
                        this->toolStripButton2->Text = L"Step Over (Bounce)";
 
                        this->toolStripButton2->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton2_Click);
                        // 
                        // 
                        // toolStripButton3
                        // toolStripButton3
                        // 
                        // 
                        this->toolStripButton3->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton3->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton3.Image")));
                        this->toolStripButton3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton3.Image")));
                        this->toolStripButton3->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton3->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton3->Name = L"toolStripButton3";
                        this->toolStripButton3->Name = L"toolStripButton3";
                        this->toolStripButton3->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton3->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton3->Text = L"Step Out Of";
                        this->toolStripButton3->Text = L"Step Out Of";
 
                        this->toolStripButton3->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton3_Click);
                        // 
                        // 
                        // toolStripButton4
                        // toolStripButton4
                        // 
                        // 
                        this->toolStripButton4->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton4->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton4->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton4.Image")));
                        this->toolStripButton4->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton4.Image")));
                        this->toolStripButton4->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton4->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton4->Name = L"toolStripButton4";
                        this->toolStripButton4->Name = L"toolStripButton4";
                        this->toolStripButton4->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton4->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton4->Text = L"Run";
                        this->toolStripButton4->Text = L"Run";
 
                        this->toolStripButton4->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton4_Click);
                        // 
                        // 
                        // toolStripButton5
                        // toolStripButton5
                        // 
                        // 
                        this->toolStripButton5->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton5->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton5->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton5.Image")));
                        this->toolStripButton5->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton5.Image")));
                        this->toolStripButton5->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton5->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton5->Name = L"toolStripButton5";
                        this->toolStripButton5->Name = L"toolStripButton5";
                        this->toolStripButton5->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton5->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton5->Text = L"Stop";
                        this->toolStripButton5->Text = L"Stop";
 
                        this->toolStripButton5->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton5_Click);
                        // 
                        // 
                        // toolStripButton6
                        // toolStripButton6
                        // 
                        // 
                        this->toolStripButton6->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton6->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton6->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton6.Image")));
                        this->toolStripButton6->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton6.Image")));
                        this->toolStripButton6->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton6->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton6->Name = L"toolStripButton6";
                        this->toolStripButton6->Name = L"toolStripButton6";
                        this->toolStripButton6->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton6->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton6->Text = L"Interrupt";
                        this->toolStripButton6->Text = L"Interrupt";
 
                        this->toolStripButton6->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton6_Click);
                        // 
                        // 
                        // toolStripButton7
                        // toolStripButton7
                        // 
                        // 
                        this->toolStripButton7->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton7->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton7->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton7.Image")));
                        this->toolStripButton7->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton7.Image")));
                        this->toolStripButton7->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton7->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton7->Name = L"toolStripButton7";
                        this->toolStripButton7->Name = L"toolStripButton7";
                        this->toolStripButton7->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton7->Size = System::Drawing::Size(23, 22);
                        this->toolStripButton7->Text = L"Breakpoints";
                        this->toolStripButton7->Text = L"Breakpoints";
 
                        this->toolStripButton7->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton7_Click);
 
                        // 
 
                        // toolStripButton8
 
                        // 
 
                        this->toolStripButton8->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
 
                        this->toolStripButton8->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton8.Image")));
 
                        this->toolStripButton8->ImageTransparentColor = System::Drawing::Color::Magenta;
 
                        this->toolStripButton8->Name = L"toolStripButton8";
 
                        this->toolStripButton8->Size = System::Drawing::Size(23, 22);
 
                        this->toolStripButton8->Text = L"Reset Button";
 
                        this->toolStripButton8->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton8_Click);
                        // 
                        // 
                        // openFileDialog1
                        // openFileDialog1
                        // 
                        // 
                        this->openFileDialog1->DefaultExt = L"hex";
                        this->openFileDialog1->DefaultExt = L"hex";
                        this->openFileDialog1->FileName = L"boot";
                        this->openFileDialog1->FileName = L"boot";
Line 295... Line 442...
                        // 
                        // 
                        // lblChecksumError
                        // lblChecksumError
                        // 
                        // 
                        this->lblChecksumError->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
                        this->lblChecksumError->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
                        this->lblChecksumError->AutoSize = true;
                        this->lblChecksumError->AutoSize = true;
                        this->lblChecksumError->Location = System::Drawing::Point(75, 522);
                        this->lblChecksumError->Location = System::Drawing::Point(75, 557);
                        this->lblChecksumError->Name = L"lblChecksumError";
                        this->lblChecksumError->Name = L"lblChecksumError";
                        this->lblChecksumError->Size = System::Drawing::Size(35, 13);
                        this->lblChecksumError->Size = System::Drawing::Size(35, 13);
                        this->lblChecksumError->TabIndex = 2;
                        this->lblChecksumError->TabIndex = 2;
                        this->lblChecksumError->Text = L"label1";
                        this->lblChecksumError->Text = L"label1";
                        // 
                        // 
                        // pictureBox1
                        // pictureBox1
                        // 
                        // 
                        this->pictureBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
                        this->pictureBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
                        this->pictureBox1->Location = System::Drawing::Point(12, 507);
                        this->pictureBox1->Location = System::Drawing::Point(12, 542);
                        this->pictureBox1->Name = L"pictureBox1";
                        this->pictureBox1->Name = L"pictureBox1";
                        this->pictureBox1->Size = System::Drawing::Size(218, 12);
                        this->pictureBox1->Size = System::Drawing::Size(218, 12);
                        this->pictureBox1->TabIndex = 3;
                        this->pictureBox1->TabIndex = 3;
                        this->pictureBox1->TabStop = false;
                        this->pictureBox1->TabStop = false;
                        this->pictureBox1->Click += gcnew System::EventHandler(this, &frmMain::pictureBox1_Click);
                        this->pictureBox1->Click += gcnew System::EventHandler(this, &frmMain::pictureBox1_Click);
                        this->pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &frmMain::pictureBox1_Paint);
                        this->pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &frmMain::pictureBox1_Paint);
                        // 
                        // 
                        // listBoxAdr
                        // listBoxAdr
                        // 
                        // 
                        this->listBoxAdr->FormattingEnabled = true;
                        this->listBoxAdr->FormattingEnabled = true;
                        this->listBoxAdr->Location = System::Drawing::Point(12, 52);
                        this->listBoxAdr->Location = System::Drawing::Point(12, 83);
                        this->listBoxAdr->Name = L"listBoxAdr";
                        this->listBoxAdr->Name = L"listBoxAdr";
                        this->listBoxAdr->Size = System::Drawing::Size(71, 433);
                        this->listBoxAdr->Size = System::Drawing::Size(71, 433);
                        this->listBoxAdr->TabIndex = 4;
                        this->listBoxAdr->TabIndex = 4;
                        // 
                        // 
                        // listBoxBytes
                        // listBoxBytes
                        // 
                        // 
                        this->listBoxBytes->FormattingEnabled = true;
                        this->listBoxBytes->FormattingEnabled = true;
                        this->listBoxBytes->Location = System::Drawing::Point(89, 52);
                        this->listBoxBytes->Location = System::Drawing::Point(89, 83);
                        this->listBoxBytes->Name = L"listBoxBytes";
                        this->listBoxBytes->Name = L"listBoxBytes";
                        this->listBoxBytes->Size = System::Drawing::Size(141, 433);
                        this->listBoxBytes->Size = System::Drawing::Size(141, 433);
                        this->listBoxBytes->TabIndex = 5;
                        this->listBoxBytes->TabIndex = 5;
                        // 
                        // 
                        // listBoxCode
                        // listBoxCode
                        // 
                        // 
                        this->listBoxCode->FormattingEnabled = true;
                        this->listBoxCode->FormattingEnabled = true;
                        this->listBoxCode->Location = System::Drawing::Point(236, 52);
                        this->listBoxCode->Location = System::Drawing::Point(236, 83);
                        this->listBoxCode->Name = L"listBoxCode";
                        this->listBoxCode->Name = L"listBoxCode";
                        this->listBoxCode->Size = System::Drawing::Size(327, 433);
                        this->listBoxCode->Size = System::Drawing::Size(327, 433);
                        this->listBoxCode->TabIndex = 6;
                        this->listBoxCode->TabIndex = 6;
                        // 
                        // 
                        // lblLEDS
                        // lblLEDS
                        // 
                        // 
                        this->lblLEDS->AutoSize = true;
                        this->lblLEDS->AutoSize = true;
                        this->lblLEDS->Location = System::Drawing::Point(275, 507);
                        this->lblLEDS->Location = System::Drawing::Point(271, 542);
                        this->lblLEDS->Name = L"lblLEDS";
                        this->lblLEDS->Name = L"lblLEDS";
                        this->lblLEDS->Size = System::Drawing::Size(40, 13);
                        this->lblLEDS->Size = System::Drawing::Size(40, 13);
                        this->lblLEDS->TabIndex = 7;
                        this->lblLEDS->TabIndex = 7;
                        this->lblLEDS->Text = L"lblLeds";
                        this->lblLEDS->Text = L"lblLeds";
                        // 
                        // 
 
                        // timer1
 
                        // 
 
                        this->timer1->Enabled = true;
 
                        this->timer1->Tick += gcnew System::EventHandler(this, &frmMain::timer1_Tick);
 
                        // 
 
                        // trackBar1
 
                        // 
 
                        this->trackBar1->Location = System::Drawing::Point(426, 32);
 
                        this->trackBar1->Maximum = 999999;
 
                        this->trackBar1->Minimum = 3;
 
                        this->trackBar1->Name = L"trackBar1";
 
                        this->trackBar1->Size = System::Drawing::Size(137, 45);
 
                        this->trackBar1->TabIndex = 8;
 
                        this->trackBar1->TickStyle = System::Windows::Forms::TickStyle::TopLeft;
 
                        this->trackBar1->Value = 10000;
 
                        this->trackBar1->Scroll += gcnew System::EventHandler(this, &frmMain::trackBar1_Scroll);
 
                        // 
 
                        // timer30
 
                        // 
 
                        this->timer30->Tick += gcnew System::EventHandler(this, &frmMain::timer30_Tick);
 
                        // 
 
                        // timer1024
 
                        // 
 
                        this->timer1024->Tick += gcnew System::EventHandler(this, &frmMain::timer1024_Tick);
 
                        // 
                        // frmMain
                        // frmMain
                        // 
                        // 
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->ClientSize = System::Drawing::Size(684, 548);
                        this->ClientSize = System::Drawing::Size(684, 583);
 
                        this->Controls->Add(this->trackBar1);
                        this->Controls->Add(this->lblLEDS);
                        this->Controls->Add(this->lblLEDS);
                        this->Controls->Add(this->listBoxCode);
                        this->Controls->Add(this->listBoxCode);
                        this->Controls->Add(this->listBoxBytes);
                        this->Controls->Add(this->listBoxBytes);
                        this->Controls->Add(this->listBoxAdr);
                        this->Controls->Add(this->listBoxAdr);
                        this->Controls->Add(this->pictureBox1);
                        this->Controls->Add(this->pictureBox1);
Line 366... Line 539...
                        this->menuStrip1->ResumeLayout(false);
                        this->menuStrip1->ResumeLayout(false);
                        this->menuStrip1->PerformLayout();
                        this->menuStrip1->PerformLayout();
                        this->toolStrip1->ResumeLayout(false);
                        this->toolStrip1->ResumeLayout(false);
                        this->toolStrip1->PerformLayout();
                        this->toolStrip1->PerformLayout();
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
 
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->trackBar1))->EndInit();
                        this->ResumeLayout(false);
                        this->ResumeLayout(false);
                        this->PerformLayout();
                        this->PerformLayout();
 
 
                }
                }
#pragma endregion
#pragma endregion
 
 
        private: System::Void registersToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
        private: System::Void registersToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                                 frmRegisters^ form = gcnew frmRegisters();
                                 frmRegisters^ form = gcnew frmRegisters(mut);
                                 form->Show();
                                 form->Show();
                         }
                         }
        private: System::Void loadINTELHexFIleToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
        private: System::Void loadINTELHexFIleToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->openFileDialog1->ShowDialog();
                         this->openFileDialog1->ShowDialog();
                         LoadIntelHexFile();
                         LoadIntelHexFile();
Line 455... Line 630...
                                                (b7 << 56)
                                                (b7 << 56)
                                                ;
                                                ;
                                }
                                }
                                if (!firstAdr)
                                if (!firstAdr)
                                        firstAdr = ad;
                                        firstAdr = ad;
 
                                mut->WaitOne();
                                system1.Write(ad, dat, 0xFF, 0);
                                system1.Write(ad, dat, 0xFF, 0);
 
                                mut->ReleaseMutex();
                                //system1.memory[ad>>2] = dat;
                                //system1.memory[ad>>2] = dat;
                                //sprintf(buf2,"%06X", ad);
                                //sprintf(buf2,"%06X", ad);
                                //str_ad = std::string(buf2);
                                //str_ad = std::string(buf2);
                                //sprintf(buf2,"%08X", dat);
                                //sprintf(buf2,"%08X", dat);
                                //str_insn = std::string(buf2);
                                //str_insn = std::string(buf2);
Line 479... Line 656...
                        else
                        else
                                this->lblChecksumError->Text = "Checksum OK";
                                this->lblChecksumError->Text = "Checksum OK";
                        System::Windows::Forms::Cursor::Current = System::Windows::Forms::Cursors::Default;
                        System::Windows::Forms::Cursor::Current = System::Windows::Forms::Cursors::Default;
                 }
                 }
private: System::Void memoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
private: System::Void memoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         frmMemory^ form = gcnew frmMemory;
                         frmMemory^ form = gcnew frmMemory(mut);
                         form->Show();
                         form->Show();
                 }
                 }
private: System::Void pictureBox1_Click(System::Object^  sender, System::EventArgs^  e) {
private: System::Void pictureBox1_Click(System::Object^  sender, System::EventArgs^  e) {
                 }
                 }
private: System::Void pictureBox1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
private: System::Void pictureBox1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
                         Graphics^ gr = e->Graphics;
                         Graphics^ gr = e->Graphics;
                         int h = pictureBox1->ClientSize.Height;
                         int h = pictureBox1->ClientSize.Height;
                         int w = h;
                         int w = h;
                         int nn,kk;
                         int nn,kk;
 
                         int lds;
 
 
 
                         mut->WaitOne();
 
                         lds = system1.leds;
 
                         mut->ReleaseMutex();
                         for (kk= 15, nn = 0; nn < 16; nn++, kk--) {
                         for (kk= 15, nn = 0; nn < 16; nn++, kk--) {
                                if (system1.leds & (1 << kk))
                                if (lds & (1 << kk))
                                        gr->FillEllipse(gcnew SolidBrush(Color::Green),System::Drawing::Rectangle(w*nn,0,w-1,h-1));
                                        gr->FillEllipse(gcnew SolidBrush(Color::Green),System::Drawing::Rectangle(w*nn,0,w-1,h-1));
                                else
                                else
                                        gr->FillEllipse(gcnew SolidBrush(Color::FromArgb(0xFF003000)),System::Drawing::Rectangle(w*nn,0,w-1,h-1));
                                        gr->FillEllipse(gcnew SolidBrush(Color::FromArgb(0xFF003000)),System::Drawing::Rectangle(w*nn,0,w-1,h-1));
                         }
                         }
                 }
                 }
Line 503... Line 685...
                         int nn,nb,kk;
                         int nn,nb,kk;
                         char buf2[100];
                         char buf2[100];
                         std::string dstr;
                         std::string dstr;
                         std::string buf;
                         std::string buf;
                         int adr[32];
                         int adr[32];
 
                         int adf;
 
 
                         listBoxAdr->Items->Clear();
                         listBoxAdr->Items->Clear();
                         listBoxBytes->Items->Clear();
                         listBoxBytes->Items->Clear();
                         listBoxCode->Items->Clear();
                         listBoxCode->Items->Clear();
                         for (nn = 0; nn < 32; nn++) {
                         for (nn = 0; nn < 32; nn++) {
Line 523... Line 706...
                                buf = std::string(buf2);
                                buf = std::string(buf2);
                                this->listBoxBytes->Items->Add(gcnew String(buf.c_str()));
                                this->listBoxBytes->Items->Add(gcnew String(buf.c_str()));
                                this->listBoxCode->Items->Add(gcnew String(dstr.c_str()));
                                this->listBoxCode->Items->Add(gcnew String(dstr.c_str()));
                         }
                         }
                         for (nn = 0; nn < 32; nn++) {
                         for (nn = 0; nn < 32; nn++) {
                                if (adr[nn]==cpu1.pc) {
                                 mut->WaitOne();
 
                                 adf = system1.cpu2.pc;
 
                                 mut->ReleaseMutex();
 
                                if (adr[nn]==adf) {
                                        this->listBoxAdr->SetSelected(nn,true);
                                        this->listBoxAdr->SetSelected(nn,true);
                                        this->listBoxBytes->SetSelected(nn,true);
                                        this->listBoxBytes->SetSelected(nn,true);
                                        this->listBoxCode->SetSelected(nn,true);
                                        this->listBoxCode->SetSelected(nn,true);
                                }
                                }
                         }
                         }
Line 536... Line 722...
                 }
                 }
private: System::Void resetToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
private: System::Void resetToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         Reset();
                         Reset();
                 }
                 }
private: void Reset() {
private: void Reset() {
 
                         int ad;
 
                         mut->WaitOne();
                         system1.Reset();
                         system1.Reset();
                         pic1.Reset();
                         ad = system1.cpu2.pc-32;
                         cpu1.Reset();
                         mut->ReleaseMutex();
                         UpdateListBoxes(PCIsInList(cpu1.pc-32));
                         UpdateListBoxes(PCIsInList(ad));
                 }
                 }
 
 
// Try and align the disassembled code with the current PC.
// Try and align the disassembled code with the current PC.
private: int PCIsInList(int as)
private: int PCIsInList(int as)
{
{
Line 553... Line 741...
        int ad = as;
        int ad = as;
 
 
        for (ad = as; ad > as-32; ad--) {
        for (ad = as; ad > as-32; ad--) {
                ae = ad;
                ae = ad;
                for (nn = 0; nn < 64; nn++) {
                for (nn = 0; nn < 64; nn++) {
                        if (ae==cpu1.pc)
            mut->WaitOne();
 
                        if (ae==system1.cpu2.pc) {
 
                                mut->ReleaseMutex();
                                return ad;
                                return ad;
 
                        }
 
                        mut->ReleaseMutex();
                dstr = da.Disassem(ae,&nb);
                dstr = da.Disassem(ae,&nb);
                ae += nb;
                ae += nb;
                }
                }
        }
        }
        return as;
        return as;
Line 566... Line 758...
 
 
private: void DoStepInto() {
private: void DoStepInto() {
//                       animate = false;
//                       animate = false;
//                       isRunning = false;
//                       isRunning = false;
                         char buf[100];
                         char buf[100];
                         cpu1.Step();
                         mut->WaitOne();
                         pic1.Step();
                         system1.Step();
                         UpdateListBoxes(PCIsInList(cpu1.pc-32));
                         mut->ReleaseMutex();
 
                         UpdateListBoxes(PCIsInList(system1.cpu2.pc-32));
                         sprintf(buf, "%04X", system1.leds);
                         sprintf(buf, "%04X", system1.leds);
                         lblLEDS->Text = gcnew String(buf);
                         lblLEDS->Text = gcnew String(buf);
                         pictureBox1->Refresh();
                         pictureBox1->Refresh();
                 }
                 }
 
private: void DoStopButton() {
 
                         mut->WaitOne();
 
                         animate = false;
 
                         isRunning = false;
 
//                       cpu2.brk = true;
 
                         fullspeed = false;
 
                         mut->ReleaseMutex();
 
                         this->fullSpeedToolStripMenuItem->Checked = false;
 
                         this->animateFastToolStripMenuItem->Checked = false;
 
                         this->timer1->Interval = 100;
 
                 }
private: System::Void toolStripButton1_Click(System::Object^  sender, System::EventArgs^  e) {
private: System::Void toolStripButton1_Click(System::Object^  sender, System::EventArgs^  e) {
                         DoStepInto();
                         DoStepInto();
                 }
                 }
private: System::Void openFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
private: System::Void openFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
                 }
                 }
private: System::Void aboutToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
private: System::Void aboutToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         About^ form = gcnew About;
                         About^ form = gcnew About;
                         form->Show();
                         form->Show();
                 }
                 }
 
private: System::Void breakpointsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         frmBreakpoints^ form = gcnew frmBreakpoints(mut);
 
                         form->ShowDialog();
 
                 }
 
private: System::Void fullSpeedToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         this->fullSpeedToolStripMenuItem->Checked = !this->fullSpeedToolStripMenuItem->Checked;
 
                         mut->WaitOne();
 
                         fullspeed = this->fullSpeedToolStripMenuItem->Checked;
 
                         mut->ReleaseMutex();
 
                         if (this->fullSpeedToolStripMenuItem->Checked)
 
                                 this->timer1->Interval = 1000;
 
                         else {
 
                                this->timer1->Interval = (int)sqrt((float)1000000-trackBar1->Value);
 
                         }
 
                         this->animateFastToolStripMenuItem->Checked = false;
 
                 }
 
private: System::Void toolStripButton3_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         mut->WaitOne();
 
                         step_depth = system1.cpu2.sub_depth;
 
                         stepout = true;
 
                         animate = false;
 
                         fullspeed = true;
 
                         isRunning = true;
 
                         mut->ReleaseMutex();
 
                         this->fullSpeedToolStripMenuItem->Checked = true;
 
                 }
 
private: System::Void animateFastToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         mut->WaitOne();
 
                         isRunning = false;
 
                         animate = true;
 
                         mut->ReleaseMutex();
 
                         this->timer1->Interval = 1;
 
                         this->trackBar1->Value = 3;
 
                         this->fullSpeedToolStripMenuItem->Checked = false;
 
                         this->animateFastToolStripMenuItem->Checked = true;
 
                 }
 
private: System::Void toolStripButton5_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         DoStopButton();
 
                 }
 
private: System::Void toolStripButton2_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         mut->WaitOne();
 
                         stepover_pc = system1.cpu2.pc;
 
                         stepover_depth = system1.cpu2.sub_depth;
 
                         stepover = true;
 
                         animate = false;
 
                         fullspeed = true;
 
                         isRunning = true;
 
                         mut->ReleaseMutex();
 
                         this->fullSpeedToolStripMenuItem->Checked = true;
 
                 }
 
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
 
                         static int tt = 0;
 
                         int xx;
 
 
 
                         if (this->timer1->Interval < 10)
 
                                 tt += 1;
 
                                 if (tt == 10 * this->timer1->Interval) {
 
                                         tt = 0;
 
                                         UpdateListBoxes(PCIsInList(system1.cpu2.pc-32));
 
                                 }
 
                         else
 
                                UpdateListBoxes(PCIsInList(system1.cpu2.pc-32));
 
//                      if (fullspeed) {
 
//                              for (xx = 0; xx < 100000; xx++)
 
//                                      RunCPU();
 
//                      }
 
                         mut->WaitOne();
 
                         if (!isRunning && animate) {
 
                                system1.Step();
 
                         }
 
                         mut->ReleaseMutex();
 
 
 
                         if (trigger30) {
 
                                 trigger30 = false;
 
                                 if (interval30==-1) {
 
                                         mut->WaitOne();
 
                                         system1.pic1.irq30Hz = true;
 
                                         mut->ReleaseMutex();
 
                                 }
 
                                 else {
 
                                         this->timer30->Interval = interval30;
 
                                         this->timer30->Enabled = true;
 
                                 }
 
                         }
 
                         if (trigger1024) {
 
                                 trigger1024 = false;
 
                                 if (interval1024==-1) {
 
                                         mut->WaitOne();
 
                                         system1.pic1.irq1024Hz = true;
 
                                         mut->ReleaseMutex();
 
                                 }
 
                                 else {
 
                                         this->timer1024->Interval = interval1024;
 
                                         this->timer1024->Enabled = true;
 
                                 }
 
                         }
 
 
 
                 }
 
private: System::Void toolStripButton4_Click(System::Object^  sender, System::EventArgs^  e) {
 
                        fmrFreeRun^ form = gcnew fmrFreeRun(mut);
 
                        form->Show();
 
                /*
 
                         if (fullspeed) {
 
                                 isRunning = true;
 
                         }
 
                         else {
 
                                 isRunning = false;
 
                                 animate = true;
 
                                 this->timer1->Interval = (int)(sqrt((float)1000000-trackBar1->Value));
 
                         }
 
                        */
 
                 }
 
private: System::Void toolStripButton7_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         frmBreakpoints^ form = gcnew frmBreakpoints(mut);
 
                         form->ShowDialog();
 
                 }
 
private: System::Void trackBar1_Scroll(System::Object^  sender, System::EventArgs^  e) {
 
                         animate = true;
 
                         isRunning = false;
 
//                       cpu2.brk = true;
 
                         fullspeed = false;
 
                         this->fullSpeedToolStripMenuItem->Checked = false;
 
//                       this->animateFastToolStripMenuItem->Checked = false;
 
                         this->timer1->Interval = (int)(sqrt((float)1000000-trackBar1->Value));
 
                 }
 
private: System::Void freeRunToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         fmrFreeRun^ form = gcnew fmrFreeRun(mut);
 
                         form->Show();
 
                 }
 
private: System::Void stackToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         frmStack^ form = gcnew frmStack(mut);
 
                         form->Show();
 
                 }
 
private: System::Void interruptToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         frmInterrupts^ form = gcnew frmInterrupts(mut);
 
                         form->ShowDialog();
 
                 }
 
private: System::Void toolStripButton6_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         frmInterrupts^ form = gcnew frmInterrupts(mut);
 
                         form->ShowDialog();
 
                 }
 
private: System::Void pCHistoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         frmPCHistory^ form = gcnew frmPCHistory(mut);
 
                         form->Show();
 
                 }
 
private: System::Void toolStripButton8_Click(System::Object^  sender, System::EventArgs^  e) {
 
                         Reset();
 
                 }
 
private: System::Void keyboardToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 
                        frmKeyboard^ keyboardFrm = gcnew frmKeyboard(mut);
 
                             keyboardFrm->Show();
 
                 }
 
private: System::Void timer30_Tick(System::Object^  sender, System::EventArgs^  e) {
 
                         mut->WaitOne();
 
                         system1.pic1.irq30Hz = true;
 
                         mut->ReleaseMutex();
 
                 }
 
private: System::Void timer1024_Tick(System::Object^  sender, System::EventArgs^  e) {
 
                         mut->WaitOne();
 
                         system1.pic1.irq1024Hz = true;
 
                         mut->ReleaseMutex();
 
                 }
};
};
}
}
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.