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

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [emuThor/] [source/] [frmMain.h] - Blame information for rev 32

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 robfinch
#pragma once
2
#include <Windows.h>
3
#include <iostream>
4
#include <fstream>
5
#include <iomanip>
6
#include <string>
7
#include <vcclr.h>
8
#include <string.h>
9 32 robfinch
#include <math.h>
10 30 robfinch
#include "frmRegisters.h"
11 32 robfinch
#include "frmBreakpoints.h"
12 30 robfinch
#include "frmScreen.h"
13
#include "frmKeyboard.h"
14 32 robfinch
#include "frmUart.h"
15
#include "fmrFreeRun.h"
16
#include "frmPCHistory.h"
17 30 robfinch
#include "About.h"
18
//#include "fmrPCS.h"
19 32 robfinch
#include "frmInterrupts.h"
20
#include "frmStack.h"
21 30 robfinch
#include "frmMemory.h"
22
//#include "Disassem.h"
23
#include "clsCPU.h"
24
#include "clsPIC.h"
25
#include "clsDisassem.h"
26
 
27
clsDisassem da;
28
extern clsSystem system1;
29
extern unsigned int breakpoints[30];
30 32 robfinch
extern unsigned __int64 ibreakpoints[10];
31
extern bool ib_active[10];
32
bool isRunning;
33
bool quit;
34
bool stepout, stepover;
35
unsigned int step_depth, stepover_depth;
36
unsigned int stepoverBkpt;
37
unsigned int stepover_pc;
38
bool animate;
39
bool fullspeed;
40
bool runstop;
41 30 robfinch
 
42
namespace emuThor {
43
 
44
        using namespace System;
45
        using namespace System::ComponentModel;
46
        using namespace System::Collections;
47
        using namespace System::Windows::Forms;
48
        using namespace System::Data;
49
        using namespace System::Drawing;
50
        using namespace System::Runtime::InteropServices;
51
        using namespace System::Threading;
52
 
53
        /// <summary>
54
        /// Summary for frmMain
55
        /// </summary>
56
        public ref class frmMain : public System::Windows::Forms::Form
57
        {
58
        public:
59
                frmMain(void)
60
                {
61
                        InitializeComponent();
62
                        //
63
                        //TODO: Add the constructor code here
64
                        //
65 32 robfinch
                        fullspeed = false;
66
                        runstop = false;
67
                        stepout = false;
68
                        stepover = false;
69
                        animate = false;
70
                        isRunning = false;
71
                        mut = gcnew Mutex(false, "emuThor");
72
                        frmKeyboard^ keyboardFrm = gcnew frmKeyboard(mut);
73 30 robfinch
                             keyboardFrm->Show();
74 32 robfinch
                        frmScreen^ screenFrm = gcnew frmScreen(mut, "Main Screen");
75
                            screenFrm->pVidMem = &system1.VideoMem[0];
76
                                screenFrm->pVidDirty = &system1.VideoMemDirty[0];
77 30 robfinch
                                screenFrm->Show();
78 32 robfinch
                        frmScreen^ DBGScreenFrm = gcnew frmScreen(mut, "Debug Screen");
79
                            DBGScreenFrm->pVidMem = &system1.DBGVideoMem[0];
80
                                DBGScreenFrm->pVidDirty = &system1.DBGVideoMemDirty[0];
81
                                DBGScreenFrm->Show();
82
                        frmUart^ uartFrm = gcnew frmUart(mut);
83
                                uartFrm->Show();
84
                                uartFrm->WindowState = FormWindowState::Minimized;
85
//                      myThreadDelegate = gcnew ThreadStart(this, &frmMain::Run);
86
//                      myThread = gcnew Thread(myThreadDelegate);                      
87
//                      myThread->Start();
88
 
89
//                      this->SetStyle(ControlStyles::AllPaintingInWmPaint |
90
//                      ControlStyles::Opaque, true);
91 30 robfinch
                }
92
 
93
        protected:
94
                /// <summary>
95
                /// Clean up any resources being used.
96
                /// </summary>
97
                ~frmMain()
98
                {
99 32 robfinch
//                      this->backgroundWorker1->CancelAsync();
100 30 robfinch
                        if (components)
101
                        {
102
                                delete components;
103
                        }
104 32 robfinch
                        system1.quit = true;
105 30 robfinch
                }
106
        private: System::Windows::Forms::MenuStrip^  menuStrip1;
107
        protected:
108
        private: System::Windows::Forms::ToolStripMenuItem^  viewToolStripMenuItem;
109
        private: System::Windows::Forms::ToolStripMenuItem^  registersToolStripMenuItem;
110
        private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
111
        private: System::Windows::Forms::ToolStripMenuItem^  runToolStripMenuItem;
112
        private: System::Windows::Forms::ToolStripMenuItem^  aboutToolStripMenuItem;
113
        private: System::Windows::Forms::ToolStrip^  toolStrip1;
114
        private: System::Windows::Forms::ToolStripButton^  toolStripButton1;
115
        private: System::Windows::Forms::ToolStripButton^  toolStripButton2;
116
        private: System::Windows::Forms::ToolStripButton^  toolStripButton3;
117
        private: System::Windows::Forms::ToolStripButton^  toolStripButton4;
118
        private: System::Windows::Forms::ToolStripButton^  toolStripButton5;
119
        private: System::Windows::Forms::ToolStripButton^  toolStripButton6;
120
        private: System::Windows::Forms::ToolStripButton^  toolStripButton7;
121
        private: System::Windows::Forms::ToolStripMenuItem^  loadINTELHexFIleToolStripMenuItem;
122
        private: System::Windows::Forms::OpenFileDialog^  openFileDialog1;
123
        private: System::Windows::Forms::Label^  lblChecksumError;
124
        private: System::Windows::Forms::ToolStripMenuItem^  memoryToolStripMenuItem;
125
        private: System::Windows::Forms::PictureBox^  pictureBox1;
126
        private: System::Windows::Forms::ListBox^  listBoxAdr;
127
        private: System::Windows::Forms::ListBox^  listBoxBytes;
128
        private: System::Windows::Forms::ListBox^  listBoxCode;
129
        private: System::Windows::Forms::ToolStripMenuItem^  stepToolStripMenuItem;
130
        private: System::Windows::Forms::ToolStripMenuItem^  resetToolStripMenuItem;
131
        private: System::Windows::Forms::Label^  lblLEDS;
132 32 robfinch
        private: System::Windows::Forms::ToolStripMenuItem^  breakpointsToolStripMenuItem;
133
        private: ThreadStart^ myThreadDelegate;
134
        private: Thread^ myThread;
135
        private: System::Windows::Forms::ToolStripMenuItem^  fullSpeedToolStripMenuItem;
136
        private: System::Windows::Forms::Timer^  timer1;
137
        private: System::Windows::Forms::ToolStripMenuItem^  animateFastToolStripMenuItem;
138
        private: System::Windows::Forms::TrackBar^  trackBar1;
139
        private: System::Windows::Forms::ToolStripMenuItem^  freeRunToolStripMenuItem;
140
        private: System::Windows::Forms::ToolStripMenuItem^  stackToolStripMenuItem;
141
        private: System::Windows::Forms::ToolStripMenuItem^  interruptToolStripMenuItem;
142
        private: System::Windows::Forms::ToolStripMenuItem^  pCHistoryToolStripMenuItem;
143
        private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
144
        private: Mutex^ mut;
145
        private: System::Windows::Forms::ToolStripButton^  toolStripButton8;
146
        private: System::Windows::Forms::ToolStripMenuItem^  keyboardToolStripMenuItem;
147
        private: System::Windows::Forms::Timer^  timer30;
148
        private: System::Windows::Forms::Timer^  timer1024;
149 30 robfinch
 
150 32 robfinch
        private: System::ComponentModel::IContainer^  components;
151 30 robfinch
        private:
152
                /// <summary>
153
                /// Required designer variable.
154
                /// </summary>
155
 
156 32 robfinch
 
157 30 robfinch
#pragma region Windows Form Designer generated code
158
                /// <summary>
159
                /// Required method for Designer support - do not modify
160
                /// the contents of this method with the code editor.
161
                /// </summary>
162
                void InitializeComponent(void)
163
                {
164 32 robfinch
                        this->components = (gcnew System::ComponentModel::Container());
165 30 robfinch
                        System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(frmMain::typeid));
166
                        this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
167
                        this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
168
                        this->loadINTELHexFIleToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
169
                        this->runToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
170
                        this->resetToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
171
                        this->stepToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
172 32 robfinch
                        this->fullSpeedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
173
                        this->animateFastToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
174
                        this->freeRunToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
175
                        this->interruptToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
176 30 robfinch
                        this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
177
                        this->registersToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
178
                        this->memoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
179 32 robfinch
                        this->breakpointsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
180
                        this->stackToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
181
                        this->pCHistoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
182
                        this->keyboardToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
183 30 robfinch
                        this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
184
                        this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
185
                        this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());
186
                        this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton());
187
                        this->toolStripButton3 = (gcnew System::Windows::Forms::ToolStripButton());
188
                        this->toolStripButton4 = (gcnew System::Windows::Forms::ToolStripButton());
189
                        this->toolStripButton5 = (gcnew System::Windows::Forms::ToolStripButton());
190
                        this->toolStripButton6 = (gcnew System::Windows::Forms::ToolStripButton());
191
                        this->toolStripButton7 = (gcnew System::Windows::Forms::ToolStripButton());
192 32 robfinch
                        this->toolStripButton8 = (gcnew System::Windows::Forms::ToolStripButton());
193 30 robfinch
                        this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
194
                        this->lblChecksumError = (gcnew System::Windows::Forms::Label());
195
                        this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
196
                        this->listBoxAdr = (gcnew System::Windows::Forms::ListBox());
197
                        this->listBoxBytes = (gcnew System::Windows::Forms::ListBox());
198
                        this->listBoxCode = (gcnew System::Windows::Forms::ListBox());
199
                        this->lblLEDS = (gcnew System::Windows::Forms::Label());
200 32 robfinch
                        this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
201
                        this->trackBar1 = (gcnew System::Windows::Forms::TrackBar());
202
                        this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
203
                        this->timer30 = (gcnew System::Windows::Forms::Timer(this->components));
204
                        this->timer1024 = (gcnew System::Windows::Forms::Timer(this->components));
205 30 robfinch
                        this->menuStrip1->SuspendLayout();
206
                        this->toolStrip1->SuspendLayout();
207
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
208 32 robfinch
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->trackBar1))->BeginInit();
209 30 robfinch
                        this->SuspendLayout();
210
                        // 
211
                        // menuStrip1
212
                        // 
213
                        this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->fileToolStripMenuItem,
214
                                this->runToolStripMenuItem, this->viewToolStripMenuItem, this->aboutToolStripMenuItem});
215
                        this->menuStrip1->Location = System::Drawing::Point(0, 0);
216
                        this->menuStrip1->Name = L"menuStrip1";
217
                        this->menuStrip1->Size = System::Drawing::Size(684, 24);
218
                        this->menuStrip1->TabIndex = 0;
219
                        this->menuStrip1->Text = L"menuStrip1";
220
                        // 
221
                        // fileToolStripMenuItem
222
                        // 
223
                        this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->loadINTELHexFIleToolStripMenuItem});
224
                        this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
225
                        this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
226
                        this->fileToolStripMenuItem->Text = L"&File";
227
                        // 
228
                        // loadINTELHexFIleToolStripMenuItem
229
                        // 
230
                        this->loadINTELHexFIleToolStripMenuItem->Name = L"loadINTELHexFIleToolStripMenuItem";
231
                        this->loadINTELHexFIleToolStripMenuItem->Size = System::Drawing::Size(178, 22);
232
                        this->loadINTELHexFIleToolStripMenuItem->Text = L"&Load INTEL Hex FIle";
233
                        this->loadINTELHexFIleToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::loadINTELHexFIleToolStripMenuItem_Click);
234
                        // 
235
                        // runToolStripMenuItem
236
                        // 
237 32 robfinch
                        this->runToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->resetToolStripMenuItem,
238
                                this->stepToolStripMenuItem, this->fullSpeedToolStripMenuItem, this->animateFastToolStripMenuItem, this->freeRunToolStripMenuItem,
239
                                this->interruptToolStripMenuItem});
240 30 robfinch
                        this->runToolStripMenuItem->Name = L"runToolStripMenuItem";
241
                        this->runToolStripMenuItem->Size = System::Drawing::Size(40, 20);
242
                        this->runToolStripMenuItem->Text = L"&Run";
243
                        // 
244
                        // resetToolStripMenuItem
245
                        // 
246
                        this->resetToolStripMenuItem->Name = L"resetToolStripMenuItem";
247 32 robfinch
                        this->resetToolStripMenuItem->Size = System::Drawing::Size(143, 22);
248 30 robfinch
                        this->resetToolStripMenuItem->Text = L"&Reset";
249
                        this->resetToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::resetToolStripMenuItem_Click);
250
                        // 
251
                        // stepToolStripMenuItem
252
                        // 
253
                        this->stepToolStripMenuItem->Name = L"stepToolStripMenuItem";
254 32 robfinch
                        this->stepToolStripMenuItem->Size = System::Drawing::Size(143, 22);
255 30 robfinch
                        this->stepToolStripMenuItem->Text = L"&Step";
256
                        this->stepToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::stepToolStripMenuItem_Click);
257
                        // 
258 32 robfinch
                        // fullSpeedToolStripMenuItem
259
                        // 
260
                        this->fullSpeedToolStripMenuItem->Name = L"fullSpeedToolStripMenuItem";
261
                        this->fullSpeedToolStripMenuItem->Size = System::Drawing::Size(143, 22);
262
                        this->fullSpeedToolStripMenuItem->Text = L"&Full Speed";
263
                        this->fullSpeedToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::fullSpeedToolStripMenuItem_Click);
264
                        // 
265
                        // animateFastToolStripMenuItem
266
                        // 
267
                        this->animateFastToolStripMenuItem->Name = L"animateFastToolStripMenuItem";
268
                        this->animateFastToolStripMenuItem->Size = System::Drawing::Size(143, 22);
269
                        this->animateFastToolStripMenuItem->Text = L"&Animate Fast";
270
                        this->animateFastToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::animateFastToolStripMenuItem_Click);
271
                        // 
272
                        // freeRunToolStripMenuItem
273
                        // 
274
                        this->freeRunToolStripMenuItem->Name = L"freeRunToolStripMenuItem";
275
                        this->freeRunToolStripMenuItem->Size = System::Drawing::Size(143, 22);
276
                        this->freeRunToolStripMenuItem->Text = L"Free Run";
277
                        this->freeRunToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::freeRunToolStripMenuItem_Click);
278
                        // 
279
                        // interruptToolStripMenuItem
280
                        // 
281
                        this->interruptToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"interruptToolStripMenuItem.Image")));
282
                        this->interruptToolStripMenuItem->Name = L"interruptToolStripMenuItem";
283
                        this->interruptToolStripMenuItem->Size = System::Drawing::Size(143, 22);
284
                        this->interruptToolStripMenuItem->Text = L"&Interrupt";
285
                        this->interruptToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::interruptToolStripMenuItem_Click);
286
                        // 
287 30 robfinch
                        // viewToolStripMenuItem
288
                        // 
289 32 robfinch
                        this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->registersToolStripMenuItem,
290
                                this->memoryToolStripMenuItem, this->breakpointsToolStripMenuItem, this->stackToolStripMenuItem, this->pCHistoryToolStripMenuItem,
291
                                this->keyboardToolStripMenuItem});
292 30 robfinch
                        this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
293
                        this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
294
                        this->viewToolStripMenuItem->Text = L"&View";
295
                        // 
296
                        // registersToolStripMenuItem
297
                        // 
298
                        this->registersToolStripMenuItem->Name = L"registersToolStripMenuItem";
299 32 robfinch
                        this->registersToolStripMenuItem->Size = System::Drawing::Size(136, 22);
300 30 robfinch
                        this->registersToolStripMenuItem->Text = L"&Registers";
301
                        this->registersToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::registersToolStripMenuItem_Click);
302
                        // 
303
                        // memoryToolStripMenuItem
304
                        // 
305
                        this->memoryToolStripMenuItem->Name = L"memoryToolStripMenuItem";
306 32 robfinch
                        this->memoryToolStripMenuItem->Size = System::Drawing::Size(136, 22);
307 30 robfinch
                        this->memoryToolStripMenuItem->Text = L"&Memory";
308
                        this->memoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::memoryToolStripMenuItem_Click);
309
                        // 
310 32 robfinch
                        // breakpointsToolStripMenuItem
311
                        // 
312
                        this->breakpointsToolStripMenuItem->Name = L"breakpointsToolStripMenuItem";
313
                        this->breakpointsToolStripMenuItem->Size = System::Drawing::Size(136, 22);
314
                        this->breakpointsToolStripMenuItem->Text = L"&Breakpoints";
315
                        this->breakpointsToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::breakpointsToolStripMenuItem_Click);
316
                        // 
317
                        // stackToolStripMenuItem
318
                        // 
319
                        this->stackToolStripMenuItem->Name = L"stackToolStripMenuItem";
320
                        this->stackToolStripMenuItem->Size = System::Drawing::Size(136, 22);
321
                        this->stackToolStripMenuItem->Text = L"&Stack";
322
                        this->stackToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::stackToolStripMenuItem_Click);
323
                        // 
324
                        // pCHistoryToolStripMenuItem
325
                        // 
326
                        this->pCHistoryToolStripMenuItem->Name = L"pCHistoryToolStripMenuItem";
327
                        this->pCHistoryToolStripMenuItem->Size = System::Drawing::Size(136, 22);
328
                        this->pCHistoryToolStripMenuItem->Text = L"&PC History";
329
                        this->pCHistoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::pCHistoryToolStripMenuItem_Click);
330
                        // 
331
                        // keyboardToolStripMenuItem
332
                        // 
333
                        this->keyboardToolStripMenuItem->Name = L"keyboardToolStripMenuItem";
334
                        this->keyboardToolStripMenuItem->Size = System::Drawing::Size(136, 22);
335
                        this->keyboardToolStripMenuItem->Text = L"&Keyboard";
336
                        this->keyboardToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::keyboardToolStripMenuItem_Click);
337
                        // 
338 30 robfinch
                        // aboutToolStripMenuItem
339
                        // 
340
                        this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
341
                        this->aboutToolStripMenuItem->Size = System::Drawing::Size(52, 20);
342
                        this->aboutToolStripMenuItem->Text = L"&About";
343
                        this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &frmMain::aboutToolStripMenuItem_Click);
344
                        // 
345
                        // toolStrip1
346
                        // 
347 32 robfinch
                        this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(8) {this->toolStripButton1,
348
                                this->toolStripButton2, this->toolStripButton3, this->toolStripButton4, this->toolStripButton5, this->toolStripButton6, this->toolStripButton7,
349
                                this->toolStripButton8});
350 30 robfinch
                        this->toolStrip1->Location = System::Drawing::Point(0, 24);
351
                        this->toolStrip1->Name = L"toolStrip1";
352
                        this->toolStrip1->Size = System::Drawing::Size(684, 25);
353
                        this->toolStrip1->TabIndex = 1;
354
                        this->toolStrip1->Text = L"toolStrip1";
355
                        // 
356
                        // toolStripButton1
357
                        // 
358
                        this->toolStripButton1->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
359
                        this->toolStripButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton1.Image")));
360
                        this->toolStripButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
361
                        this->toolStripButton1->Name = L"toolStripButton1";
362
                        this->toolStripButton1->Size = System::Drawing::Size(23, 22);
363
                        this->toolStripButton1->Text = L"Step Into";
364
                        this->toolStripButton1->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton1_Click);
365
                        // 
366
                        // toolStripButton2
367
                        // 
368
                        this->toolStripButton2->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
369
                        this->toolStripButton2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton2.Image")));
370
                        this->toolStripButton2->ImageTransparentColor = System::Drawing::Color::Magenta;
371
                        this->toolStripButton2->Name = L"toolStripButton2";
372
                        this->toolStripButton2->Size = System::Drawing::Size(23, 22);
373
                        this->toolStripButton2->Text = L"Step Over (Bounce)";
374 32 robfinch
                        this->toolStripButton2->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton2_Click);
375 30 robfinch
                        // 
376
                        // toolStripButton3
377
                        // 
378
                        this->toolStripButton3->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
379
                        this->toolStripButton3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton3.Image")));
380
                        this->toolStripButton3->ImageTransparentColor = System::Drawing::Color::Magenta;
381
                        this->toolStripButton3->Name = L"toolStripButton3";
382
                        this->toolStripButton3->Size = System::Drawing::Size(23, 22);
383
                        this->toolStripButton3->Text = L"Step Out Of";
384 32 robfinch
                        this->toolStripButton3->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton3_Click);
385 30 robfinch
                        // 
386
                        // toolStripButton4
387
                        // 
388
                        this->toolStripButton4->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
389
                        this->toolStripButton4->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton4.Image")));
390
                        this->toolStripButton4->ImageTransparentColor = System::Drawing::Color::Magenta;
391
                        this->toolStripButton4->Name = L"toolStripButton4";
392
                        this->toolStripButton4->Size = System::Drawing::Size(23, 22);
393
                        this->toolStripButton4->Text = L"Run";
394 32 robfinch
                        this->toolStripButton4->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton4_Click);
395 30 robfinch
                        // 
396
                        // toolStripButton5
397
                        // 
398
                        this->toolStripButton5->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
399
                        this->toolStripButton5->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton5.Image")));
400
                        this->toolStripButton5->ImageTransparentColor = System::Drawing::Color::Magenta;
401
                        this->toolStripButton5->Name = L"toolStripButton5";
402
                        this->toolStripButton5->Size = System::Drawing::Size(23, 22);
403
                        this->toolStripButton5->Text = L"Stop";
404 32 robfinch
                        this->toolStripButton5->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton5_Click);
405 30 robfinch
                        // 
406
                        // toolStripButton6
407
                        // 
408
                        this->toolStripButton6->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
409
                        this->toolStripButton6->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton6.Image")));
410
                        this->toolStripButton6->ImageTransparentColor = System::Drawing::Color::Magenta;
411
                        this->toolStripButton6->Name = L"toolStripButton6";
412
                        this->toolStripButton6->Size = System::Drawing::Size(23, 22);
413
                        this->toolStripButton6->Text = L"Interrupt";
414 32 robfinch
                        this->toolStripButton6->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton6_Click);
415 30 robfinch
                        // 
416
                        // toolStripButton7
417
                        // 
418
                        this->toolStripButton7->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
419
                        this->toolStripButton7->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton7.Image")));
420
                        this->toolStripButton7->ImageTransparentColor = System::Drawing::Color::Magenta;
421
                        this->toolStripButton7->Name = L"toolStripButton7";
422
                        this->toolStripButton7->Size = System::Drawing::Size(23, 22);
423
                        this->toolStripButton7->Text = L"Breakpoints";
424 32 robfinch
                        this->toolStripButton7->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton7_Click);
425 30 robfinch
                        // 
426 32 robfinch
                        // toolStripButton8
427
                        // 
428
                        this->toolStripButton8->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
429
                        this->toolStripButton8->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton8.Image")));
430
                        this->toolStripButton8->ImageTransparentColor = System::Drawing::Color::Magenta;
431
                        this->toolStripButton8->Name = L"toolStripButton8";
432
                        this->toolStripButton8->Size = System::Drawing::Size(23, 22);
433
                        this->toolStripButton8->Text = L"Reset Button";
434
                        this->toolStripButton8->Click += gcnew System::EventHandler(this, &frmMain::toolStripButton8_Click);
435
                        // 
436 30 robfinch
                        // openFileDialog1
437
                        // 
438
                        this->openFileDialog1->DefaultExt = L"hex";
439
                        this->openFileDialog1->FileName = L"boot";
440
                        this->openFileDialog1->Filter = L"\"INTEL Hex Files|*.hex|All Files|*.*\"";
441
                        this->openFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &frmMain::openFileDialog1_FileOk);
442
                        // 
443
                        // lblChecksumError
444
                        // 
445
                        this->lblChecksumError->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
446
                        this->lblChecksumError->AutoSize = true;
447 32 robfinch
                        this->lblChecksumError->Location = System::Drawing::Point(75, 557);
448 30 robfinch
                        this->lblChecksumError->Name = L"lblChecksumError";
449
                        this->lblChecksumError->Size = System::Drawing::Size(35, 13);
450
                        this->lblChecksumError->TabIndex = 2;
451
                        this->lblChecksumError->Text = L"label1";
452
                        // 
453
                        // pictureBox1
454
                        // 
455
                        this->pictureBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left));
456 32 robfinch
                        this->pictureBox1->Location = System::Drawing::Point(12, 542);
457 30 robfinch
                        this->pictureBox1->Name = L"pictureBox1";
458
                        this->pictureBox1->Size = System::Drawing::Size(218, 12);
459
                        this->pictureBox1->TabIndex = 3;
460
                        this->pictureBox1->TabStop = false;
461
                        this->pictureBox1->Click += gcnew System::EventHandler(this, &frmMain::pictureBox1_Click);
462
                        this->pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &frmMain::pictureBox1_Paint);
463
                        // 
464
                        // listBoxAdr
465
                        // 
466
                        this->listBoxAdr->FormattingEnabled = true;
467 32 robfinch
                        this->listBoxAdr->Location = System::Drawing::Point(12, 83);
468 30 robfinch
                        this->listBoxAdr->Name = L"listBoxAdr";
469
                        this->listBoxAdr->Size = System::Drawing::Size(71, 433);
470
                        this->listBoxAdr->TabIndex = 4;
471
                        // 
472
                        // listBoxBytes
473
                        // 
474
                        this->listBoxBytes->FormattingEnabled = true;
475 32 robfinch
                        this->listBoxBytes->Location = System::Drawing::Point(89, 83);
476 30 robfinch
                        this->listBoxBytes->Name = L"listBoxBytes";
477
                        this->listBoxBytes->Size = System::Drawing::Size(141, 433);
478
                        this->listBoxBytes->TabIndex = 5;
479
                        // 
480
                        // listBoxCode
481
                        // 
482
                        this->listBoxCode->FormattingEnabled = true;
483 32 robfinch
                        this->listBoxCode->Location = System::Drawing::Point(236, 83);
484 30 robfinch
                        this->listBoxCode->Name = L"listBoxCode";
485
                        this->listBoxCode->Size = System::Drawing::Size(327, 433);
486
                        this->listBoxCode->TabIndex = 6;
487
                        // 
488
                        // lblLEDS
489
                        // 
490
                        this->lblLEDS->AutoSize = true;
491 32 robfinch
                        this->lblLEDS->Location = System::Drawing::Point(271, 542);
492 30 robfinch
                        this->lblLEDS->Name = L"lblLEDS";
493
                        this->lblLEDS->Size = System::Drawing::Size(40, 13);
494
                        this->lblLEDS->TabIndex = 7;
495
                        this->lblLEDS->Text = L"lblLeds";
496
                        // 
497 32 robfinch
                        // timer1
498
                        // 
499
                        this->timer1->Enabled = true;
500
                        this->timer1->Tick += gcnew System::EventHandler(this, &frmMain::timer1_Tick);
501
                        // 
502
                        // trackBar1
503
                        // 
504
                        this->trackBar1->Location = System::Drawing::Point(426, 32);
505
                        this->trackBar1->Maximum = 999999;
506
                        this->trackBar1->Minimum = 3;
507
                        this->trackBar1->Name = L"trackBar1";
508
                        this->trackBar1->Size = System::Drawing::Size(137, 45);
509
                        this->trackBar1->TabIndex = 8;
510
                        this->trackBar1->TickStyle = System::Windows::Forms::TickStyle::TopLeft;
511
                        this->trackBar1->Value = 10000;
512
                        this->trackBar1->Scroll += gcnew System::EventHandler(this, &frmMain::trackBar1_Scroll);
513
                        // 
514
                        // timer30
515
                        // 
516
                        this->timer30->Tick += gcnew System::EventHandler(this, &frmMain::timer30_Tick);
517
                        // 
518
                        // timer1024
519
                        // 
520
                        this->timer1024->Tick += gcnew System::EventHandler(this, &frmMain::timer1024_Tick);
521
                        // 
522 30 robfinch
                        // frmMain
523
                        // 
524
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
525
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
526 32 robfinch
                        this->ClientSize = System::Drawing::Size(684, 583);
527
                        this->Controls->Add(this->trackBar1);
528 30 robfinch
                        this->Controls->Add(this->lblLEDS);
529
                        this->Controls->Add(this->listBoxCode);
530
                        this->Controls->Add(this->listBoxBytes);
531
                        this->Controls->Add(this->listBoxAdr);
532
                        this->Controls->Add(this->pictureBox1);
533
                        this->Controls->Add(this->lblChecksumError);
534
                        this->Controls->Add(this->toolStrip1);
535
                        this->Controls->Add(this->menuStrip1);
536
                        this->MainMenuStrip = this->menuStrip1;
537
                        this->Name = L"frmMain";
538
                        this->Text = L"Thor ISA Emulator";
539
                        this->menuStrip1->ResumeLayout(false);
540
                        this->menuStrip1->PerformLayout();
541
                        this->toolStrip1->ResumeLayout(false);
542
                        this->toolStrip1->PerformLayout();
543
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
544 32 robfinch
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->trackBar1))->EndInit();
545 30 robfinch
                        this->ResumeLayout(false);
546
                        this->PerformLayout();
547
 
548
                }
549
#pragma endregion
550 32 robfinch
 
551 30 robfinch
        private: System::Void registersToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
552 32 robfinch
                                 frmRegisters^ form = gcnew frmRegisters(mut);
553 30 robfinch
                                 form->Show();
554
                         }
555
        private: System::Void loadINTELHexFIleToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
556
                         this->openFileDialog1->ShowDialog();
557
                         LoadIntelHexFile();
558
                         return;
559
                         }
560
 
561
private: int IHChecksumCheck(const char *buf) {
562
        int nn;
563
        int sum;
564
        std::string str;
565
        std::string str1;
566
        str = std::string(buf);
567
        sum = 0;
568
        for (nn = 1; nn < str.length(); nn+=2) {
569
                str1 = str.substr(nn,2);
570
                sum += strtoul(str1.c_str(),NULL,16);
571
        }
572
        sum &= 0xff;
573
        return sum;
574
}
575
 
576
private: void LoadIntelHexFile() {
577
                         int nc,nn;
578
                         std::string buf;
579
                         std::string str_ad;
580
                         std::string str_insn;
581
                         std::string str_ad_insn;
582
                         std::string str_disassem;
583
                         unsigned int ad;
584
                         unsigned __int64 dat;
585
                         unsigned __int64 b0,b1,b2,b3,b4,b5,b6,b7;
586
                         unsigned int firstAdr;
587
                         char buf2[40];
588
                         unsigned int ad_msbs;
589
                         int chksum;
590
                         int lineno;    // 16531
591
 
592
                        char* str = (char*)(void*)Marshal::StringToHGlobalAnsi(this->openFileDialog1->FileName);
593
                        System::Windows::Forms::Cursor::Current = System::Windows::Forms::Cursors::WaitCursor;
594
                        std::ifstream fp_in;
595
                        fp_in.open(str,std::ios::in);
596
                        firstAdr = 0;
597
                        ad_msbs = 0;
598
                        chksum = 0;
599
                        lineno=0;
600
                        system1.WriteROM = true;
601
                        while (!fp_in.eof()) {
602
                                lineno++;
603
                                std::getline(fp_in, buf);
604
                                chksum += IHChecksumCheck(buf.c_str());
605
                                if (buf.c_str()[0]!=':') continue;
606
                                if (buf.c_str()[8]=='4') {
607
                                        strncpy(buf2,&((buf.c_str())[9]),4);
608
                                        buf2[4] = '\0';
609
                                        ad_msbs = strtoul(buf2,NULL,16);
610
                                        continue;
611
                                }
612
                                // Process record type #'00'
613
                                if (buf.c_str()[8]=='0') {
614
                                        ad = strtoul(buf.substr(3,4).c_str(),NULL,16) | (ad_msbs << 16);
615
                                        b0 = strtoul(buf.substr(9,2).c_str(),NULL,16);
616
                                        b1 = strtoul(buf.substr(11,2).c_str(),NULL,16);
617
                                        b2 = strtoul(buf.substr(13,2).c_str(),NULL,16);
618
                                        b3 = strtoul(buf.substr(15,2).c_str(),NULL,16);
619
                                        b4 = strtoul(buf.substr(17,2).c_str(),NULL,16);
620
                                        b5 = strtoul(buf.substr(19,2).c_str(),NULL,16);
621
                                        b6 = strtoul(buf.substr(21,2).c_str(),NULL,16);
622
                                        b7 = strtoul(buf.substr(23,2).c_str(),NULL,16);
623
                                        dat = b0 |
624
                                                (b1 << 8) |
625
                                                (b2 << 16) |
626
                                                (b3 << 24) |
627
                                                (b4 << 32) |
628
                                                (b5 << 40) |
629
                                                (b6 << 48) |
630
                                                (b7 << 56)
631
                                                ;
632
                                }
633
                                if (!firstAdr)
634
                                        firstAdr = ad;
635 32 robfinch
                                mut->WaitOne();
636 30 robfinch
                                system1.Write(ad, dat, 0xFF, 0);
637 32 robfinch
                                mut->ReleaseMutex();
638 30 robfinch
                                //system1.memory[ad>>2] = dat;
639
                                //sprintf(buf2,"%06X", ad);
640
                                //str_ad = std::string(buf2);
641
                                //sprintf(buf2,"%08X", dat);
642
                                //str_insn = std::string(buf2);
643
                                //str_disassem = Disassem(str_ad,str_insn);
644
                                //str_ad_insn = str_ad + "   " + str_insn + "    " + str_disassem;
645
                                //label1->Text = gcnew String(str_ad_insn.c_str());
646
                                //this->checkedListBox1->Items->Add(gcnew String(str_ad_insn.c_str()));
647
                        }
648
                fp_in.close();
649
                        system1.WriteROM = false;
650
                        ad = firstAdr;
651
                        UpdateListBoxes(ad);
652
                        if (chksum != 0) {
653
                                sprintf(buf2, "Checksum Error: %d", chksum);
654
                                this->lblChecksumError->Text = gcnew String(buf2);
655
                        }
656
                        else
657
                                this->lblChecksumError->Text = "Checksum OK";
658
                        System::Windows::Forms::Cursor::Current = System::Windows::Forms::Cursors::Default;
659
                 }
660
private: System::Void memoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
661 32 robfinch
                         frmMemory^ form = gcnew frmMemory(mut);
662 30 robfinch
                         form->Show();
663
                 }
664
private: System::Void pictureBox1_Click(System::Object^  sender, System::EventArgs^  e) {
665
                 }
666
private: System::Void pictureBox1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
667
                         Graphics^ gr = e->Graphics;
668
                         int h = pictureBox1->ClientSize.Height;
669
                         int w = h;
670
                         int nn,kk;
671 32 robfinch
                         int lds;
672
 
673
                         mut->WaitOne();
674
                         lds = system1.leds;
675
                         mut->ReleaseMutex();
676 30 robfinch
                         for (kk= 15, nn = 0; nn < 16; nn++, kk--) {
677 32 robfinch
                                if (lds & (1 << kk))
678 30 robfinch
                                        gr->FillEllipse(gcnew SolidBrush(Color::Green),System::Drawing::Rectangle(w*nn,0,w-1,h-1));
679
                                else
680
                                        gr->FillEllipse(gcnew SolidBrush(Color::FromArgb(0xFF003000)),System::Drawing::Rectangle(w*nn,0,w-1,h-1));
681
                         }
682
                 }
683
private: void UpdateListBoxes(int ad)
684
                 {
685
                         int nn,nb,kk;
686
                         char buf2[100];
687
                         std::string dstr;
688
                         std::string buf;
689
                         int adr[32];
690 32 robfinch
                         int adf;
691 30 robfinch
 
692
                         listBoxAdr->Items->Clear();
693
                         listBoxBytes->Items->Clear();
694
                         listBoxCode->Items->Clear();
695
                         for (nn = 0; nn < 32; nn++) {
696
                                 adr[nn] = ad;
697
                                sprintf(buf2,"%06X", ad);
698
                                buf = std::string(buf2);
699
                                this->listBoxAdr->Items->Add(gcnew String(buf.c_str()));
700
                                dstr = da.Disassem(ad,&nb);
701
                                buf2[0] = '\0';
702
                                for (kk = 0; kk < nb; kk++) {
703
                                        sprintf(&buf2[strlen(buf2)], "%02X ", system1.ReadByte(ad));
704
                                        ad++;
705
                                }
706
                                buf = std::string(buf2);
707
                                this->listBoxBytes->Items->Add(gcnew String(buf.c_str()));
708
                                this->listBoxCode->Items->Add(gcnew String(dstr.c_str()));
709
                         }
710
                         for (nn = 0; nn < 32; nn++) {
711 32 robfinch
                                 mut->WaitOne();
712
                                 adf = system1.cpu2.pc;
713
                                 mut->ReleaseMutex();
714
                                if (adr[nn]==adf) {
715 30 robfinch
                                        this->listBoxAdr->SetSelected(nn,true);
716
                                        this->listBoxBytes->SetSelected(nn,true);
717
                                        this->listBoxCode->SetSelected(nn,true);
718
                                }
719
                         }
720
                 }
721
private: System::Void stepToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
722
                 }
723
private: System::Void resetToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
724
                         Reset();
725
                 }
726
private: void Reset() {
727 32 robfinch
                         int ad;
728
                         mut->WaitOne();
729 30 robfinch
                         system1.Reset();
730 32 robfinch
                         ad = system1.cpu2.pc-32;
731
                         mut->ReleaseMutex();
732
                         UpdateListBoxes(PCIsInList(ad));
733 30 robfinch
                 }
734
 
735
// Try and align the disassembled code with the current PC.
736
private: int PCIsInList(int as)
737
{
738
        int nn, nb;
739
        std::string dstr;
740
        int ae;
741
        int ad = as;
742
 
743
        for (ad = as; ad > as-32; ad--) {
744
                ae = ad;
745
                for (nn = 0; nn < 64; nn++) {
746 32 robfinch
            mut->WaitOne();
747
                        if (ae==system1.cpu2.pc) {
748
                                mut->ReleaseMutex();
749 30 robfinch
                                return ad;
750 32 robfinch
                        }
751
                        mut->ReleaseMutex();
752 30 robfinch
                dstr = da.Disassem(ae,&nb);
753
                ae += nb;
754
                }
755
        }
756
        return as;
757
}
758
 
759
private: void DoStepInto() {
760
//                       animate = false;
761
//                       isRunning = false;
762
                         char buf[100];
763 32 robfinch
                         mut->WaitOne();
764
                         system1.Step();
765
                         mut->ReleaseMutex();
766
                         UpdateListBoxes(PCIsInList(system1.cpu2.pc-32));
767 30 robfinch
                         sprintf(buf, "%04X", system1.leds);
768
                         lblLEDS->Text = gcnew String(buf);
769
                         pictureBox1->Refresh();
770
                 }
771 32 robfinch
private: void DoStopButton() {
772
                         mut->WaitOne();
773
                         animate = false;
774
                         isRunning = false;
775
//                       cpu2.brk = true;
776
                         fullspeed = false;
777
                         mut->ReleaseMutex();
778
                         this->fullSpeedToolStripMenuItem->Checked = false;
779
                         this->animateFastToolStripMenuItem->Checked = false;
780
                         this->timer1->Interval = 100;
781
                 }
782 30 robfinch
private: System::Void toolStripButton1_Click(System::Object^  sender, System::EventArgs^  e) {
783
                         DoStepInto();
784
                 }
785
private: System::Void openFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
786
                 }
787
private: System::Void aboutToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
788
                         About^ form = gcnew About;
789
                         form->Show();
790
                 }
791 32 robfinch
private: System::Void breakpointsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
792
                         frmBreakpoints^ form = gcnew frmBreakpoints(mut);
793
                         form->ShowDialog();
794
                 }
795
private: System::Void fullSpeedToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
796
                         this->fullSpeedToolStripMenuItem->Checked = !this->fullSpeedToolStripMenuItem->Checked;
797
                         mut->WaitOne();
798
                         fullspeed = this->fullSpeedToolStripMenuItem->Checked;
799
                         mut->ReleaseMutex();
800
                         if (this->fullSpeedToolStripMenuItem->Checked)
801
                                 this->timer1->Interval = 1000;
802
                         else {
803
                                this->timer1->Interval = (int)sqrt((float)1000000-trackBar1->Value);
804
                         }
805
                         this->animateFastToolStripMenuItem->Checked = false;
806
                 }
807
private: System::Void toolStripButton3_Click(System::Object^  sender, System::EventArgs^  e) {
808
                         mut->WaitOne();
809
                         step_depth = system1.cpu2.sub_depth;
810
                         stepout = true;
811
                         animate = false;
812
                         fullspeed = true;
813
                         isRunning = true;
814
                         mut->ReleaseMutex();
815
                         this->fullSpeedToolStripMenuItem->Checked = true;
816
                 }
817
private: System::Void animateFastToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
818
                         mut->WaitOne();
819
                         isRunning = false;
820
                         animate = true;
821
                         mut->ReleaseMutex();
822
                         this->timer1->Interval = 1;
823
                         this->trackBar1->Value = 3;
824
                         this->fullSpeedToolStripMenuItem->Checked = false;
825
                         this->animateFastToolStripMenuItem->Checked = true;
826
                 }
827
private: System::Void toolStripButton5_Click(System::Object^  sender, System::EventArgs^  e) {
828
                         DoStopButton();
829
                 }
830
private: System::Void toolStripButton2_Click(System::Object^  sender, System::EventArgs^  e) {
831
                         mut->WaitOne();
832
                         stepover_pc = system1.cpu2.pc;
833
                         stepover_depth = system1.cpu2.sub_depth;
834
                         stepover = true;
835
                         animate = false;
836
                         fullspeed = true;
837
                         isRunning = true;
838
                         mut->ReleaseMutex();
839
                         this->fullSpeedToolStripMenuItem->Checked = true;
840
                 }
841
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
842
                         static int tt = 0;
843
                         int xx;
844
 
845
                         if (this->timer1->Interval < 10)
846
                                 tt += 1;
847
                                 if (tt == 10 * this->timer1->Interval) {
848
                                         tt = 0;
849
                                         UpdateListBoxes(PCIsInList(system1.cpu2.pc-32));
850
                                 }
851
                         else
852
                                UpdateListBoxes(PCIsInList(system1.cpu2.pc-32));
853
//                      if (fullspeed) {
854
//                              for (xx = 0; xx < 100000; xx++)
855
//                                      RunCPU();
856
//                      }
857
                         mut->WaitOne();
858
                         if (!isRunning && animate) {
859
                                system1.Step();
860
                         }
861
                         mut->ReleaseMutex();
862
 
863
                         if (trigger30) {
864
                                 trigger30 = false;
865
                                 if (interval30==-1) {
866
                                         mut->WaitOne();
867
                                         system1.pic1.irq30Hz = true;
868
                                         mut->ReleaseMutex();
869
                                 }
870
                                 else {
871
                                         this->timer30->Interval = interval30;
872
                                         this->timer30->Enabled = true;
873
                                 }
874
                         }
875
                         if (trigger1024) {
876
                                 trigger1024 = false;
877
                                 if (interval1024==-1) {
878
                                         mut->WaitOne();
879
                                         system1.pic1.irq1024Hz = true;
880
                                         mut->ReleaseMutex();
881
                                 }
882
                                 else {
883
                                         this->timer1024->Interval = interval1024;
884
                                         this->timer1024->Enabled = true;
885
                                 }
886
                         }
887
 
888
                 }
889
private: System::Void toolStripButton4_Click(System::Object^  sender, System::EventArgs^  e) {
890
                        fmrFreeRun^ form = gcnew fmrFreeRun(mut);
891
                        form->Show();
892
                /*
893
                         if (fullspeed) {
894
                                 isRunning = true;
895
                         }
896
                         else {
897
                                 isRunning = false;
898
                                 animate = true;
899
                                 this->timer1->Interval = (int)(sqrt((float)1000000-trackBar1->Value));
900
                         }
901
                        */
902
                 }
903
private: System::Void toolStripButton7_Click(System::Object^  sender, System::EventArgs^  e) {
904
                         frmBreakpoints^ form = gcnew frmBreakpoints(mut);
905
                         form->ShowDialog();
906
                 }
907
private: System::Void trackBar1_Scroll(System::Object^  sender, System::EventArgs^  e) {
908
                         animate = true;
909
                         isRunning = false;
910
//                       cpu2.brk = true;
911
                         fullspeed = false;
912
                         this->fullSpeedToolStripMenuItem->Checked = false;
913
//                       this->animateFastToolStripMenuItem->Checked = false;
914
                         this->timer1->Interval = (int)(sqrt((float)1000000-trackBar1->Value));
915
                 }
916
private: System::Void freeRunToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
917
                         fmrFreeRun^ form = gcnew fmrFreeRun(mut);
918
                         form->Show();
919
                 }
920
private: System::Void stackToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
921
                         frmStack^ form = gcnew frmStack(mut);
922
                         form->Show();
923
                 }
924
private: System::Void interruptToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
925
                         frmInterrupts^ form = gcnew frmInterrupts(mut);
926
                         form->ShowDialog();
927
                 }
928
private: System::Void toolStripButton6_Click(System::Object^  sender, System::EventArgs^  e) {
929
                         frmInterrupts^ form = gcnew frmInterrupts(mut);
930
                         form->ShowDialog();
931
                 }
932
private: System::Void pCHistoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
933
                         frmPCHistory^ form = gcnew frmPCHistory(mut);
934
                         form->Show();
935
                 }
936
private: System::Void toolStripButton8_Click(System::Object^  sender, System::EventArgs^  e) {
937
                         Reset();
938
                 }
939
private: System::Void keyboardToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
940
                        frmKeyboard^ keyboardFrm = gcnew frmKeyboard(mut);
941
                             keyboardFrm->Show();
942
                 }
943
private: System::Void timer30_Tick(System::Object^  sender, System::EventArgs^  e) {
944
                         mut->WaitOne();
945
                         system1.pic1.irq30Hz = true;
946
                         mut->ReleaseMutex();
947
                 }
948
private: System::Void timer1024_Tick(System::Object^  sender, System::EventArgs^  e) {
949
                         mut->WaitOne();
950
                         system1.pic1.irq1024Hz = true;
951
                         mut->ReleaseMutex();
952
                 }
953 30 robfinch
};
954
}
955
 

powered by: WebSVN 2.1.0

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