summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2011-12-27 21:52:25 +0000
committerIan C <ianc@noddybox.co.uk>2011-12-27 21:52:25 +0000
commit4be8082c0df4cfaa58652622beb3b6941d90f609 (patch)
tree5e5bf1a8730486038d595e5a08fce99b68f2b4ab
parentd5492b9b6903e32cb7b7cca0e54185074e6d68ba (diff)
Initial solution layout.
-rw-r--r--Noddybox.Emulation.EightBit/IDevice.cs34
-rw-r--r--Noddybox.Emulation.EightBit/IMemory.cs33
-rw-r--r--Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj66
-rw-r--r--Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj.user12
-rw-r--r--Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs37
-rw-r--r--Noddybox.Emulation.sln26
-rw-r--r--Noddybox.Emulation/Clock.cs100
-rw-r--r--Noddybox.Emulation/Noddybox.Emulation.csproj65
-rw-r--r--Noddybox.Emulation/Noddybox.Emulation.csproj.user12
-rw-r--r--Noddybox.Emulation/Noddybox.Emulation.suobin0 -> 15872 bytes
-rw-r--r--Noddybox.Emulation/Properties/AssemblyInfo.cs37
11 files changed, 422 insertions, 0 deletions
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
+{
+ /// <summary>
+ /// 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.
+ /// </summary>
+ public interface IDevice
+ {
+ /// <summary>
+ /// Read from a device.
+ /// </summary>
+ /// <param name="device">The address of the device.</param>
+ /// <returns>The byte returned from the device.</returns>
+ byte Read(UInt16 device);
+
+ /// <summary>
+ /// Write to a device.
+ /// </summary>
+ /// <param name="device">The address of the device.</param>
+ /// <param name="value">The value to write to the device.</param>
+ 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
+{
+ /// <summary>
+ /// Defines an interface for memory.
+ /// </summary>
+ public interface IMemory
+ {
+ /// <summary>
+ /// Reads a byte at a given address.
+ /// </summary>
+ /// <param name="address">The address to read.</param>
+ /// <returns>The value at that address.</returns>
+ byte Read(UInt16 address);
+
+ /// <summary>
+ /// Writes a byte at a given address.
+ /// </summary>
+ /// <param name="address">The address to write to.</param>
+ /// <param name="value">The value to write.</param>
+ 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.20506</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{ADC7A871-4DED-4A92-A447-2D784AB60FAF}</ProjectGuid>
+ <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Noddybox.Emulation.EightBit</RootNamespace>
+ <AssemblyName>Noddybox.Emulation.EightBit</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+ <TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
+ <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
+ <SilverlightApplication>false</SilverlightApplication>
+ <ValidateXaml>true</ValidateXaml>
+ <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>Bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>Bin\Release</OutputPath>
+ <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System.Windows" />
+ <Reference Include="system" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Net" />
+ <Reference Include="mscorlib.extensions" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="IDevice.cs" />
+ <Compile Include="IMemory.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
+ <ProjectExtensions />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{C089C8C0-30E0-4E22-80C0-CE093F111A43}">
+ <SilverlightMobileCSProjectFlavor>
+ <FullDeploy>True</FullDeploy>
+ </SilverlightMobileCSProjectFlavor>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ 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
+{
+ /// <summary>
+ /// Provides a basic clock implementation that is geared towards the VBL.
+ /// </summary>
+ public class Clock
+ {
+ #region Private fields
+
+ private uint perSecond;
+ private uint perFrame;
+ private uint perLine;
+ private uint frameCount;
+
+ #endregion
+
+ #region Public properties
+
+ /// <summary>
+ /// Returns true if the frame has finished.
+ /// </summary>
+ public bool FrameDone
+ {
+ get
+ {
+ return frameCount > perFrame;
+ }
+ }
+
+ /// <summary>
+ /// Returns the current raster line.
+ /// </summary>
+ public uint RasterLine
+ {
+ get
+ {
+ return frameCount / perLine;
+ }
+ }
+
+ #endregion
+
+ #region Public members
+
+ /// <summary>
+ /// Starts a new frame.
+ /// </summary>
+ public void StartFrame()
+ {
+ if (FrameDone)
+ {
+ frameCount -= perFrame;
+ }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Defines a clock.
+ /// </summary>
+ /// <param name="ticksPerSecond">The number of ticks per second.</param>
+ /// <param name="framesPerSecond">The number of frames per second.</param>
+ public Clock(uint ticksPerSecond, uint framesPerSecond)
+ {
+ this.perSecond = ticksPerSecond;
+ this.perFrame = ticksPerSecond / framesPerSecond;
+ this.perLine = 1;
+ this.frameCount = 0;
+ }
+
+ /// <summary>
+ /// Defines a clock.
+ /// </summary>
+ /// <param name="ticksPerSecond">The number of ticks per second.</param>
+ /// <param name="framesPerSecond">The number of frames per second.</param>
+ /// <param name="ticksPerLine">The number of clock ticks per raster line.</param>
+ 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.20506</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A2478066-4DFD-4042-BF98-963922DC97F8}</ProjectGuid>
+ <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Noddybox.Emulation</RootNamespace>
+ <AssemblyName>Noddybox.Emulation</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+ <TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
+ <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
+ <SilverlightApplication>false</SilverlightApplication>
+ <ValidateXaml>true</ValidateXaml>
+ <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>Bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>Bin\Release</OutputPath>
+ <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System.Windows" />
+ <Reference Include="system" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Net" />
+ <Reference Include="mscorlib.extensions" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Clock.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
+ <ProjectExtensions />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{C089C8C0-30E0-4E22-80C0-CE093F111A43}">
+ <SilverlightMobileCSProjectFlavor>
+ <FullDeploy>True</FullDeploy>
+ </SilverlightMobileCSProjectFlavor>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ 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
--- /dev/null
+++ b/Noddybox.Emulation/Noddybox.Emulation.suo
Binary files 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")]