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

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [emuThor/] [source/] [frmMemory.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 "stdafx.h"
3
#include <string.h>
4
#include <stdlib.h>
5
#include <stdio.h>
6
#include <string>
7
 
8
extern clsSystem system1;
9
 
10
namespace emuThor {
11
 
12
        using namespace System;
13
        using namespace System::ComponentModel;
14
        using namespace System::Collections;
15
        using namespace System::Windows::Forms;
16
        using namespace System::Data;
17
        using namespace System::Drawing;
18
        using namespace System::Runtime::InteropServices;
19 32 robfinch
        using namespace System::Threading;
20 30 robfinch
 
21
        /// <summary>
22
        /// Summary for frmMemory
23
        /// </summary>
24
        public ref class frmMemory : public System::Windows::Forms::Form
25
        {
26
        public:
27 32 robfinch
                Mutex^ mut;
28
                frmMemory(Mutex^ m)
29 30 robfinch
                {
30 32 robfinch
                        mut = m;
31 30 robfinch
                        InitializeComponent();
32
                        //
33
                        //TODO: Add the constructor code here
34
                        //
35
                }
36
 
37
        protected:
38
                /// <summary>
39
                /// Clean up any resources being used.
40
                /// </summary>
41
                ~frmMemory()
42
                {
43
                        if (components)
44
                        {
45
                                delete components;
46
                        }
47
                }
48
        private: System::Windows::Forms::TextBox^  textBoxAddr;
49
        protected:
50
 
51
        protected:
52
        private: System::Windows::Forms::Label^  label1;
53
        private: System::Windows::Forms::TextBox^  textBoxMem;
54
 
55
        private:
56
                /// <summary>
57
                /// Required designer variable.
58
                /// </summary>
59
                System::ComponentModel::Container ^components;
60
 
61
#pragma region Windows Form Designer generated code
62
                /// <summary>
63
                /// Required method for Designer support - do not modify
64
                /// the contents of this method with the code editor.
65
                /// </summary>
66
                void InitializeComponent(void)
67
                {
68
                        this->textBoxAddr = (gcnew System::Windows::Forms::TextBox());
69
                        this->label1 = (gcnew System::Windows::Forms::Label());
70
                        this->textBoxMem = (gcnew System::Windows::Forms::TextBox());
71
                        this->SuspendLayout();
72
                        // 
73
                        // textBoxAddr
74
                        // 
75
                        this->textBoxAddr->Location = System::Drawing::Point(75, 18);
76
                        this->textBoxAddr->Name = L"textBoxAddr";
77
                        this->textBoxAddr->Size = System::Drawing::Size(100, 20);
78
                        this->textBoxAddr->TabIndex = 0;
79
                        this->textBoxAddr->TextChanged += gcnew System::EventHandler(this, &frmMemory::textBox1_TextChanged);
80
                        // 
81
                        // label1
82
                        // 
83
                        this->label1->AutoSize = true;
84
                        this->label1->Location = System::Drawing::Point(24, 21);
85
                        this->label1->Name = L"label1";
86
                        this->label1->Size = System::Drawing::Size(45, 13);
87
                        this->label1->TabIndex = 1;
88
                        this->label1->Text = L"Address";
89
                        // 
90
                        // textBoxMem
91
                        // 
92
                        this->textBoxMem->Enabled = false;
93
                        this->textBoxMem->Font = (gcnew System::Drawing::Font(L"Lucida Console", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
94
                                static_cast<System::Byte>(0)));
95
                        this->textBoxMem->Location = System::Drawing::Point(27, 44);
96
                        this->textBoxMem->Multiline = true;
97
                        this->textBoxMem->Name = L"textBoxMem";
98
                        this->textBoxMem->Size = System::Drawing::Size(561, 353);
99
                        this->textBoxMem->TabIndex = 2;
100
                        // 
101
                        // frmMemory
102
                        // 
103
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
104
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
105
                        this->ClientSize = System::Drawing::Size(614, 409);
106
                        this->Controls->Add(this->textBoxMem);
107
                        this->Controls->Add(this->label1);
108
                        this->Controls->Add(this->textBoxAddr);
109
                        this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
110
                        this->Name = L"frmMemory";
111
                        this->Text = L"Memory";
112
                        this->ResumeLayout(false);
113
                        this->PerformLayout();
114
 
115
                }
116
#pragma endregion
117
        private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
118
                                 int nn;
119
                        char* str = (char*)(void*)Marshal::StringToHGlobalAnsi(this->textBoxAddr->Text);
120
                                std::string str2;
121
                                char buf[50];
122
 
123
                                str2 = "";
124
                                 for (nn = strtoul(str,NULL,16); nn < strtoul(str,NULL,16) + 512; nn++) {
125
                                         if ((nn % 16)==0) {
126
                                                 sprintf(buf, "\r\n%06X ", nn);
127
                                                 str2 += buf;
128
                                         }
129 32 robfinch
                                         mut->WaitOne();
130 30 robfinch
                                         sprintf(buf, "%02X ", (system1.Read(nn,0) >> ((nn & 7)<<3)) & 0xFF);
131 32 robfinch
                                         mut->ReleaseMutex();
132 30 robfinch
                                         str2 += buf;
133
                                 }
134
                                 this->textBoxMem->Text = gcnew String(str2.c_str());
135
                         }
136
        };
137
}

powered by: WebSVN 2.1.0

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