summaryrefslogtreecommitdiff
path: root/Noddybox.Emulation.EightBit
diff options
context:
space:
mode:
Diffstat (limited to 'Noddybox.Emulation.EightBit')
-rw-r--r--Noddybox.Emulation.EightBit/Binary.cs63
-rw-r--r--Noddybox.Emulation.EightBit/ICpu.cs57
-rw-r--r--Noddybox.Emulation.EightBit/IDevice.cs37
-rw-r--r--Noddybox.Emulation.EightBit/IMemory.cs36
-rw-r--r--Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj75
-rw-r--r--Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs37
-rw-r--r--Noddybox.Emulation.EightBit/Register16.cs88
7 files changed, 0 insertions, 393 deletions
diff --git a/Noddybox.Emulation.EightBit/Binary.cs b/Noddybox.Emulation.EightBit/Binary.cs
deleted file mode 100644
index 0b1928b..0000000
--- a/Noddybox.Emulation.EightBit/Binary.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-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 helpers for shifting smaller values around without casts all over the shop.
- /// </summary>
- public static class Binary
- {
- /// <summary>
- /// Shift 8-bits to the left.
- /// </summary>
- /// <param name="b">The byte.</param>
- /// <param name="shift">How many bits to shift.</param>
- /// <returns>The shifted value.</returns>
- public static byte ShiftLeft(byte b, int shift)
- {
- return (byte)((b << shift) & 0xff);
- }
-
- /// <summary>
- /// Shift 8-bits to the right.
- /// </summary>
- /// <param name="b">The byte.</param>
- /// <param name="shift">How many bits to shift.</param>
- /// <returns>The shifted value.</returns>
- public static byte ShiftRight(byte b, int shift)
- {
- return (byte)((b >> shift) & 0xff);
- }
-
- /// <summary>
- /// Shift 16-bits to the left.
- /// </summary>
- /// <param name="w">The word.</param>
- /// <param name="shift">How many bits to shift.</param>
- /// <returns>The shifted value.</returns>
- public static ushort ShiftLeft(ushort w, int shift)
- {
- return (ushort)((w << shift) & 0xffff);
- }
-
- /// <summary>
- /// Shift 16-bits to the right.
- /// </summary>
- /// <param name="w">The word.</param>
- /// <param name="shift">How many bits to shift.</param>
- /// <returns>The shifted value.</returns>
- public static ushort ShiftRight(ushort w, int shift)
- {
- return (ushort)((w >> shift) & 0xffff);
- }
- }
-}
diff --git a/Noddybox.Emulation.EightBit/ICpu.cs b/Noddybox.Emulation.EightBit/ICpu.cs
deleted file mode 100644
index dc2f811..0000000
--- a/Noddybox.Emulation.EightBit/ICpu.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// Copyright (c) 2012 Ian Cowburn
-//
-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 8-bit CPU.
- /// </summary>
- public interface ICpu
- {
- /// <summary>
- /// Initialise the CPU to give it access to memory and devices.
- /// </summary>
- /// <param name="memory">The memory to access.</param>
- /// <param name="device">The devices to access.</param>
- /// <param name="clock">The clock to use.</param>
- void Initialise(IMemory memory, IDevice device, Clock clock);
-
- /// <summary>
- /// Resets the CPU to its initial state.
- /// </summary>
- void Reset();
-
- /// <summary>
- /// Runs the next instruction.
- /// </summary>
- void Step();
-
- /// <summary>
- /// Runs the CPU until the next frame flyback.
- /// </summary>
- void Run();
-
- /// <summary>
- /// Generates a maskable interrupt to the CPU.
- /// </summary>
- /// <param name="value">Optional value from an interrupting device. May be ignored depending on the CPU type.</param>
- void MaskableInterrupt(byte value);
-
- /// <summary>
- /// Generates a non-maskable interrupt to the CPU.
- /// </summary>
- /// <param name="value">Optional value from an interrupting device. May be ignored depending on the CPU type.</param>
- void NonMaskableInterrupt(byte value);
- }
-}
diff --git a/Noddybox.Emulation.EightBit/IDevice.cs b/Noddybox.Emulation.EightBit/IDevice.cs
deleted file mode 100644
index b8d234a..0000000
--- a/Noddybox.Emulation.EightBit/IDevice.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright (c) 2012 Ian Cowburn
-//
-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(ushort 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(ushort device, byte value);
- }
-}
diff --git a/Noddybox.Emulation.EightBit/IMemory.cs b/Noddybox.Emulation.EightBit/IMemory.cs
deleted file mode 100644
index 2aa63d9..0000000
--- a/Noddybox.Emulation.EightBit/IMemory.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Copyright (c) 2012 Ian Cowburn
-//
-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(ushort 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(ushort address, byte value);
- }
-}
diff --git a/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj b/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj
deleted file mode 100644
index 2136f3c..0000000
--- a/Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj
+++ /dev/null
@@ -1,75 +0,0 @@
-<?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="Binary.cs" />
- <Compile Include="ICpu.cs" />
- <Compile Include="IDevice.cs" />
- <Compile Include="IMemory.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Register16.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Noddybox.Emulation\Noddybox.Emulation.csproj">
- <Project>{A2478066-4DFD-4042-BF98-963922DC97F8}</Project>
- <Name>Noddybox.Emulation</Name>
- </ProjectReference>
- </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/Properties/AssemblyInfo.cs b/Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs
deleted file mode 100644
index a0de499..0000000
--- a/Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-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.EightBit/Register16.cs b/Noddybox.Emulation.EightBit/Register16.cs
deleted file mode 100644
index 06c9c01..0000000
--- a/Noddybox.Emulation.EightBit/Register16.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// Copyright (c) 2012 Ian Cowburn
-//
-using System;
-using System.Runtime.InteropServices;
-
-namespace Noddybox.Emulation.EightBit
-{
- /// <summary>
- /// Provides a common 8-bit register pattern, which is two 8-bit registers rolled into one.
- /// While this could be done at runtime using <see cref="BitConverter.IsLittleEndian"/> this
- /// method was chosen for speed reasons; interfaces cannot define fields, which is sensible
- /// enoough, but accessing fields directly would allow ref variables to be used with this type's
- /// fields.
- /// </summary>
- [StructLayout(LayoutKind.Explicit)]
- public struct Register16
- {
-#if TARGET_IS_BIGENDIAN
-
- /// <summary>
- /// The 16-bit register.
- /// </summary>
- [FieldOffset(0)]
- public ushort reg;
-
- /// <summary>
- /// The high 8-bits of the register.
- /// </summary>
- [FieldOffset(0)]
- public byte high;
-
- /// <summary>
- /// The low 8-bits of the register.
- /// </summary>
- [FieldOffset(1)]
- public byte low;
-
-#else
-
- /// <summary>
- /// The 16-bit register.
- /// </summary>
- [FieldOffset(0)]
- public ushort reg;
-
- /// <summary>
- /// The low 8-bits of the register.
- /// </summary>
- [FieldOffset(0)]
- public byte low;
-
- /// <summary>
- /// The high 8-bits of the register.
- /// </summary>
- [FieldOffset(1)]
- public byte high;
-
-#endif
-
- /// <summary>
- /// Public constructor. This is provided to stop the compiler complaining when you use the struct as it
- /// doesn't realise that setting <see cref="reg"/> will also set <see cref="low"/> and <see cref="high"/>.
- /// </summary>
- /// <param name="val">The 16-bit value to assign.</param>
- public Register16(ushort val)
- {
- high = 0;
- low = 0;
- reg = val;
- }
-
- /// <summary>
- /// Used to verify the compile-time setting at runtime.
- /// </summary>
- public static void Verify()
- {
- Register16 r = new Register16(0);
-
- r.reg = 0x1234;
-
- if (r.low != 0x24 || r.high != 0x12)
- {
- throw new Exception("Compile time endian setting incorrect");
- }
- }
- }
-}