From 8d6d3cc62da1ffa45b8520b9078d701d89eb60f6 Mon Sep 17 00:00:00 2001 From: Chris Anders Date: Sun, 27 Oct 2024 10:38:02 +0100 Subject: [PATCH] feat: Add bus activations for display --- .../Wrappers/DisplayWrapper.axaml | 4 +- .../MimaSim/Controls/MimaControl.axaml | 2 +- src/MimaSim/MimaSim/MIMA/Components/CPU.cs | 13 +++++++ src/MimaSim/MimaSim/MIMA/Components/Clock.cs | 8 ++-- src/MimaSim/MimaSim/Resources/BusMap.xml | 37 +++++++++++++++++-- 5 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/MimaSim/MimaSim/Controls/MimaComponents/Wrappers/DisplayWrapper.axaml b/src/MimaSim/MimaSim/Controls/MimaComponents/Wrappers/DisplayWrapper.axaml index f1b48f4..088fbba 100644 --- a/src/MimaSim/MimaSim/Controls/MimaComponents/Wrappers/DisplayWrapper.axaml +++ b/src/MimaSim/MimaSim/Controls/MimaComponents/Wrappers/DisplayWrapper.axaml @@ -10,8 +10,8 @@ - - + + diff --git a/src/MimaSim/MimaSim/Controls/MimaControl.axaml b/src/MimaSim/MimaSim/Controls/MimaControl.axaml index 31cd2d6..9578b64 100644 --- a/src/MimaSim/MimaSim/Controls/MimaControl.axaml +++ b/src/MimaSim/MimaSim/Controls/MimaControl.axaml @@ -19,7 +19,7 @@ - + \ No newline at end of file diff --git a/src/MimaSim/MimaSim/MIMA/Components/CPU.cs b/src/MimaSim/MimaSim/MIMA/Components/CPU.cs index de91a78..2832e2c 100644 --- a/src/MimaSim/MimaSim/MIMA/Components/CPU.cs +++ b/src/MimaSim/MimaSim/MIMA/Components/CPU.cs @@ -47,6 +47,19 @@ public CPU() BusRegistry.ActivateBus("controlunit_sp"); }); + Display.DX.Bus.Subscribe(_ => + { + BusRegistry.Activate("cu->dx"); + }); + Display.DY.Bus.Subscribe(_ => + { + BusRegistry.Activate("cu->dy"); + }); + Display.DC.Bus.Subscribe(_ => + { + BusRegistry.Activate("cu->dc"); + }); + X.Bus.Subscribe(_ => { BusRegistry.Activate("cu->x"); diff --git a/src/MimaSim/MimaSim/MIMA/Components/Clock.cs b/src/MimaSim/MimaSim/MIMA/Components/Clock.cs index 3511605..be01725 100644 --- a/src/MimaSim/MimaSim/MIMA/Components/Clock.cs +++ b/src/MimaSim/MimaSim/MIMA/Components/Clock.cs @@ -14,6 +14,8 @@ public Clock(short frequency) _frequency = frequency; _timer = new Timer(_frequency); _timer.Elapsed += _timer_Elapsed; + + Stoped += BusRegistry.DeactivateAll; } public event Action FrequencyChanged; @@ -41,10 +43,8 @@ public void Stop() private void _timer_Elapsed(object sender, ElapsedEventArgs e) { - CPU.Instance.Step(); - - System.Threading.Thread.Sleep(10); - BusRegistry.DeactivateAll(); + + CPU.Instance.Step(); } } \ No newline at end of file diff --git a/src/MimaSim/MimaSim/Resources/BusMap.xml b/src/MimaSim/MimaSim/Resources/BusMap.xml index c7d669a..fa8fc23 100644 --- a/src/MimaSim/MimaSim/Resources/BusMap.xml +++ b/src/MimaSim/MimaSim/Resources/BusMap.xml @@ -1,20 +1,20 @@ - + - + - + - + @@ -23,4 +23,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file