mirror of
https://github.com/cmosher01/Epple-II.git
synced 2025-01-13 06:29:50 +00:00
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);
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Deleting emulator instance...";
|
||||
if (this->emu_timer) {
|
||||
delete this->emu_timer;
|
||||
this->emu_timer = nullptr;
|
||||
}
|
||||
if (this->emu) {
|
||||
delete this->emu;
|
||||
this->emu = nullptr;
|
||||
}
|
||||
StopEmulator();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Application OnExit complete.";
|
||||
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() {
|
||||
if (this->emu_timer) {
|
||||
delete this->emu_timer;
|
||||
}
|
||||
if (this->emu) {
|
||||
delete this->emu;
|
||||
}
|
||||
StopEmulator();
|
||||
|
||||
this->emu = new Emulator();
|
||||
E2Config cfg{this->arg_configfile, this->opt_config_from_prefs_only};
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
const std::filesystem::path GetDocumentsDir() const;
|
||||
|
||||
void StartEmulator();
|
||||
void StopEmulator();
|
||||
|
||||
void OnFnKeyPressed(const SDL_Keycode k);
|
||||
|
||||
|
@ -41,6 +41,8 @@ enum E2MenuID {
|
||||
ID_MENUITEM_RESET,
|
||||
ID_MENUITEM_SCREEN_SHOT,
|
||||
ID_MENUITEM_TOGGLE_BUFFERED,
|
||||
ID_MENUITEM_START_EMULATOR,
|
||||
ID_MENUITEM_STOP_EMULATOR,
|
||||
};
|
||||
|
||||
wxBEGIN_EVENT_TABLE(E2wxFrame, wxFrame)
|
||||
@ -56,6 +58,8 @@ wxBEGIN_EVENT_TABLE(E2wxFrame, wxFrame)
|
||||
EVT_MENU(wxID_PASTE, E2wxFrame::OnPaste)
|
||||
EVT_MENU(ID_MENUITEM_SCREEN_SHOT, E2wxFrame::OnScreenShot)
|
||||
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()
|
||||
|
||||
|
||||
@ -84,6 +88,11 @@ void E2wxFrame::InitMenuBar() {
|
||||
|
||||
wxMenu *menuFile = new wxMenu();
|
||||
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);
|
||||
miExit->AddExtraAccel(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_F9));
|
||||
|
||||
@ -93,7 +102,7 @@ void E2wxFrame::InitMenuBar() {
|
||||
miPaste->AddExtraAccel(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_F7));
|
||||
menuEdit->AppendSeparator();
|
||||
wxMenuItem *miPrefs = menuEdit->Append(wxID_PREFERENCES);
|
||||
miPrefs->SetAccel(new wxAcceleratorEntry(wxACCEL_CTRL, 44));
|
||||
miPrefs->SetAccel(new wxAcceleratorEntry(wxACCEL_CTRL, ','));
|
||||
|
||||
|
||||
wxMenu *menuMachine = new wxMenu();
|
||||
@ -209,3 +218,11 @@ void E2wxFrame::OnScreenShot(wxCommandEvent& event) {
|
||||
void E2wxFrame::OnToggleBuffered(wxCommandEvent& event) {
|
||||
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 OnScreenShot(wxCommandEvent& event);
|
||||
void OnToggleBuffered(wxCommandEvent& event);
|
||||
void OnStartEmulator(wxCommandEvent& event);
|
||||
void OnStopEmulator(wxCommandEvent& event);
|
||||
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
@ -16,14 +16,15 @@
|
||||
#include "TransNetwork.h"
|
||||
#include "TransCache.h"
|
||||
#include "SegmentCache.h"
|
||||
#include <istream>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
class AddressBus;
|
||||
|
||||
class Emu6502 : public AbstractCpu {
|
||||
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() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
/*
|
||||
* File: TransNetwork.cpp
|
||||
* Author: cmosher
|
||||
*
|
||||
*
|
||||
* Created on December 11, 2013, 10:44 AM
|
||||
*/
|
||||
|
||||
@ -10,12 +10,20 @@
|
||||
#include "SegmentCache.h"
|
||||
#include "StateCalculator.h"
|
||||
#include "trans.h"
|
||||
#include "E2wxApp.h"
|
||||
#include "e2filesystem.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#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;
|
||||
in >> c1 >> gate >> c2;
|
||||
while (in.good()) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef TRANSNETWORK_H
|
||||
#define TRANSNETWORK_H
|
||||
|
||||
#include <istream>
|
||||
#include <filesystem>
|
||||
#include <set>
|
||||
#include <memory>
|
||||
|
||||
@ -20,7 +20,7 @@ class Trans;
|
||||
class TransNetwork final {
|
||||
public:
|
||||
|
||||
TransNetwork(std::istream& readFromHere, SegmentCache& segs, TransCache& transes);
|
||||
TransNetwork(std::filesystem::path& readFromHere, SegmentCache& segs, TransCache& transes);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -48,7 +48,7 @@ cassetteOut(gui),
|
||||
addressBus(gui, revision, ram, rom, kbd, videoMode, paddles, paddleButtonStates, speaker, cassetteIn, cassetteOut, slts),
|
||||
picgen(tv, videoMode, revision),
|
||||
video(videoMode, addressBus, picgen, textRows),
|
||||
transistors("transistors"), // TODO load file from resources
|
||||
transistors("transistors"),
|
||||
cpu(nullptr),
|
||||
powerUpReset(*this),
|
||||
revision(1) {
|
||||
|
@ -38,7 +38,9 @@
|
||||
#include "cassettein.h"
|
||||
#include "cassetteout.h"
|
||||
#include "Emu6502.h"
|
||||
#include <fstream>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
class Emulator;
|
||||
class ScreenImage;
|
||||
|
||||
@ -57,7 +59,7 @@ class Apple2 : public Timable
|
||||
PictureGenerator picgen;
|
||||
TextCharacters textRows;
|
||||
Video video;
|
||||
std::ifstream transistors;
|
||||
std::filesystem::path transistors;
|
||||
AbstractCpu* cpu;
|
||||
PowerUpReset powerUpReset;
|
||||
int revision;
|
||||
|
Loading…
x
Reference in New Issue
Block a user