From 2b8d49726e448e22b5055da5ba4395d043030984 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 1 Jan 2012 14:21:26 +0000 Subject: Moved sources to help in compilation for other platforms and isolated phone projects. --- Noddybox.Emulation.EightBit/Binary.cs | 63 ---------------- Noddybox.Emulation.EightBit/ICpu.cs | 57 -------------- Noddybox.Emulation.EightBit/IDevice.cs | 37 --------- Noddybox.Emulation.EightBit/IMemory.cs | 36 --------- .../Noddybox.Emulation.EightBit.csproj | 75 ------------------ .../Properties/AssemblyInfo.cs | 37 --------- Noddybox.Emulation.EightBit/Register16.cs | 88 ---------------------- 7 files changed, 393 deletions(-) delete mode 100644 Noddybox.Emulation.EightBit/Binary.cs delete mode 100644 Noddybox.Emulation.EightBit/ICpu.cs delete mode 100644 Noddybox.Emulation.EightBit/IDevice.cs delete mode 100644 Noddybox.Emulation.EightBit/IMemory.cs delete mode 100644 Noddybox.Emulation.EightBit/Noddybox.Emulation.EightBit.csproj delete mode 100644 Noddybox.Emulation.EightBit/Properties/AssemblyInfo.cs delete mode 100644 Noddybox.Emulation.EightBit/Register16.cs (limited to 'Noddybox.Emulation.EightBit') 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 -{ - /// - /// Provides helpers for shifting smaller values around without casts all over the shop. - /// - public static class Binary - { - /// - /// Shift 8-bits to the left. - /// - /// The byte. - /// How many bits to shift. - /// The shifted value. - public static byte ShiftLeft(byte b, int shift) - { - return (byte)((b << shift) & 0xff); - } - - /// - /// Shift 8-bits to the right. - /// - /// The byte. - /// How many bits to shift. - /// The shifted value. - public static byte ShiftRight(byte b, int shift) - { - return (byte)((b >> shift) & 0xff); - } - - /// - /// Shift 16-bits to the left. - /// - /// The word. - /// How many bits to shift. - /// The shifted value. - public static ushort ShiftLeft(ushort w, int shift) - { - return (ushort)((w << shift) & 0xffff); - } - - /// - /// Shift 16-bits to the right. - /// - /// The word. - /// How many bits to shift. - /// The shifted value. - 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 -{ - /// - /// Defines an 8-bit CPU. - /// - public interface ICpu - { - /// - /// Initialise the CPU to give it access to memory and devices. - /// - /// The memory to access. - /// The devices to access. - /// The clock to use. - void Initialise(IMemory memory, IDevice device, Clock clock); - - /// - /// Resets the CPU to its initial state. - /// - void Reset(); - - /// - /// Runs the next instruction. - /// - void Step(); - - /// - /// Runs the CPU until the next frame flyback. - /// - void Run(); - - /// - /// Generates a maskable interrupt to the CPU. - /// - /// Optional value from an interrupting device. May be ignored depending on the CPU type. - void MaskableInterrupt(byte value); - - /// - /// Generates a non-maskable interrupt to the CPU. - /// - /// Optional value from an interrupting device. May be ignored depending on the CPU type. - 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 -{ - /// - /// 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(ushort device); - - /// - /// Write to a device. - /// - /// The address of the device. - /// The value to write to the device. - 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 -{ - /// - /// 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(ushort address); - - /// - /// Writes a byte at a given address. - /// - /// The address to write to. - /// The value to write. - 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 @@ - - - - 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 - - - - - - - - - - - - - - - - - - - - {A2478066-4DFD-4042-BF98-963922DC97F8} - Noddybox.Emulation - - - - - - - \ 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 -{ - /// - /// Provides a common 8-bit register pattern, which is two 8-bit registers rolled into one. - /// While this could be done at runtime using 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. - /// - [StructLayout(LayoutKind.Explicit)] - public struct Register16 - { -#if TARGET_IS_BIGENDIAN - - /// - /// The 16-bit register. - /// - [FieldOffset(0)] - public ushort reg; - - /// - /// The high 8-bits of the register. - /// - [FieldOffset(0)] - public byte high; - - /// - /// The low 8-bits of the register. - /// - [FieldOffset(1)] - public byte low; - -#else - - /// - /// The 16-bit register. - /// - [FieldOffset(0)] - public ushort reg; - - /// - /// The low 8-bits of the register. - /// - [FieldOffset(0)] - public byte low; - - /// - /// The high 8-bits of the register. - /// - [FieldOffset(1)] - public byte high; - -#endif - - /// - /// Public constructor. This is provided to stop the compiler complaining when you use the struct as it - /// doesn't realise that setting will also set and . - /// - /// The 16-bit value to assign. - public Register16(ushort val) - { - high = 0; - low = 0; - reg = val; - } - - /// - /// Used to verify the compile-time setting at runtime. - /// - 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"); - } - } - } -} -- cgit v1.2.3