#pragma once
|
#pragma once
|
#include <Windows.h>
|
#include <Windows.h>
|
#include <string>
|
#include <string>
|
#include "clsSystem.h"
|
#include "clsSystem.h"
|
extern clsSystem system1;
|
extern clsSystem system1;
|
extern char refscreen;
|
extern char refscreen;
|
|
|
namespace emuThor {
|
namespace emuThor {
|
|
|
using namespace System;
|
using namespace System;
|
using namespace System::ComponentModel;
|
using namespace System::ComponentModel;
|
using namespace System::Collections;
|
using namespace System::Collections;
|
using namespace System::Windows::Forms;
|
using namespace System::Windows::Forms;
|
using namespace System::Data;
|
using namespace System::Data;
|
using namespace System::Drawing;
|
using namespace System::Drawing;
|
|
using namespace System::Threading;
|
|
|
/// <summary>
|
/// <summary>
|
/// Summary for frmScreen
|
/// Summary for frmScreen
|
/// </summary>
|
/// </summary>
|
public ref class frmScreen : public System::Windows::Forms::Form
|
public ref class frmScreen : public System::Windows::Forms::Form
|
{
|
{
|
System::Drawing::Rectangle ur;
|
System::Drawing::Rectangle ur;
|
public:
|
public:
|
frmScreen(void)
|
Mutex^ mut;
|
|
frmScreen(Mutex^ m, String^ tbs)
|
{
|
{
|
|
mut = m;
|
InitializeComponent();
|
InitializeComponent();
|
//
|
//
|
//TODO: Add the constructor code here
|
//TODO: Add the constructor code here
|
//
|
//
|
|
this->Text = L"emuFISA64 Test System Screen - " + tbs;
|
}
|
}
|
|
|
protected:
|
protected:
|
/// <summary>
|
/// <summary>
|
/// Clean up any resources being used.
|
/// Clean up any resources being used.
|
/// </summary>
|
/// </summary>
|
~frmScreen()
|
~frmScreen()
|
{
|
{
|
if (components)
|
if (components)
|
{
|
{
|
delete components;
|
delete components;
|
}
|
}
|
}
|
}
|
|
public: unsigned long *pVidMem;
|
|
public: bool *pVidDirty;
|
private: System::Windows::Forms::Timer^ timer1;
|
private: System::Windows::Forms::Timer^ timer1;
|
private: System::Windows::Forms::PictureBox^ pictureBox1;
|
private: System::Windows::Forms::PictureBox^ pictureBox1;
|
protected:
|
protected:
|
private: System::ComponentModel::IContainer^ components;
|
private: System::ComponentModel::IContainer^ components;
|
|
|
private:
|
private:
|
/// <summary>
|
/// <summary>
|
/// Required designer variable.
|
/// Required designer variable.
|
/// </summary>
|
/// </summary>
|
|
|
|
|
#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());
|
this->components = (gcnew System::ComponentModel::Container());
|
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
|
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
|
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
|
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
|
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
|
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
|
this->SuspendLayout();
|
this->SuspendLayout();
|
//
|
//
|
// timer1
|
// timer1
|
//
|
//
|
this->timer1->Enabled = true;
|
this->timer1->Enabled = true;
|
this->timer1->Tick += gcnew System::EventHandler(this, &frmScreen::timer1_Tick);
|
this->timer1->Tick += gcnew System::EventHandler(this, &frmScreen::timer1_Tick);
|
//
|
//
|
// pictureBox1
|
// pictureBox1
|
//
|
//
|
this->pictureBox1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
|
this->pictureBox1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
|
this->pictureBox1->Location = System::Drawing::Point(2, 0);
|
this->pictureBox1->Location = System::Drawing::Point(2, 0);
|
this->pictureBox1->Name = L"pictureBox1";
|
this->pictureBox1->Name = L"pictureBox1";
|
this->pictureBox1->Size = System::Drawing::Size(681, 266);
|
this->pictureBox1->Size = System::Drawing::Size(681, 328);
|
this->pictureBox1->TabIndex = 0;
|
this->pictureBox1->TabIndex = 0;
|
this->pictureBox1->TabStop = false;
|
this->pictureBox1->TabStop = false;
|
this->pictureBox1->Click += gcnew System::EventHandler(this, &frmScreen::pictureBox1_Click);
|
this->pictureBox1->Click += gcnew System::EventHandler(this, &frmScreen::pictureBox1_Click);
|
this->pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &frmScreen::pictureBox1_Paint);
|
this->pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &frmScreen::pictureBox1_Paint);
|
//
|
//
|
// frmScreen
|
// frmScreen
|
//
|
//
|
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->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
|
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
|
this->ClientSize = System::Drawing::Size(684, 262);
|
this->ClientSize = System::Drawing::Size(684, 332);
|
this->Controls->Add(this->pictureBox1);
|
this->Controls->Add(this->pictureBox1);
|
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
|
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
|
this->MaximizeBox = false;
|
this->MaximizeBox = false;
|
this->Name = L"frmScreen";
|
this->Name = L"frmScreen";
|
this->Text = L"emuFISA64 Test System Screen";
|
this->Text = L"emuFISA64 Test System Screen";
|
this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &frmScreen::frmScreen_Paint);
|
this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &frmScreen::frmScreen_Paint);
|
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
|
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
|
this->ResumeLayout(false);
|
this->ResumeLayout(false);
|
|
|
}
|
}
|
#pragma endregion
|
#pragma endregion
|
private: char ScreenToAscii(char ch)
|
private: char ScreenToAscii(char ch)
|
{
|
{
|
ch &= 0xFF;
|
ch &= 0xFF;
|
if (ch==0x1B)
|
if (ch==0x1B)
|
return 0x5B;
|
return 0x5B;
|
if (ch==0x1D)
|
if (ch==0x1D)
|
return 0x5D;
|
return 0x5D;
|
if (ch < 27)
|
if (ch < 27)
|
ch += 0x60;
|
ch += 0x60;
|
return ch;
|
return ch;
|
}
|
}
|
|
|
private: System::Void frmScreen_OnPaintBackground(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
|
private: System::Void frmScreen_OnPaintBackground(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
|
}
|
}
|
private: System::Void frmScreen_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
|
private: System::Void frmScreen_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
|
}
|
}
|
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
|
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
|
int nn;
|
int nn;
|
int xx,yy;
|
int xx,yy;
|
int maxx,maxy,minx,miny;
|
int maxx,maxy,minx,miny;
|
maxx = 0; maxy = 0;
|
maxx = 0; maxy = 0;
|
minx = 1000; miny = 1000;
|
minx = 1000; miny = 1000;
|
if (refscreen) {
|
if (refscreen) {
|
for (nn = 0; nn < 4096; nn++) {
|
for (nn = 0; nn < 4096; nn++) {
|
if (system1.VideoMemDirty[nn]) {
|
if (pVidDirty) {
|
|
mut->WaitOne();
|
|
if (pVidDirty[nn]) {
|
xx = nn % 84;
|
xx = nn % 84;
|
yy = nn / 84;
|
yy = nn / 84;
|
maxx = max(xx,maxx);
|
maxx = max(xx,maxx);
|
maxy = max(yy,maxy);
|
maxy = max(yy,maxy);
|
minx = min(xx,minx);
|
minx = min(xx,minx);
|
miny = min(yy,miny);
|
miny = min(yy,miny);
|
}
|
}
|
|
mut->ReleaseMutex();
|
|
}
|
}
|
}
|
ur.X = minx<<3;
|
ur.X = minx<<3;
|
ur.Y = miny<<3;
|
ur.Y = miny * 10;
|
ur.Width = (maxx - minx)<<3;
|
ur.Width = (maxx - minx)<<3;
|
ur.Height = (maxy - miny)<<3;
|
ur.Height = (maxy - miny) * 10;
|
this->pictureBox1->Invalidate(ur);
|
this->pictureBox1->Invalidate(ur);
|
refscreen = false;
|
refscreen = false;
|
// this->Refresh();
|
// this->Refresh();
|
}
|
}
|
}
|
}
|
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) {
|
char buf[10];
|
char buf[10];
|
unsigned int ndx;
|
unsigned int ndx;
|
int r,g,b;
|
int r,g,b;
|
unsigned int v;
|
unsigned int v;
|
System::Drawing::Font^ myfont;
|
System::Drawing::Font^ myfont;
|
std::string str;
|
std::string str;
|
Graphics^ gr = e->Graphics;
|
Graphics^ gr = e->Graphics;
|
SolidBrush^ bkbr;
|
SolidBrush^ bkbr;
|
SolidBrush^ fgbr;
|
SolidBrush^ fgbr;
|
Color^ col;
|
Color^ col;
|
myfont = gcnew System::Drawing::Font("Courier New", 6);
|
myfont = gcnew System::Drawing::Font("Courier New", 6);
|
col = gcnew System::Drawing::Color;
|
col = gcnew System::Drawing::Color;
|
bkbr = gcnew System::Drawing::SolidBrush(System::Drawing::Color::Blue);
|
bkbr = gcnew System::Drawing::SolidBrush(System::Drawing::Color::Blue);
|
fgbr = gcnew System::Drawing::SolidBrush(System::Drawing::Color::White);
|
fgbr = gcnew System::Drawing::SolidBrush(System::Drawing::Color::White);
|
int xx, yy;
|
int xx, yy;
|
for (xx = ur.X; xx < ur.X + ur.Width; xx += 8) {
|
for (xx = ur.X; xx < ur.X + ur.Width; xx += 8) {
|
for (yy = ur.Y; yy < ur.Y + ur.Height; yy += 8) {
|
for (yy = ur.Y; yy < ur.Y + ur.Height; yy += 10) {
|
ndx = (xx/8 + yy/8 * 84);
|
ndx = (xx/8 + yy/10 * 84);
|
// if (system1.VideoMemDirty[ndx]) {
|
// if (system1.VideoMemDirty[ndx]) {
|
v = system1.VideoMem[ndx];
|
if (pVidMem) {
|
|
mut->WaitOne();
|
|
v = pVidMem[ndx];
|
|
mut->ReleaseMutex();
|
r = ((((v >> 10) >> 9) >> 6) & 7) << 5;
|
r = ((((v >> 10) >> 9) >> 6) & 7) << 5;
|
g = ((((v >> 10) >> 9) >> 3) & 7) << 5;
|
g = ((((v >> 10) >> 9) >> 3) & 7) << 5;
|
b = ((((v >> 10) >> 9) >> 0) & 7) << 5;
|
b = ((((v >> 10) >> 9) >> 0) & 7) << 5;
|
bkbr->Color = col->FromArgb(255,r,g,b);
|
bkbr->Color = col->FromArgb(255,r,g,b);
|
gr->FillRectangle(bkbr,xx,yy,8,8);
|
gr->FillRectangle(bkbr,xx,yy,8,10);
|
r = ((((v >> 10)) >> 6) & 7) << 5;
|
r = ((((v >> 10)) >> 6) & 7) << 5;
|
g = ((((v >> 10)) >> 3) & 7)<< 5;
|
g = ((((v >> 10)) >> 3) & 7)<< 5;
|
b = ((((v >> 10)) >> 0) & 7)<< 5;
|
b = ((((v >> 10)) >> 0) & 7)<< 5;
|
fgbr->Color = col->FromArgb(255,r,g,b);
|
fgbr->Color = col->FromArgb(255,r,g,b);
|
sprintf(buf,"%c",ScreenToAscii(system1.VideoMem[ndx]&0xff));
|
sprintf(buf,"%c",ScreenToAscii(v&0xff));
|
str = std::string(buf);
|
str = std::string(buf);
|
gr->DrawString(gcnew String(str.c_str()),myfont,fgbr,xx,yy);
|
gr->DrawString(gcnew String(str.c_str()),myfont,fgbr,xx,yy);
|
system1.VideoMemDirty[ndx] = false;
|
if (pVidDirty) {
|
|
mut->WaitOne();
|
|
pVidDirty[ndx] = false;
|
|
mut->ReleaseMutex();
|
|
}
|
|
}
|
// }
|
// }
|
}
|
}
|
}
|
}
|
}
|
}
|
};
|
};
|
}
|
}
|
|
|