From f479591c593e7b8a7a98f86d81d3a9c9a9d47a91 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 26 Mar 2012 22:58:23 +0000 Subject: Done some work on the disassembler page. --- WPZX81.sln | 12 ++ WPZX81/WPZX81/BaseViewModel.cs | 67 ++++++++ WPZX81/WPZX81/DisassemblerLine.cs | 34 ++++ WPZX81/WPZX81/DisassemblerPage.xaml | 226 ++++++++++++++++++++++++ WPZX81/WPZX81/DisassemblerPage.xaml.cs | 50 ++++++ WPZX81/WPZX81/DisassemblerViewModel.cs | 258 ++++++++++++++++++++++++++++ WPZX81/WPZX81/MainPage.xaml | 4 +- WPZX81/WPZX81/MainPage.xaml.cs | 4 +- WPZX81/WPZX81/Resources/Strings.Designer.cs | 63 +++++-- WPZX81/WPZX81/Resources/Strings.resx | 17 +- WPZX81/WPZX81/WPZX81.csproj | 14 ++ WPZX81/WPZX81/ZX81/Emulation.cs | 98 +++++++---- 12 files changed, 790 insertions(+), 57 deletions(-) create mode 100644 WPZX81/WPZX81/BaseViewModel.cs create mode 100644 WPZX81/WPZX81/DisassemblerLine.cs create mode 100644 WPZX81/WPZX81/DisassemblerPage.xaml create mode 100644 WPZX81/WPZX81/DisassemblerPage.xaml.cs create mode 100644 WPZX81/WPZX81/DisassemblerViewModel.cs diff --git a/WPZX81.sln b/WPZX81.sln index 1a860f0..4d26e48 100644 --- a/WPZX81.sln +++ b/WPZX81.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Noddybox.Emulation.EightBit EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Noddybox.Emulation.EightBit.Z80", "..\Noddybox.Emulation\WindowsPhone\Noddybox.Emulation.EightBit.Z80\Noddybox.Emulation.EightBit.Z80.csproj", "{7F257886-40D3-4E2A-BA9C-C5FEE93C08E9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Noddybox.Emulation.EightBit.Z80.Disassembler", "..\Noddybox.Emulation\WindowsPhone\Noddybox.Emulation.EightBit.Z80.Disassembler\Noddybox.Emulation.EightBit.Z80.Disassembler.csproj", "{08D7120E-3D84-49D2-B73D-255E5DB9655C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -83,6 +85,16 @@ Global {7F257886-40D3-4E2A-BA9C-C5FEE93C08E9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {7F257886-40D3-4E2A-BA9C-C5FEE93C08E9}.Release|Mixed Platforms.Build.0 = Release|Any CPU {7F257886-40D3-4E2A-BA9C-C5FEE93C08E9}.Release|Windows Phone.ActiveCfg = Release|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Debug|Windows Phone.ActiveCfg = Debug|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Release|Any CPU.Build.0 = Release|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {08D7120E-3D84-49D2-B73D-255E5DB9655C}.Release|Windows Phone.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WPZX81/WPZX81/BaseViewModel.cs b/WPZX81/WPZX81/BaseViewModel.cs new file mode 100644 index 0000000..ae729e6 --- /dev/null +++ b/WPZX81/WPZX81/BaseViewModel.cs @@ -0,0 +1,67 @@ +using System; +using System.ComponentModel; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Ink; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; + +namespace WPZX81 +{ + /// + /// Provides a base for view models. + /// + public class BaseViewModel : INotifyPropertyChanged + { + + #region SetValue + + /// + /// Sets a value in the model. + /// + /// The type of the value. + /// A reference to the member variable. + /// The new value. + /// The propertys to change if the value has changed. + protected void SetValue(ref T member, T value, params string[] names) + { + if (!value.Equals(member)) + { + member = value; + + foreach (string name in names) + { + NotifyPropertyChanged(name); + } + } + } + + #endregion + + #region Notify + + /// + /// Notifies handlers of a property change. + /// + /// The property's name. + protected void NotifyPropertyChanged(string propertyName) + { + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + #endregion + + #region INotifyPropertyChanged Members + + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + } +} diff --git a/WPZX81/WPZX81/DisassemblerLine.cs b/WPZX81/WPZX81/DisassemblerLine.cs new file mode 100644 index 0000000..6618fc1 --- /dev/null +++ b/WPZX81/WPZX81/DisassemblerLine.cs @@ -0,0 +1,34 @@ +using System; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Ink; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; + +namespace WPZX81 +{ + /// + /// Represents a line of disassembly. + /// + public class DisassemblerLine + { + /// + /// The address part. + /// + public string Address {get; set;} + + /// + /// The assembly opcode part. + /// + public string Opcode {get; set;} + + /// + /// The hexdump part. + /// + public string Hexdump {get; set;} + } +} diff --git a/WPZX81/WPZX81/DisassemblerPage.xaml b/WPZX81/WPZX81/DisassemblerPage.xaml new file mode 100644 index 0000000..3c87af6 --- /dev/null +++ b/WPZX81/WPZX81/DisassemblerPage.xaml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +