diff --git a/Breaknes/Breaknes/FormMain.cs b/Breaknes/Breaknes/FormMain.cs index cb40dd41..edc6a708 100644 --- a/Breaknes/Breaknes/FormMain.cs +++ b/Breaknes/Breaknes/FormMain.cs @@ -48,6 +48,7 @@ private void loadROMDumpToolStripMenuItem_Click(object sender, EventArgs e) if (openFileDialog1.ShowDialog() == DialogResult.OK) { string filename = openFileDialog1.FileName; + board.Paused = true; board.EjectCartridge(); if (board.InsertCartridge(filename) < 0) { @@ -78,12 +79,17 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e) private void Settings_FormClosed(object? sender, FormClosedEventArgs e) { - board.Paused = true; - board.EjectCartridge(); - board.DisposeBoard(); - var settings = FormSettings.LoadSettings(); - board.CreateBoard(BoardDescriptionLoader.Load(), settings.MainBoard); - Text = original_title; + FormSettings form_settings = (FormSettings)sender; + + if (form_settings.PurgeBoard) + { + board.Paused = true; + board.EjectCartridge(); + board.DisposeBoard(); + var settings = FormSettings.LoadSettings(); + board.CreateBoard(BoardDescriptionLoader.Load(), settings.MainBoard); + Text = original_title; + } } private void openDebuggerToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/Breaknes/Breaknes/FormSettings.cs b/Breaknes/Breaknes/FormSettings.cs index 969807f6..8c3bab2d 100644 --- a/Breaknes/Breaknes/FormSettings.cs +++ b/Breaknes/Breaknes/FormSettings.cs @@ -5,6 +5,9 @@ namespace Breaknes { public partial class FormSettings : Form { + public bool PurgeBoard = false; + private string prev_board; + public FormSettings() { InitializeComponent(); @@ -59,13 +62,17 @@ static BreaknesSettings SetDefaultSettings() private void FormSettings_Load(object sender, EventArgs e) { - propertyGrid1.SelectedObject = LoadSettings(); + var settings = LoadSettings(); + prev_board = settings.MainBoard; + propertyGrid1.SelectedObject = settings; } private void button1_Click(object sender, EventArgs e) { - SaveSettings((BreaknesSettings)propertyGrid1.SelectedObject); + BreaknesSettings settings = (BreaknesSettings)propertyGrid1.SelectedObject; + SaveSettings(settings); Close(); + PurgeBoard = settings.MainBoard != prev_board; } private void FormSettings_KeyDown(object sender, KeyEventArgs e) diff --git a/Breaknes/Breaknes/VideoProcessing.cs b/Breaknes/Breaknes/VideoProcessing.cs index e362000b..66467317 100644 --- a/Breaknes/Breaknes/VideoProcessing.cs +++ b/Breaknes/Breaknes/VideoProcessing.cs @@ -22,6 +22,8 @@ public class VideoRender private OnRenderField? onRenderField = null; public delegate void OnRenderField(); + private long field_counter = 0; + public VideoRender(OnRenderField _onRender) { onRenderField = _onRender; @@ -146,6 +148,8 @@ void VisualizeField() } gr.Dispose(); + field_counter++; + onRenderField?.Invoke(); } } diff --git a/BreaksAPU/APUSim/Readme.md b/BreaksAPU/APUSim/Readme.md index d3355dff..d01cd667 100644 --- a/BreaksAPU/APUSim/Readme.md +++ b/BreaksAPU/APUSim/Readme.md @@ -2,6 +2,8 @@ APU simulator at the gate level. +Note: In the Breaks project, the term APU refers to the entire CPU chip (2A03/2A07), which includes the 6502 core and the APU itself. Therefore, here APU and CPU are synonymous. + ## Simulation Approaches In general, all approaches are tried on the M6502Core, in terms of APU nothing particularly new. We take the circuit and repeat its work in C++. In the beginning somehow, and then we try to optimize it. diff --git a/UnitTest/Readme.md b/UnitTest/Readme.md index b86fd43e..b307ab1f 100644 --- a/UnitTest/Readme.md +++ b/UnitTest/Readme.md @@ -9,3 +9,20 @@ Each emulated chip class contains a friendly class that has access to all intern - M6502Core: M6502CoreUnitTest::UnitTest - APUSim: APUSimUnitTest::UnitTest - PPUSim: PPUSimUnitTest::UnitTest + +## MegaCycles + +Right now there are three tests that are not running successfully. They are used to measure the performance of the 6502 Core, APU and PPU. + +Current performance: + +``` +Core executed 1789772 cycles in real 2282 msec +You're 2.28 times slower :( + +APU+Core executed 21477272 cycles in real 18297 msec +You're 18.30 times slower :( + +PPU executed 21477272 cycles in real 21828 msec +You're 21.83 times slower :( +``` diff --git a/UnitTest/UnitTest.cpp b/UnitTest/UnitTest.cpp index e3b55712..2910da58 100644 --- a/UnitTest/UnitTest.cpp +++ b/UnitTest/UnitTest.cpp @@ -83,9 +83,9 @@ namespace UnitTest Assert::IsTrue(ut.DumpDecoder()); } - BEGIN_TEST_METHOD_ATTRIBUTE(TestCoreMegaCycles) - TEST_IGNORE() - END_TEST_METHOD_ATTRIBUTE() + //BEGIN_TEST_METHOD_ATTRIBUTE(TestCoreMegaCycles) + // TEST_IGNORE() + //END_TEST_METHOD_ATTRIBUTE() TEST_METHOD(TestCoreMegaCycles) { M6502CoreUnitTest::UnitTest ut; @@ -146,9 +146,9 @@ namespace UnitTest Assert::IsTrue(ut.TestOAM_DMA()); } - BEGIN_TEST_METHOD_ATTRIBUTE(TestApuMegaCycles) - TEST_IGNORE() - END_TEST_METHOD_ATTRIBUTE() + //BEGIN_TEST_METHOD_ATTRIBUTE(TestApuMegaCycles) + // TEST_IGNORE() + //END_TEST_METHOD_ATTRIBUTE() TEST_METHOD(TestApuMegaCycles) { APUSimUnitTest::UnitTest ut(APUSim::Revision::RP2A03G); @@ -294,9 +294,9 @@ namespace UnitTest ut.Dump_2C04_0003_ColorSpace(); } - BEGIN_TEST_METHOD_ATTRIBUTE(TestPpuMegaCycles) - TEST_IGNORE() - END_TEST_METHOD_ATTRIBUTE() + //BEGIN_TEST_METHOD_ATTRIBUTE(TestPpuMegaCycles) + // TEST_IGNORE() + //END_TEST_METHOD_ATTRIBUTE() TEST_METHOD(TestPpuMegaCycles) { PPUSimUnitTest::UnitTest ut(PPUSim::Revision::RP2C02G);