Start adding Z80 test harness and update package configurations.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-02-19 00:58:17 +00:00
parent 5714798756
commit 01ce926574
28 changed files with 2565 additions and 31 deletions

View File

@ -13,7 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "M6502.Test", "M6502\M6502.T
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Z80", "Z80\Z80.csproj", "{C00648C1-BAC1-4EFB-816F-E87C091619D7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Z80.Test", "Z80\Z80.Test\Z80.Test.csproj", "{F749BEAE-8903-400B-875C-1220ADCFEF08}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
@ -83,6 +88,18 @@ Global
{C00648C1-BAC1-4EFB-816F-E87C091619D7}.Release|x64.Build.0 = Release|Any CPU
{C00648C1-BAC1-4EFB-816F-E87C091619D7}.Release|x86.ActiveCfg = Release|Any CPU
{C00648C1-BAC1-4EFB-816F-E87C091619D7}.Release|x86.Build.0 = Release|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Debug|x64.ActiveCfg = Debug|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Debug|x64.Build.0 = Debug|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Debug|x86.ActiveCfg = Debug|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Debug|x86.Build.0 = Debug|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Release|Any CPU.Build.0 = Release|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Release|x64.ActiveCfg = Release|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Release|x64.Build.0 = Release|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Release|x86.ActiveCfg = Release|Any CPU
{F749BEAE-8903-400B-875C-1220ADCFEF08}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -39,13 +39,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<HintPath>..\..\packages\MSTest.TestFramework.2.0.0-beta2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<HintPath>..\..\packages\MSTest.TestFramework.2.0.0-beta2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -65,8 +68,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@ -74,8 +75,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
<Import Project="..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\packages\MSTest.TestAdapter.2.0.0-beta2\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
<package id="StyleCop.Analyzers" version="1.1.1-beta.61" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.61" targetFramework="net472" developmentDependency="true" />
<package id="MSTest.TestAdapter" version="2.0.0-beta2" targetFramework="net472" />
<package id="MSTest.TestFramework" version="2.0.0-beta2" targetFramework="net472" />
<package id="StyleCop.Analyzers" version="1.1.1-rc.101" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.101" targetFramework="net472" developmentDependency="true" />
</packages>

View File

@ -33,7 +33,8 @@
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
@ -75,12 +76,14 @@
<Compile Include="UnusedMemory.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<AdditionalFiles Include="stylecop.json" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="StyleCop.Analyzers" version="1.1.1-beta.61" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.61" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers" version="1.1.1-rc.101" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.101" targetFramework="net472" developmentDependency="true" />
</packages>

View File

@ -34,6 +34,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -54,10 +55,8 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<AdditionalFiles Include="stylecop.json" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\EightBit\EightBit.csproj">
@ -70,8 +69,8 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="..\..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="StyleCop.Analyzers" version="1.1.1-beta.61" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.61" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers" version="1.1.1-rc.101" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.101" targetFramework="net472" developmentDependency="true" />
</packages>

View File

@ -34,6 +34,7 @@
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -60,12 +61,14 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<AdditionalFiles Include="stylecop.json" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="StyleCop.Analyzers" version="1.1.1-beta.61" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.61" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers" version="1.1.1-rc.101" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.101" targetFramework="net472" developmentDependency="true" />
</packages>

215
Z80/Disassembly.cs Normal file
View File

@ -0,0 +1,215 @@
namespace Z80
{
using EightBit;
using System.Text;
public class Disassembly
{
private bool prefixCB = false;
private bool prefixDD = false;
private bool prefixED = false;
private bool prefixFD = false;
private readonly Bus bus;
public Disassembly(Bus bus)
{
this.bus = bus;
}
public Bus Bus => this.bus;
public static string State(Z80 cpu)
{
var pc = cpu.PC();
var sp = cpu.SP();
var a = cpu.A();
var f = cpu.F();
var b = cpu.B();
var c = cpu.C();
var d = cpu.D();
var e = cpu.E();
var h = cpu.H();
var l = cpu.L();
var i = cpu.IV;
var r = cpu.REFRESH();
var im = cpu.IM;
return
$"PC={pc} SP={sp} "
+ $"A={AsHex(a)} F={AsFlags(f)} "
+ $"B={AsHex(b)} C={AsHex(c)} "
+ $"D={AsHex(d)} E={AsHex(e)} "
+ $"H={AsHex(h)} L={AsHex(l)} "
+ $"I={AsHex(i)} R={AsHex(r)} "
+ $"IM={im}";
}
public string Disassemble(Z80 cpu)
{
this.prefixCB = this.prefixDD = this.prefixED = this.prefixFD = false;
return Disassemble(cpu, cpu.PC().Word);
}
public static string flag(byte value, int flag, string represents)
{
return "";
}
public static string AsFlags(byte value)
{
return "";
}
public static string AsHex(byte value)
{
return "";
}
public static string AsHex(ushort value)
{
return "";
}
public static string AsBinary(byte value)
{
return "";
}
public static string AsDecimal(byte value)
{
return "";
}
public static string AsInvalid(byte value)
{
return "";
}
private string Disassemble(Z80 cpu, ushort pc)
{
var opCode = Bus.Peek(pc);
var decoded = cpu.GetDecodedOpCode(opCode);
var x = decoded.X;
var y = decoded.Y;
var z = decoded.Z;
var p = decoded.P;
var q = decoded.Q;
var immediate = Bus.Peek((ushort)(pc + 1));
var absolute = cpu.PeekWord((ushort)(pc + 1)).Word;
var displacement = (sbyte)immediate;
var relative = pc + displacement + 2;
var indexedImmediate = Bus.Peek((ushort)(pc + 1));
var dumpCount = 0;
var output = $"{AsHex(opCode)}";
var specification = "";
if (this.prefixCB)
output += this.DisassembleCB(
cpu, pc,
specification, ref dumpCount,
x, y, z, p, q);
else if (this.prefixED)
output += this.DisassembleED(
cpu, pc,
specification, ref dumpCount,
x, y, z, p, q);
else
output += this.DisassembleOther(
cpu, pc,
specification, ref dumpCount,
x, y, z, p, q);
for (int i = 0; i < dumpCount; ++i)
output += $"{AsHex(this.Bus.Peek((ushort)(pc + i + 1)))}";
var outputFormatSpecification = !this.prefixDD;
if (this.prefixDD)
{
if (opCode != 0xdd)
{
outputFormatSpecification = true;
}
}
if (outputFormatSpecification)
{
output += '\t';
//m_formatter.parse(specification);
//output << m_formatter % (int)immediate % (int)absolute % relative % (int)displacement % indexedImmediate;
}
return output;
}
private string DisassembleCB(
Z80 cpu,
ushort pc,
string specification,
ref int dumpCount,
int x, int y, int z,
int p, int q)
{
return "";
}
private string DisassembleED(
Z80 cpu,
ushort pc,
string specification,
ref int dumpCount,
int x, int y, int z,
int p, int q)
{
return "";
}
private string DisassembleOther(
Z80 cpu,
ushort pc,
string specification,
ref int dumpCount,
int x, int y, int z,
int p, int q)
{
return "";
}
private string RP(int rp)
{
return "";
}
private string RP2(int rp)
{
return "";
}
private string R(int r)
{
return "";
}
private static string CC(int flag)
{
return "";
}
private static string ALU(int which)
{
return "";
}
}
}

View File

@ -1,4 +1,8 @@
using System.Reflection;
// <copyright file="AssemblyInfo.cs" company="Adrian Conlon">
// Copyright (c) Adrian Conlon. All rights reserved.
// </copyright>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

222
Z80/Settings.StyleCop Normal file
View File

@ -0,0 +1,222 @@
<StyleCopSettings Version="105">
<GlobalSettings>
<StringProperty Name="Culture">en-GB</StringProperty>
</GlobalSettings>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EnumerationItemsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustContainValidXml">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustMatchElementParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VoidReturnValueMustNotBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustMatchAccessors">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustNotBeEmpty">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustContainWhitespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustMeetCharacterPercentage">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationHeadersMustNotContainBlankLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludedDocumentationXPathDoesNotExist">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InheritDocMustBeUsedWithInheritingClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustShowCopyright">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveCopyrightText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustContainFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveValidCompanyText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>

12
Z80/Z80.Test/Board.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Z80.Test
{
class Board
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Z80.Test
{
class Configuration
{
}
}

12
Z80/Z80.Test/Program.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Z80.Test
{
class Program
{
}
}

View File

@ -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.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Z80.Test")]
[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("f749beae-8903-400b-875c-1220adcfef08")]
// 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")]

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Z80.Test
{
class TestHarness
{
}
}

View File

@ -0,0 +1,55 @@
<?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>{F749BEAE-8903-400B-875C-1220ADCFEF08}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Z80.Test</RootNamespace>
<AssemblyName>Z80.Test</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>
<RunCodeAnalysis>true</RunCodeAnalysis>
</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="Board.cs" />
<Compile Include="Configuration.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestHarness.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="StyleCop.Analyzers" version="1.1.1-rc.101" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.101" targetFramework="net472" developmentDependency="true" />
</packages>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,343 @@
.title 'Preliminary Z80 tests'
; prelim.z80 - Preliminary Z80 tests
; Copyright (C) 1994 Frank D. Cringle
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; These tests have two goals. To start with, we assume the worst and
; successively test the instructions needed to continue testing.
; Then we try to test all instructions which cannot be handled by
; zexlax - the crc-based instruction exerciser.
; Initially errors are 'reported' by jumping to 0. This should reboot
; cp/m, so if the program terminates without any output one of the
; early tests failed. Later errors are reported by outputting an
; address via the bdos conout routine. The address can be located in
; a listing of this program.
; If the program runs to completion it displays a suitable message.
aseg
org 100h
start: ld a,1 ; test simple compares and z/nz jumps
cp 2
jp z,0
cp 1
jp nz,0
jp lab0
halt ; emergency exit
db 0ffh
lab0: call lab2 ; does a simple call work?
lab1: jp 0 ; fail
lab2: pop hl ; check return address
ld a,h
cp high lab1
jp z,lab3
jp 0
lab3: ld a,l
cp low lab1
jp z,lab4
jp 0
; test presence and uniqueness of all machine registers
; (except ir)
lab4: ld sp,regs1
pop af
pop bc
pop de
pop hl
ex af,af'
exx
pop af
pop bc
pop de
pop hl
pop ix
pop iy
ld sp,regs2+20
push iy
push ix
push hl
push de
push bc
push af
ex af,af'
exx
push hl
push de
push bc
push af
v: set 0
rept 20
ld a,(regs2+v/2)
v: set v+2
cp v
jp nz,0
endm
; test access to memory via (hl)
ld hl,hlval
ld a,(hl)
cp 0a5h
jp nz,0
ld hl,hlval+1
ld a,(hl)
cp 03ch
jp nz,0
; test unconditional return
ld sp,stack
ld hl,reta
push hl
ret
jp 0
; test instructions needed for hex output
reta: ld a,255
and a,15
cp 15
jp nz,0
ld a,05ah
and 15
cp 00ah
jp nz,0
rrca
cp 005h
jp nz,0
rrca
cp 082h
jp nz,0
rrca
cp 041h
jp nz,0
rrca
cp 0a0h
jp nz,0
ld hl,01234h
push hl
pop bc
ld a,b
cp 012h
jp nz,0
ld a,c
cp 034h
jp nz,0
; from now on we can report errors by displaying an address
; test conditional call, ret, jp, jr
tcond: macro flag,pcond,ncond,rel
ld hl,&flag
push hl
pop af
call &pcond,lab1&pcond
jp error
lab1&pcond: pop hl
ld hl,0d7h xor &flag
push hl
pop af
call &ncond,lab2&pcond
jp error
lab2&pcond: pop hl
ld hl,lab3&pcond
push hl
ld hl,&flag
push hl
pop af
ret &pcond
call error
lab3&pcond: ld hl,lab4&pcond
push hl
ld hl,0d7h xor &flag
push hl
pop af
ret &ncond
call error
lab4&pcond: ld hl,&flag
push hl
pop af
jp &pcond,lab5&pcond
call error
lab5&pcond: ld hl,0d7h xor &flag
push hl
pop af
jp &ncond,lab6&pcond
call error
lab6&pcond:
if &rel
ld hl,&flag
push hl
pop af
jr &pcond,lab7&pcond
call error
lab7&pcond: ld hl,0d7h xor &flag
push hl
pop af
jr &ncond,lab8&pcond
call error
lab8&pcond:
endif
endm
tcond 1,c,nc,1
tcond 4,pe,po,0
tcond 040h,z,nz,1
tcond 080h,m,p,0
; test indirect jumps
ld hl,lab5
jp (hl)
call error
lab5: ld hl,lab6
push hl
pop ix
jp (ix)
call error
lab6: ld hl,lab7
push hl
pop iy
jp (iy)
call error
; djnz (and (partially) inc a, inc hl)
lab7: ld a,0a5h
ld b,4
lab8: rrca
djnz lab8
cp 05ah
call nz,error
ld b,16
lab9: inc a
djnz lab9
cp 06ah
call nz,error
ld b,0
ld hl,0
lab10: inc hl
djnz lab10
ld a,h
cp 1
call nz,error
ld a,l
cp 0
call nz,error
; relative addressing
reladr: macro r
ld &r,hlval
ld a,(&r)
cp 0a5h
call nz,error
ld a,(&r+1)
cp 03ch
call nz,error
inc &r
ld a,(&r-1)
cp 0a5h
call nz,error
ld &r,hlval-126
ld a,(&r+127)
cp 03ch
call nz,error
ld &r,hlval+128
ld a,(&r-128)
cp 0a5h
call nz,error
endm
reladr ix
reladr iy
allok: ld de,okmsg
ld c,9
call 5
jp 0
okmsg: db 'Preliminary tests complete$'
; display address at top of stack and exit
error: pop bc
ld h,high hextab
ld a,b
rrca
rrca
rrca
rrca
and 15
ld l,a
ld a,(hl)
call conout
ld a,b
and 15
ld l,a
ld a,(hl)
call conout
ld a,c
rrca
rrca
rrca
rrca
and 15
ld l,a
ld a,(hl)
call conout
ld a,c
and 15
ld l,a
ld a,(hl)
call conout
ld a,13
call conout
ld a,10
call conout
jp 0
conout: push af
push bc
push de
push hl
ld c,2
ld e,a
call 5
pop hl
pop de
pop bc
pop af
ret
v: set 0
regs1: rept 20
v: set v+2
db v
endm
regs2: ds 20,0
hlval: db 0a5h,03ch
; skip to next page boundary
org (($+255)/256)*256
hextab: db '0123456789abcdef'
ds 240
stack: equ $
end

Binary file not shown.

Binary file not shown.

1546
Z80/Z80.Test/roms/zexdoc.z80 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -43,7 +44,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Disassembly.cs" />
<Compile Include="RefreshRegister.cs" />
<Compile Include="RegisterIndex.cs" />
<Compile Include="StatusBits.cs" />
<Compile Include="Z80.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -54,5 +57,15 @@
<Name>EightBit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="stylecop.json" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.101\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

5
Z80/packages.config Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="StyleCop.Analyzers" version="1.1.1-rc.101" targetFramework="net472" developmentDependency="true" />
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.101" targetFramework="net472" developmentDependency="true" />
</packages>

19
Z80/stylecop.json Normal file
View File

@ -0,0 +1,19 @@
{
// ACTION REQUIRED: This file was automatically added to your project, but it
// will not take effect until additional steps are taken to enable it. See the
// following page for additional information:
//
// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"documentationRules": {
"documentInterfaces": false,
"documentExposedElements": false,
"documentInternalElements": false,
"documentPrivateElements": false,
"documentPrivateFields": false,
"companyName": "Adrian Conlon"
}
}
}