mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-21 12:16:55 +00:00
Add Z80 processor (untested, but complete)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 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("Z80")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Z80")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[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("c00648c1-bac1-4efb-816f-e87c091619d7")]
|
||||
|
||||
// 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 Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,59 @@
|
||||
namespace EightBit
|
||||
{
|
||||
public struct RefreshRegister
|
||||
{
|
||||
private readonly byte high;
|
||||
private byte variable;
|
||||
|
||||
public RefreshRegister(byte value)
|
||||
{
|
||||
this.high = (byte)(value & (byte)Bits.Bit7);
|
||||
this.variable = (byte)(value & (byte)Mask.Mask7);
|
||||
}
|
||||
|
||||
public static implicit operator byte(RefreshRegister input)
|
||||
{
|
||||
return ToByte(input);
|
||||
}
|
||||
|
||||
public static implicit operator RefreshRegister(byte input)
|
||||
{
|
||||
return FromByte(input);
|
||||
}
|
||||
|
||||
public static byte ToByte(RefreshRegister input)
|
||||
{
|
||||
return (byte)((input.high << 7) | input.variable);
|
||||
}
|
||||
|
||||
public static RefreshRegister FromByte(byte input)
|
||||
{
|
||||
return new RefreshRegister(input);
|
||||
}
|
||||
|
||||
public static RefreshRegister operator ++(RefreshRegister value) => Increment(value);
|
||||
|
||||
public static bool operator ==(RefreshRegister left, RefreshRegister right) => left.Equals(right);
|
||||
|
||||
public static bool operator !=(RefreshRegister left, RefreshRegister right) => !(left == right);
|
||||
|
||||
public static RefreshRegister Increment(RefreshRegister value)
|
||||
{
|
||||
++value.variable;
|
||||
return value;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is RefreshRegister))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var rhs = (RefreshRegister)obj;
|
||||
return rhs.high == this.high && rhs.variable == this.variable;
|
||||
}
|
||||
|
||||
public override int GetHashCode() => this.high + this.variable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// <copyright file="StatusBits.cs" company="Adrian Conlon">
|
||||
// Copyright (c) Adrian Conlon. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace EightBit
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
public enum StatusBits
|
||||
{
|
||||
// Negative
|
||||
SF = Bits.Bit7,
|
||||
|
||||
// Zero
|
||||
ZF = Bits.Bit6,
|
||||
|
||||
// Undocumented Y flag
|
||||
YF = Bits.Bit5,
|
||||
|
||||
// Half carry
|
||||
HC = Bits.Bit4,
|
||||
|
||||
// Undocumented X flag
|
||||
XF = Bits.Bit3,
|
||||
|
||||
// Parity
|
||||
PF = Bits.Bit2,
|
||||
|
||||
// Zero
|
||||
VF = Bits.Bit2,
|
||||
|
||||
// Negative?
|
||||
NF = Bits.Bit1,
|
||||
|
||||
// Carry
|
||||
CF = Bits.Bit0,
|
||||
}
|
||||
}
|
||||
+1951
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C00648C1-BAC1-4EFB-816F-E87C091619D7}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Z80</RootNamespace>
|
||||
<AssemblyName>Z80</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<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</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="RefreshRegister.cs" />
|
||||
<Compile Include="StatusBits.cs" />
|
||||
<Compile Include="Z80.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EightBit\EightBit.csproj">
|
||||
<Project>{6ebf8857-62a3-4ef4-af21-c1844031d7e4}</Project>
|
||||
<Name>EightBit</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user