From 4be8082c0df4cfaa58652622beb3b6941d90f609 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 27 Dec 2011 21:52:25 +0000 Subject: Initial solution layout. --- Noddybox.Emulation.EightBit/IDevice.cs | 34 +++++++ Noddybox.Emulation.EightBit/IMemory.cs | 33 +++++++ .../Noddybox.Emulation.EightBit.csproj | 66 ++++++++++++++ .../Noddybox.Emulation.EightBit.csproj.user | 12 +++ .../Properties/AssemblyInfo.cs | 37 ++++++++ Noddybox.Emulation.sln | 26 ++++++ Noddybox.Emulation/Clock.cs | 100 +++++++++++++++++++++ Noddybox.Emulation/Noddybox.Emulation.csproj | 65 ++++++++++++++ Noddybox.Emulation/Noddybox.Emulation.csproj.user | 12 +++ Noddybox.Emulation/Noddybox.Emulation.suo | Bin 0 -> 15872 bytes Noddybox.Emulation/Properties/AssemblyInfo.cs | 37 ++++++++ 11 files changed, 422 insertions(+) create mode 100644 Noddybox.Emulation.EightBit/IDevice.cs create mode 100644 Noddybox.Emulation.EightBit/IMemory.cs create mode 100644 Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj create mode 100644 Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj.user create mode 100644 Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs create mode 100644 Noddybox.Emulation.sln create mode 100644 Noddybox.Emulation/Clock.cs create mode 100644 Noddybox.Emulation/Noddybox.Emulation.csproj create mode 100644 Noddybox.Emulation/Noddybox.Emulation.csproj.user create mode 100644 Noddybox.Emulation/Noddybox.Emulation.suo create mode 100644 Noddybox.Emulation/Properties/AssemblyInfo.cs diff --git a/Noddybox.Emulation.EightBit/IDevice.cs b/Noddybox.Emulation.EightBit/IDevice.cs new file mode 100644 index 0000000..108adf9 --- /dev/null +++ b/Noddybox.Emulation.EightBit/IDevice.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 Noddybox.Emulation.EightBit +{ + /// + /// Provides an interface for devices for 8-bit processers which used special commands to access + /// devices rather than using memory-mapped IO, for example the Z80. + /// + public interface IDevice + { + /// + /// Read from a device. + /// + /// The address of the device. + /// The byte returned from the device. + byte Read(UInt16 device); + + /// + /// Write to a device. + /// + /// The address of the device. + /// The value to write to the device. + void Write(UInt16 device, byte value); + } +} diff --git a/Noddybox.Emulation.EightBit/IMemory.cs b/Noddybox.Emulation.EightBit/IMemory.cs new file mode 100644 index 0000000..5131eb0 --- /dev/null +++ b/Noddybox.Emulation.EightBit/IMemory.cs @@ -0,0 +1,33 @@ +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 Noddybox.Emulation.EightBit +{ + /// + /// Defines an interface for memory. + /// + public interface IMemory + { + /// + /// Reads a byte at a given address. + /// + /// The address to read. + /// The value at that address. + byte Read(UInt16 address); + + /// + /// Writes a byte at a given address. + /// + /// The address to write to. + /// The value to write. + void Write(UInt16 address, byte value); + } +} diff --git a/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj b/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj new file mode 100644 index 0000000..316b00b --- /dev/null +++ b/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj @@ -0,0 +1,66 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {ADC7A871-4DED-4A92-A447-2D784AB60FAF} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Noddybox.Emulation.EightBit + Noddybox.Emulation.EightBit + v4.0 + $(TargetFrameworkVersion) + WindowsPhone71 + Silverlight + false + true + true + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj.user b/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj.user new file mode 100644 index 0000000..cba5519 --- /dev/null +++ b/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj.user @@ -0,0 +1,12 @@ + + + + + + + True + + + + + \ No newline at end of file diff --git a/Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs b/Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a0de499 --- /dev/null +++ b/Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Noddybox.Emulation.EightBit")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Noddybox.Emulation.EightBit")] +[assembly: AssemblyCopyright("Copyright © 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c8c4f2cb-4b04-48a5-9add-a89b3995e00f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/Noddybox.Emulation.sln b/Noddybox.Emulation.sln new file mode 100644 index 0000000..78f38c7 --- /dev/null +++ b/Noddybox.Emulation.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Express for Windows Phone +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Noddybox.Emulation", "Noddybox.Emulation\Noddybox.Emulation.csproj", "{A2478066-4DFD-4042-BF98-963922DC97F8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Noddybox.Emulation.EightBit", "Noddybox.Emulation.EightBit\Noddybox.Emulation.EightBit.csproj", "{ADC7A871-4DED-4A92-A447-2D784AB60FAF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A2478066-4DFD-4042-BF98-963922DC97F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2478066-4DFD-4042-BF98-963922DC97F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2478066-4DFD-4042-BF98-963922DC97F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2478066-4DFD-4042-BF98-963922DC97F8}.Release|Any CPU.Build.0 = Release|Any CPU + {ADC7A871-4DED-4A92-A447-2D784AB60FAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADC7A871-4DED-4A92-A447-2D784AB60FAF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADC7A871-4DED-4A92-A447-2D784AB60FAF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADC7A871-4DED-4A92-A447-2D784AB60FAF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Noddybox.Emulation/Clock.cs b/Noddybox.Emulation/Clock.cs new file mode 100644 index 0000000..79beafb --- /dev/null +++ b/Noddybox.Emulation/Clock.cs @@ -0,0 +1,100 @@ +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 Noddybox.Emulation +{ + /// + /// Provides a basic clock implementation that is geared towards the VBL. + /// + public class Clock + { + #region Private fields + + private uint perSecond; + private uint perFrame; + private uint perLine; + private uint frameCount; + + #endregion + + #region Public properties + + /// + /// Returns true if the frame has finished. + /// + public bool FrameDone + { + get + { + return frameCount > perFrame; + } + } + + /// + /// Returns the current raster line. + /// + public uint RasterLine + { + get + { + return frameCount / perLine; + } + } + + #endregion + + #region Public members + + /// + /// Starts a new frame. + /// + public void StartFrame() + { + if (FrameDone) + { + frameCount -= perFrame; + } + } + + #endregion + + #region Constructors + + /// + /// Defines a clock. + /// + /// The number of ticks per second. + /// The number of frames per second. + public Clock(uint ticksPerSecond, uint framesPerSecond) + { + this.perSecond = ticksPerSecond; + this.perFrame = ticksPerSecond / framesPerSecond; + this.perLine = 1; + this.frameCount = 0; + } + + /// + /// Defines a clock. + /// + /// The number of ticks per second. + /// The number of frames per second. + /// The number of clock ticks per raster line. + public Clock(uint ticksPerSecond, uint framesPerSecond, uint ticksPerLine) + { + this.perSecond = ticksPerSecond; + this.perFrame = ticksPerSecond / framesPerSecond; + this.perLine = ticksPerLine; + this.frameCount = 0; + } + + #endregion + } +} diff --git a/Noddybox.Emulation/Noddybox.Emulation.csproj b/Noddybox.Emulation/Noddybox.Emulation.csproj new file mode 100644 index 0000000..040aa44 --- /dev/null +++ b/Noddybox.Emulation/Noddybox.Emulation.csproj @@ -0,0 +1,65 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {A2478066-4DFD-4042-BF98-963922DC97F8} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Noddybox.Emulation + Noddybox.Emulation + v4.0 + $(TargetFrameworkVersion) + WindowsPhone71 + Silverlight + false + true + true + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Noddybox.Emulation/Noddybox.Emulation.csproj.user b/Noddybox.Emulation/Noddybox.Emulation.csproj.user new file mode 100644 index 0000000..cba5519 --- /dev/null +++ b/Noddybox.Emulation/Noddybox.Emulation.csproj.user @@ -0,0 +1,12 @@ + + + + + + + True + + + + + \ No newline at end of file diff --git a/Noddybox.Emulation/Noddybox.Emulation.suo b/Noddybox.Emulation/Noddybox.Emulation.suo new file mode 100644 index 0000000..0f14302 Binary files /dev/null and b/Noddybox.Emulation/Noddybox.Emulation.suo differ diff --git a/Noddybox.Emulation/Properties/AssemblyInfo.cs b/Noddybox.Emulation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d5a5343 --- /dev/null +++ b/Noddybox.Emulation/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Noddybox.Emulation")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Noddybox.Emulation")] +[assembly: AssemblyCopyright("Copyright © 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9fc20d24-5257-4661-8f14-6ce15dff1ac8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: NeutralResourcesLanguageAttribute("en-US")] -- cgit v1.2.3