fix Visual6502 mode transistors file; add Open/Close Emulator commands
This commit is contained in:
parent
846d772b8f
commit
1438999790
|
@ -197,7 +197,7 @@ bool E2wxApp::OnInit() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
StartEmulator();
|
// TODO option? or use last-state? StartEmulator();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,14 +258,7 @@ int E2wxApp::OnExit() {
|
||||||
delete wxXmlResource::Set(nullptr);
|
delete wxXmlResource::Set(nullptr);
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Deleting emulator instance...";
|
BOOST_LOG_TRIVIAL(info) << "Deleting emulator instance...";
|
||||||
if (this->emu_timer) {
|
StopEmulator();
|
||||||
delete this->emu_timer;
|
|
||||||
this->emu_timer = nullptr;
|
|
||||||
}
|
|
||||||
if (this->emu) {
|
|
||||||
delete this->emu;
|
|
||||||
this->emu = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Application OnExit complete.";
|
BOOST_LOG_TRIVIAL(info) << "Application OnExit complete.";
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -397,13 +390,21 @@ void E2wxApp::InitBoostLog() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void E2wxApp::StopEmulator() {
|
||||||
|
if (EnsureCanQuit()) {
|
||||||
|
if (this->emu_timer) {
|
||||||
|
delete this->emu_timer;
|
||||||
|
this->emu_timer = nullptr;
|
||||||
|
}
|
||||||
|
if (this->emu) {
|
||||||
|
delete this->emu;
|
||||||
|
this->emu = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void E2wxApp::StartEmulator() {
|
void E2wxApp::StartEmulator() {
|
||||||
if (this->emu_timer) {
|
StopEmulator();
|
||||||
delete this->emu_timer;
|
|
||||||
}
|
|
||||||
if (this->emu) {
|
|
||||||
delete this->emu;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->emu = new Emulator();
|
this->emu = new Emulator();
|
||||||
E2Config cfg{this->arg_configfile, this->opt_config_from_prefs_only};
|
E2Config cfg{this->arg_configfile, this->opt_config_from_prefs_only};
|
||||||
|
|
|
@ -84,6 +84,7 @@ public:
|
||||||
const std::filesystem::path GetDocumentsDir() const;
|
const std::filesystem::path GetDocumentsDir() const;
|
||||||
|
|
||||||
void StartEmulator();
|
void StartEmulator();
|
||||||
|
void StopEmulator();
|
||||||
|
|
||||||
void OnFnKeyPressed(const SDL_Keycode k);
|
void OnFnKeyPressed(const SDL_Keycode k);
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ enum E2MenuID {
|
||||||
ID_MENUITEM_RESET,
|
ID_MENUITEM_RESET,
|
||||||
ID_MENUITEM_SCREEN_SHOT,
|
ID_MENUITEM_SCREEN_SHOT,
|
||||||
ID_MENUITEM_TOGGLE_BUFFERED,
|
ID_MENUITEM_TOGGLE_BUFFERED,
|
||||||
|
ID_MENUITEM_START_EMULATOR,
|
||||||
|
ID_MENUITEM_STOP_EMULATOR,
|
||||||
};
|
};
|
||||||
|
|
||||||
wxBEGIN_EVENT_TABLE(E2wxFrame, wxFrame)
|
wxBEGIN_EVENT_TABLE(E2wxFrame, wxFrame)
|
||||||
|
@ -56,6 +58,8 @@ wxBEGIN_EVENT_TABLE(E2wxFrame, wxFrame)
|
||||||
EVT_MENU(wxID_PASTE, E2wxFrame::OnPaste)
|
EVT_MENU(wxID_PASTE, E2wxFrame::OnPaste)
|
||||||
EVT_MENU(ID_MENUITEM_SCREEN_SHOT, E2wxFrame::OnScreenShot)
|
EVT_MENU(ID_MENUITEM_SCREEN_SHOT, E2wxFrame::OnScreenShot)
|
||||||
EVT_MENU(ID_MENUITEM_TOGGLE_BUFFERED, E2wxFrame::OnToggleBuffered)
|
EVT_MENU(ID_MENUITEM_TOGGLE_BUFFERED, E2wxFrame::OnToggleBuffered)
|
||||||
|
EVT_MENU(ID_MENUITEM_START_EMULATOR, E2wxFrame::OnStartEmulator)
|
||||||
|
EVT_MENU(ID_MENUITEM_STOP_EMULATOR, E2wxFrame::OnStopEmulator)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +88,11 @@ void E2wxFrame::InitMenuBar() {
|
||||||
|
|
||||||
wxMenu *menuFile = new wxMenu();
|
wxMenu *menuFile = new wxMenu();
|
||||||
menuBar->Append(menuFile, "&File");
|
menuBar->Append(menuFile, "&File");
|
||||||
|
wxMenuItem *miStart = menuFile->Append(ID_MENUITEM_START_EMULATOR, "Open Emulator");
|
||||||
|
miStart->SetAccel(new wxAcceleratorEntry(wxACCEL_CTRL, 'O'));
|
||||||
|
wxMenuItem *miStop = menuFile->Append(ID_MENUITEM_STOP_EMULATOR, "Close Emulator");
|
||||||
|
miStop->SetAccel(new wxAcceleratorEntry(wxACCEL_CTRL, 'W'));
|
||||||
|
menuFile->AppendSeparator();
|
||||||
wxMenuItem *miExit = menuFile->Append(wxID_EXIT);
|
wxMenuItem *miExit = menuFile->Append(wxID_EXIT);
|
||||||
miExit->AddExtraAccel(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_F9));
|
miExit->AddExtraAccel(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_F9));
|
||||||
|
|
||||||
|
@ -93,7 +102,7 @@ void E2wxFrame::InitMenuBar() {
|
||||||
miPaste->AddExtraAccel(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_F7));
|
miPaste->AddExtraAccel(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_F7));
|
||||||
menuEdit->AppendSeparator();
|
menuEdit->AppendSeparator();
|
||||||
wxMenuItem *miPrefs = menuEdit->Append(wxID_PREFERENCES);
|
wxMenuItem *miPrefs = menuEdit->Append(wxID_PREFERENCES);
|
||||||
miPrefs->SetAccel(new wxAcceleratorEntry(wxACCEL_CTRL, 44));
|
miPrefs->SetAccel(new wxAcceleratorEntry(wxACCEL_CTRL, ','));
|
||||||
|
|
||||||
|
|
||||||
wxMenu *menuMachine = new wxMenu();
|
wxMenu *menuMachine = new wxMenu();
|
||||||
|
@ -209,3 +218,11 @@ void E2wxFrame::OnScreenShot(wxCommandEvent& event) {
|
||||||
void E2wxFrame::OnToggleBuffered(wxCommandEvent& event) {
|
void E2wxFrame::OnToggleBuffered(wxCommandEvent& event) {
|
||||||
wxGetApp().ToggleBuffered();
|
wxGetApp().ToggleBuffered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void E2wxFrame::OnStartEmulator(wxCommandEvent& event) {
|
||||||
|
wxGetApp().StartEmulator();
|
||||||
|
}
|
||||||
|
|
||||||
|
void E2wxFrame::OnStopEmulator(wxCommandEvent& event){
|
||||||
|
wxGetApp().StopEmulator();
|
||||||
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ private:
|
||||||
void OnPaste(wxCommandEvent& event);
|
void OnPaste(wxCommandEvent& event);
|
||||||
void OnScreenShot(wxCommandEvent& event);
|
void OnScreenShot(wxCommandEvent& event);
|
||||||
void OnToggleBuffered(wxCommandEvent& event);
|
void OnToggleBuffered(wxCommandEvent& event);
|
||||||
|
void OnStartEmulator(wxCommandEvent& event);
|
||||||
|
void OnStopEmulator(wxCommandEvent& event);
|
||||||
|
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,14 +16,15 @@
|
||||||
#include "TransNetwork.h"
|
#include "TransNetwork.h"
|
||||||
#include "TransCache.h"
|
#include "TransCache.h"
|
||||||
#include "SegmentCache.h"
|
#include "SegmentCache.h"
|
||||||
#include <istream>
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
class AddressBus;
|
class AddressBus;
|
||||||
|
|
||||||
class Emu6502 : public AbstractCpu {
|
class Emu6502 : public AbstractCpu {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Emu6502(std::istream& transistors, AddressBus& mem) : tn(transistors, segs, transes), c(tn), trace(segs, transes, c), cpu(mem, trace, c), cpuhelper(cpu, c) {
|
Emu6502(std::filesystem::path& transistors, AddressBus& mem) : tn(transistors, segs, transes), c(tn), trace(segs, transes, c), cpu(mem, trace, c), cpuhelper(cpu, c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Emu6502() {
|
virtual ~Emu6502() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File: TransNetwork.cpp
|
* File: TransNetwork.cpp
|
||||||
* Author: cmosher
|
* Author: cmosher
|
||||||
*
|
*
|
||||||
* Created on December 11, 2013, 10:44 AM
|
* Created on December 11, 2013, 10:44 AM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -10,12 +10,20 @@
|
||||||
#include "SegmentCache.h"
|
#include "SegmentCache.h"
|
||||||
#include "StateCalculator.h"
|
#include "StateCalculator.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
|
#include "E2wxApp.h"
|
||||||
|
#include "e2filesystem.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
TransNetwork::TransNetwork(std::filesystem::path& p, SegmentCache& segs, TransCache& transes) : segs(segs), transes(transes) {
|
||||||
|
std::filesystem::path inpath = valid_input_file(p, wxGetApp().GetResDir());
|
||||||
|
|
||||||
|
std::ifstream in(inpath);
|
||||||
|
|
||||||
TransNetwork::TransNetwork(std::istream& in, SegmentCache& segs, TransCache& transes) : segs(segs), transes(transes) {
|
|
||||||
std::string c1, gate, c2;
|
std::string c1, gate, c2;
|
||||||
in >> c1 >> gate >> c2;
|
in >> c1 >> gate >> c2;
|
||||||
while (in.good()) {
|
while (in.good()) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#ifndef TRANSNETWORK_H
|
#ifndef TRANSNETWORK_H
|
||||||
#define TRANSNETWORK_H
|
#define TRANSNETWORK_H
|
||||||
|
|
||||||
#include <istream>
|
#include <filesystem>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class Trans;
|
||||||
class TransNetwork final {
|
class TransNetwork final {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TransNetwork(std::istream& readFromHere, SegmentCache& segs, TransCache& transes);
|
TransNetwork(std::filesystem::path& readFromHere, SegmentCache& segs, TransCache& transes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ cassetteOut(gui),
|
||||||
addressBus(gui, revision, ram, rom, kbd, videoMode, paddles, paddleButtonStates, speaker, cassetteIn, cassetteOut, slts),
|
addressBus(gui, revision, ram, rom, kbd, videoMode, paddles, paddleButtonStates, speaker, cassetteIn, cassetteOut, slts),
|
||||||
picgen(tv, videoMode, revision),
|
picgen(tv, videoMode, revision),
|
||||||
video(videoMode, addressBus, picgen, textRows),
|
video(videoMode, addressBus, picgen, textRows),
|
||||||
transistors("transistors"), // TODO load file from resources
|
transistors("transistors"),
|
||||||
cpu(nullptr),
|
cpu(nullptr),
|
||||||
powerUpReset(*this),
|
powerUpReset(*this),
|
||||||
revision(1) {
|
revision(1) {
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
#include "cassettein.h"
|
#include "cassettein.h"
|
||||||
#include "cassetteout.h"
|
#include "cassetteout.h"
|
||||||
#include "Emu6502.h"
|
#include "Emu6502.h"
|
||||||
#include <fstream>
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
class Emulator;
|
class Emulator;
|
||||||
class ScreenImage;
|
class ScreenImage;
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ class Apple2 : public Timable
|
||||||
PictureGenerator picgen;
|
PictureGenerator picgen;
|
||||||
TextCharacters textRows;
|
TextCharacters textRows;
|
||||||
Video video;
|
Video video;
|
||||||
std::ifstream transistors;
|
std::filesystem::path transistors;
|
||||||
AbstractCpu* cpu;
|
AbstractCpu* cpu;
|
||||||
PowerUpReset powerUpReset;
|
PowerUpReset powerUpReset;
|
||||||
int revision;
|
int revision;
|
||||||
|
|
Loading…
Reference in New Issue