diff --git a/.github/workflows/benchmarks.yaml b/.github/workflows/benchmarks.yaml new file mode 100644 index 00000000..a6b731ea --- /dev/null +++ b/.github/workflows/benchmarks.yaml @@ -0,0 +1,25 @@ + +name: Add Benchmark Results +on: [pull_request] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channe + - name: build project + run: + dotnet build SAP1EMU.Benchmarks --configuration Release + - name: run benchamrks + run: dotnet run --project SAP1EMU.Benchmarks --no-build --configuration Release + - name: copy report + run: cp BenchmarkDotNet.Artifacts/results/SAP1EMU.Benchmarks.EngineBenchmark-report-github.md .github/workflows/ +# && cp ./SAP1EMU.Benchmarks/bin/Release/netcoreapp3.1/BenchmarkDotNet.Artifacts/results/SAP1EMU.Benchmarks.EngineBenchmark-report-github.md . + - uses: harupy/comment-on-pr@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: SAP1EMU.Benchmarks.EngineBenchmark-report-github.md diff --git a/.gitignore b/.gitignore index cd4b0f4e..6c7366ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +SAP1EMU.GUI/Properties/* + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## diff --git a/.travis.yml b/.travis.yml index d2219a29..efd315d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ language: csharp -solution: SAP1EMU-no-gui.sln +solution: SAP1EMU.sln mono: none dotnet: 3.1 script: - - dotnet build SAP1EMU-no-gui.sln - - dotnet test SAP1EMU-no-gui.sln + - dotnet build SAP1EMU.sln + - dotnet test SAP1EMU.Lib.Test -v n --no-build --collect:"XPlat Code Coverage" + - dotnet test SAP1EMU.CLI.Test -v n --no-build --collect:"XPlat Code Coverage" + - dotnet test SAP1EMU.Assembler.Test -v n --no-build --collect:"XPlat Code Coverage" + - dotnet test SAP1EMU.Engine.Test -v n --no-build --collect:"XPlat Code Coverage" + after_success: - - cd SAP1EMU.Lib.Test/ - - dotnet add package coverlet.collector - - dotnet test --collect:"XPlat Code Coverage" - - bash <(curl -s https://codecov.io/bash) + - bash <(curl -s https://codecov.io/bash) diff --git a/SAP1EMU-no-gui.sln b/SAP1EMU-no-gui.sln deleted file mode 100644 index d92c6d6f..00000000 --- a/SAP1EMU-no-gui.sln +++ /dev/null @@ -1,43 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Lib", "SAP1EMU.Lib\SAP1EMU.Lib.csproj", "{7E6A1832-365E-40A0-9E7D-BA2584EF6D0E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Lib.Test", "SAP1EMU.Lib.Test\SAP1EMU.Lib.Test.csproj", "{754C8742-4D96-49B5-B79F-07A8D44E1255}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Engine", "SAP1EMU.Engine\SAP1EMU.Engine.csproj", "{B1680C97-D8B2-480C-852D-FB82686D5CF5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Engine-CLI", "SAP1EMU.Engine-CLI\SAP1EMU.Engine-CLI.csproj", "{3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7E6A1832-365E-40A0-9E7D-BA2584EF6D0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E6A1832-365E-40A0-9E7D-BA2584EF6D0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E6A1832-365E-40A0-9E7D-BA2584EF6D0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E6A1832-365E-40A0-9E7D-BA2584EF6D0E}.Release|Any CPU.Build.0 = Release|Any CPU - {754C8742-4D96-49B5-B79F-07A8D44E1255}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {754C8742-4D96-49B5-B79F-07A8D44E1255}.Debug|Any CPU.Build.0 = Debug|Any CPU - {754C8742-4D96-49B5-B79F-07A8D44E1255}.Release|Any CPU.ActiveCfg = Release|Any CPU - {754C8742-4D96-49B5-B79F-07A8D44E1255}.Release|Any CPU.Build.0 = Release|Any CPU - {B1680C97-D8B2-480C-852D-FB82686D5CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1680C97-D8B2-480C-852D-FB82686D5CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1680C97-D8B2-480C-852D-FB82686D5CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1680C97-D8B2-480C-852D-FB82686D5CF5}.Release|Any CPU.Build.0 = Release|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {0E53BC19-FAC5-4B3C-B49B-B4BBA80CBA85} - EndGlobalSection -EndGlobal diff --git a/SAP1EMU.Assembler.Test/SAP1EMU.Assembler.Test.csproj b/SAP1EMU.Assembler.Test/SAP1EMU.Assembler.Test.csproj new file mode 100644 index 00000000..bdc21b71 --- /dev/null +++ b/SAP1EMU.Assembler.Test/SAP1EMU.Assembler.Test.csproj @@ -0,0 +1,20 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>netcoreapp3.1</TargetFramework> + + <IsPackable>false</IsPackable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> + <PackageReference Include="MSTest.TestAdapter" Version="2.1.0" /> + <PackageReference Include="MSTest.TestFramework" Version="2.1.0" /> + <PackageReference Include="coverlet.collector" Version="1.2.0" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\SAP1EMU.Assembler\SAP1EMU.Assembler.csproj" /> + </ItemGroup> + +</Project> diff --git a/SAP1EMU.Assembler.Test/UnitTest1.cs b/SAP1EMU.Assembler.Test/UnitTest1.cs new file mode 100644 index 00000000..74451d50 --- /dev/null +++ b/SAP1EMU.Assembler.Test/UnitTest1.cs @@ -0,0 +1,13 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace SAP1EMU.Assembler.Test +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} diff --git a/SAP1EMU.Benchmarks/EngineBenchmark.cs b/SAP1EMU.Benchmarks/EngineBenchmark.cs new file mode 100644 index 00000000..f44fad82 --- /dev/null +++ b/SAP1EMU.Benchmarks/EngineBenchmark.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using BenchmarkDotNet.Attributes; + +using SAP1EMU.Engine; +using SAP1EMU.Lib; + +namespace SAP1EMU.Benchmarks +{ + public class EngineBenchmark + { + + RAMProgram RP_HLT { get; set; } + RAMProgram RP_LDA170 { get; set; } + RAMProgram RP_FIB{ get; set; } + IDecoder _decoder = new InstructionDecoder(); + + [GlobalSetup] + public void GlobalSetup() + { + RP_HLT = new RAMProgram(new List<string>() { + "11110000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000" + }); + + RP_LDA170 = new RAMProgram(new List<string>() { + "00001111", + "11100000", + "11110000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "00000000", + "10101010", + }); + + RP_FIB = new RAMProgram(new List<string>() { + "00001110", + "00011111", + "00111111", + "00001111", + "00111110", + "00001101", + "00011100", + "00111101", + "10011010", + "01000000", + "11100000", + "11110000", + "00000001", + "11111001", + "00000001", + "00000001", + }); + } + + + [Benchmark(Baseline = true)] + public void EngineRun_HLT() + { + EngineProc engine = new EngineProc(); + + engine.Init(RP_HLT, _decoder); + engine.Run(); + } + + [Benchmark] + public void EngineRun_LDA170() + { + EngineProc engine = new EngineProc(); + + engine.Init(RP_LDA170, _decoder); + engine.Run(); + } + + [Benchmark] + public void EngineRun_FIB5() + { + EngineProc engine = new EngineProc(); + + engine.Init(RP_FIB, _decoder); + engine.Run(); + } + } +} diff --git a/SAP1EMU.Benchmarks/Program.cs b/SAP1EMU.Benchmarks/Program.cs new file mode 100644 index 00000000..cfcad057 --- /dev/null +++ b/SAP1EMU.Benchmarks/Program.cs @@ -0,0 +1,14 @@ +using System; + +using BenchmarkDotNet.Running; + +namespace SAP1EMU.Benchmarks +{ + class Program + { + static void Main(string[] args) + { + BenchmarkRunner.Run<EngineBenchmark>(); + } + } +} diff --git a/SAP1EMU.Benchmarks/SAP1EMU.Benchmarks.csproj b/SAP1EMU.Benchmarks/SAP1EMU.Benchmarks.csproj new file mode 100644 index 00000000..59127e71 --- /dev/null +++ b/SAP1EMU.Benchmarks/SAP1EMU.Benchmarks.csproj @@ -0,0 +1,16 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp3.1</TargetFramework> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="BenchmarkDotNet" Version="0.12.1" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\SAP1EMU.Engine\SAP1EMU.Engine.csproj" /> + </ItemGroup> + +</Project> diff --git a/SAP1EMU.CLI.Test/CommandLineArgsTest.cs b/SAP1EMU.CLI.Test/CommandLineArgsTest.cs new file mode 100644 index 00000000..d7c06cfa --- /dev/null +++ b/SAP1EMU.CLI.Test/CommandLineArgsTest.cs @@ -0,0 +1,254 @@ +using System; +using System.IO; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace SAP1EMU.CLI.Test +{ + [TestClass] + public class CommandLineArgsTest + { + // This will run once for all functions in this class + [ClassInitialize] + public static void TestEnvSetup(TestContext context) + { + Environment.SetEnvironmentVariable("IS_TESTING_ENV", "TRUE"); + } + + // This will run once after all functions in this class have run + [ClassCleanup] + public static void TestEnvCleanup() + { + Environment.SetEnvironmentVariable("IS_TESTING_ENV", "FALSE"); + } + + + [TestMethod] + public void LDA170() + { + string input_file = "LDA170.s"; + string output_file = "output_file.txt"; + string expectedResult = "10101010"; + + + string lineArgs = $"-s {input_file} -o {output_file}"; + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + + + string expected = $"************************************************************\n" + + $"Final Output Register Value: { expectedResult }" + + $"\n************************************************************\n\n"; + + string result = File.ReadAllText(output_file); + Assert.AreEqual(expected, result); + + File.Delete(output_file); + } + + [TestMethod] + public void LDA170_BigF() + { + string input_file = "LDA170.s"; + string output_file = "output_file.txt"; + string expectedResult = "10101010"; + + + string lineArgs = $"-s {input_file} -o {output_file} -F"; + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + + + string expected = $"************************************************************\n" + + $"Final Output Register Value: { expectedResult }" + + $"\n************************************************************\n\n"; + + string result = File.ReadAllText(output_file); + StringAssert.Contains(result, expected); + + File.Delete(output_file); + } + + [TestMethod] + public void LDA170_LittleF() + { + string input_file = "LDA170.s"; + string output_file = "output_file.txt"; + string expectedResult = "10101010"; + + + string lineArgs = $"-s {input_file} -o {output_file} -f"; + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + + + string expected = $"************************************************************\n" + + $"Final Output Register Value: { expectedResult }" + + $"\n************************************************************\n\n"; + + string result = File.ReadAllText(output_file); + StringAssert.Contains(result, expected); + + File.Delete(output_file); + } + + [TestMethod] + public void LDA170_BigO_STD() + { + string input_file = "LDA170.s"; + string output_file = "output_file.txt"; + + + string lineArgs = $"-s {input_file} -o {output_file} -O std"; + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + + + string expected = "************************************************************" +Environment.NewLine + + "* Output: 00000000 *" + Environment.NewLine + + "************************************************************" + Environment.NewLine + + Environment.NewLine + + "************************************************************" + Environment.NewLine + + "* Output: 10101010 *" + Environment.NewLine + + "************************************************************" + Environment.NewLine + + Environment.NewLine + + "************************************************************" + Environment.NewLine + + "* Output: 10101010 *" + Environment.NewLine + + "************************************************************" + Environment.NewLine + Environment.NewLine; + + string result = File.ReadAllText(output_file); + Assert.AreEqual(result, expected); + + File.Delete(output_file); + } + + + [TestMethod] + public void LDA170_BigO_NF() + { + string input_file = "LDA170.s"; + string output_file = "output_file.txt"; + + + string lineArgs = $"-s {input_file} -o {output_file} -O no-format"; + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + + + string expected = "00000000" + Environment.NewLine + + "10101010" + Environment.NewLine + + "10101010" + Environment.NewLine; + + string result = File.ReadAllText(output_file); + Assert.AreEqual(result, expected); + + File.Delete(output_file); + } + + + + [TestMethod] + public void Fib() + { + string input_file = "Fib5.s"; + string output_file = "output_file.txt"; + string expectedResult = "00000101"; + + + string lineArgs = $"-s {input_file} -o {output_file}"; + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + + + string expected = $"************************************************************\n" + + $"Final Output Register Value: { expectedResult }" + + $"\n************************************************************\n\n"; + + try + { + string result = File.ReadAllText(output_file); + Assert.AreEqual(expected, result); + + File.Delete(output_file); + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + } + + + + [TestMethod] + public void NoSourceFile() + { + string input_file = "DNE.s"; + string output_file = "output_file.txt"; + + string lineArgs = $"-s {input_file} -o {output_file}"; + + try + { + // Redirect output to string + string consoleError = ""; + var originalConsoleError = Console.Error; // preserve the original stream + using (var writer = new StringWriter()) + { + Console.SetError(writer); + + try + { + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + } + catch(CLITestingxception) + { + // This should happen. + // All good + } + catch(Exception e) + { + // this should not happen + Assert.Fail(e.ToString()); + } + + writer.Flush(); // when you're done, make sure everything is written out + + consoleError = writer.GetStringBuilder().ToString(); + } + // Reset output + Console.SetOut(originalConsoleError); // restore Console.Out + + + + + string expected = $"SAP1EMU: error: {input_file}: No such file" + Environment.NewLine + + $"SAP1EMU: fatal error: no input file" + Environment.NewLine + + $"emulation terminated" + Environment.NewLine; + + Assert.AreEqual(expected, consoleError); + + } + catch (Exception e) + { + Assert.Fail(e.ToString()); + } + + } + + [TestMethod] + public void LDI_Ben_Eater() + { + string input_file = "LDI.s"; + string output_file = "output_file.txt"; + string instruction_set = "BenEater"; + string expectedResult = "11110110"; + + + string lineArgs = $"-s {input_file} -o {output_file} -i {instruction_set} - O std"; + SAP1EMU.CLI.Program.Main(lineArgs.Split(' ')); + + string expected = $"************************************************************\n" + + $"Final Output Register Value: { expectedResult }" + + $"\n************************************************************\n\n"; + + string result = File.ReadAllText(output_file); + StringAssert.Contains(result, expected); + + File.Delete(output_file); + } + } +} diff --git a/SAP1EMU.CLI.Test/Fib5.s b/SAP1EMU.CLI.Test/Fib5.s new file mode 100644 index 00000000..85791c05 --- /dev/null +++ b/SAP1EMU.CLI.Test/Fib5.s @@ -0,0 +1,16 @@ +LDA 0xF +OUT 0x0 +ADD 0xE +STA 0xE +SUB 0xF +STA 0xF +LDA 0xD +SUB 0xC +JEQ 0xB +STA 0xD +JMP 0x0 +HLT 0x0 +0x0 0x1 # count decrementer +0x0 0x5 # count +0x0 0x1 # A1 >= 1 +0x0 0x1 # A2 >= 0 \ No newline at end of file diff --git a/SAP1EMU.CLI.Test/LDA170.s b/SAP1EMU.CLI.Test/LDA170.s new file mode 100644 index 00000000..824a0da0 --- /dev/null +++ b/SAP1EMU.CLI.Test/LDA170.s @@ -0,0 +1,5 @@ +LDA 0xF +OUT 0x0 +HLT 0x0 +... +0xA 0xA \ No newline at end of file diff --git a/SAP1EMU.CLI.Test/LDA170_No_HLT.s b/SAP1EMU.CLI.Test/LDA170_No_HLT.s new file mode 100644 index 00000000..ea4e630b --- /dev/null +++ b/SAP1EMU.CLI.Test/LDA170_No_HLT.s @@ -0,0 +1,3 @@ +LDA 0xF #this should error bc there is no HLT +... +0xA 0xA # see isssue https://github.com/rbaker26/SAP1EMU/issues/57 diff --git a/SAP1EMU.CLI.Test/LDI.s b/SAP1EMU.CLI.Test/LDI.s new file mode 100644 index 00000000..ffa9282f --- /dev/null +++ b/SAP1EMU.CLI.Test/LDI.s @@ -0,0 +1,16 @@ +LDI 0x5 +ADD 0xF +OUT 0x0 +HLT 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0x0 0x0 +0xF 0x1 \ No newline at end of file diff --git a/SAP1EMU.CLI.Test/SAP1EMU.CLI.Test.csproj b/SAP1EMU.CLI.Test/SAP1EMU.CLI.Test.csproj new file mode 100644 index 00000000..d626f65e --- /dev/null +++ b/SAP1EMU.CLI.Test/SAP1EMU.CLI.Test.csproj @@ -0,0 +1,32 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>netcoreapp3.1</TargetFramework> + + <IsPackable>false</IsPackable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> + <PackageReference Include="MSTest.TestAdapter" Version="2.1.0" /> + <PackageReference Include="MSTest.TestFramework" Version="2.1.0" /> + <PackageReference Include="coverlet.collector" Version="1.2.0" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\SAP1EMU.CLI\SAP1EMU.CLI.csproj" /> + </ItemGroup> + + <ItemGroup> + <None Update="Fib5.s"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Update="LDA170.s"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Update="LDI.s"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + </ItemGroup> + +</Project> diff --git a/SAP1EMU.CLI/CLITestingxception.cs b/SAP1EMU.CLI/CLITestingxception.cs new file mode 100644 index 00000000..b032507f --- /dev/null +++ b/SAP1EMU.CLI/CLITestingxception.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SAP1EMU.CLI +{ + public class CLITestingxception : Exception + { + } +} diff --git a/SAP1EMU.Engine-CLI/Makefile b/SAP1EMU.CLI/Makefile similarity index 100% rename from SAP1EMU.Engine-CLI/Makefile rename to SAP1EMU.CLI/Makefile diff --git a/SAP1EMU.Engine-CLI/Program.cs b/SAP1EMU.CLI/Program.cs similarity index 93% rename from SAP1EMU.Engine-CLI/Program.cs rename to SAP1EMU.CLI/Program.cs index 8b2c583b..e63205e2 100644 --- a/SAP1EMU.Engine-CLI/Program.cs +++ b/SAP1EMU.CLI/Program.cs @@ -9,11 +9,10 @@ using SAP1EMU.Assembler; using SAP1EMU.Engine; using SAP1EMU.Lib; -using SAP1EMU.Lib.Utilities; -namespace SAP1EMU.Engine_CLI +namespace SAP1EMU.CLI { - class Program + public class Program { public class Options { @@ -46,7 +45,7 @@ public class Options // TODO - Figure out why default isnt working here // Default should be "std" - [Option('O', "FOfragitme", SetName = "FOframe", Required = false, HelpText = "Include Snapshots of the Output Register in the output file.\nParameters:\n std\t\tOutputs with formatting\n no-format\tOutputs wil no formatting")] + [Option('O', "FOframe", SetName = "FOframe", Required = false, HelpText = "Include Snapshots of the Output Register in the output file.\nParameters:\n std\t\tOutputs with formatting\n no-format\tOutputs wil no formatting")] public string FOframe { get; set; } // ******************************************** @@ -69,8 +68,12 @@ enum FileType S, // ASM B // BIN } - static void Main(string[] args) + + + public static void Main(string[] args) { + IDecoder _decoder = new InstructionDecoder(); + _ = Parser.Default.ParseArguments<Options>(args) .WithParsed(o => { @@ -84,7 +87,7 @@ static void Main(string[] args) Console.Error.WriteLine($"SAP1EMU: error: {o.SourceFile}: No such file"); Console.Error.WriteLine($"SAP1EMU: fatal error: no input file"); Console.Error.WriteLine("emulation terminated"); - System.Environment.Exit(1); + CheckEnvAndExit(); } else // Check if file is valid @@ -109,7 +112,7 @@ static void Main(string[] args) Console.Error.WriteLine($"SAP1EMU: error: {o.SourceFile}: Invalid file extension: Must be <FileName>.s or <FileName>.b"); Console.Error.WriteLine($"SAP1EMU: fatal error: no valid input file"); Console.Error.WriteLine("emulation terminated."); - System.Environment.Exit(1); + CheckEnvAndExit(); } } @@ -119,14 +122,14 @@ static void Main(string[] args) Console.Error.WriteLine($"SAP1EMU: error: {o.SourceFile}: File is empty"); Console.Error.WriteLine($"SAP1EMU: fatal error: no valid input file"); Console.Error.WriteLine("emulation terminated"); - System.Environment.Exit(1); + CheckEnvAndExit(); } if (loc > 16) { Console.Error.WriteLine($"SAP1EMU: error: {o.SourceFile}: invalid file: Contains more than 16 lines of code."); Console.Error.WriteLine($"SAP1EMU: fatal error: no valid input file"); Console.Error.WriteLine("emulation terminated"); - System.Environment.Exit(1); + CheckEnvAndExit(); } @@ -182,7 +185,7 @@ static void Main(string[] args) Console.Error.Flush(); - System.Environment.Exit(1); + CheckEnvAndExit(); } } else @@ -206,7 +209,7 @@ static void Main(string[] args) //Console.SetError(writer_error); - engine.Init(rmp, o.InstructionSetName); + engine.Init(rmp, _decoder, o.InstructionSetName); try { engine.Run(); @@ -234,7 +237,7 @@ static void Main(string[] args) Console.Error.Flush(); - System.Environment.Exit(1); + CheckEnvAndExit(); } @@ -339,6 +342,26 @@ static void Main(string[] args) }); } + private static void CheckEnvAndExit() + { + string env = Environment.GetEnvironmentVariable("IS_TESTING_ENV"); + if(string.IsNullOrEmpty(env) == false) + { + if (env == "TRUE") + { + throw new CLITestingxception(); + } + else + { + Environment.Exit(1); + } + } + else + { + Environment.Exit(1); + } + } + private static void Debug_Proc(Options o, List<string> source_file_contents, List<Frame> FrameStack) { if (o.Debug) @@ -392,7 +415,7 @@ private static void Debug_Proc(Options o, List<string> source_file_contents, Lis { Console.Error.WriteLine($"SAP1EMU: fatal error: debug: break point must be in range (1-{executable_line_count})"); Console.Error.WriteLine("debug terminated."); - System.Environment.Exit(1); + CheckEnvAndExit(); } Console.Out.WriteLine("\n\nDo you want to set a TState break point: (y/n) "); @@ -410,7 +433,7 @@ private static void Debug_Proc(Options o, List<string> source_file_contents, Lis { Console.Error.WriteLine("SAP1EMU: fatal error: debug: TState break point must be in range (1-6)"); Console.Error.WriteLine("debug terminated."); - System.Environment.Exit(1); + CheckEnvAndExit(); } } else if (answer_char == 'N') @@ -421,7 +444,7 @@ private static void Debug_Proc(Options o, List<string> source_file_contents, Lis { Console.Error.WriteLine($"SAP1EMU: fatal error: debug: Invalid charecter"); Console.Error.WriteLine("debug terminated."); - System.Environment.Exit(1); + CheckEnvAndExit(); } } @@ -434,7 +457,7 @@ private static void Debug_Proc(Options o, List<string> source_file_contents, Lis { Console.Error.WriteLine($"SAP1EMU: fatal error: debug: Invalid charecter"); Console.Error.WriteLine("debug terminated."); - System.Environment.Exit(1); + CheckEnvAndExit(); } @@ -489,7 +512,7 @@ private static void Debug_Proc(Options o, List<string> source_file_contents, Lis Console.Write("Type \"quit\" to exit:\n:"); if (Console.ReadLine().ToUpper().Contains("QUIT")) { - System.Environment.Exit(1); + CheckEnvAndExit(); } } diff --git a/SAP1EMU.Engine-CLI/SAP1EMU.Engine-CLI.csproj b/SAP1EMU.CLI/SAP1EMU.CLI.csproj similarity index 89% rename from SAP1EMU.Engine-CLI/SAP1EMU.Engine-CLI.csproj rename to SAP1EMU.CLI/SAP1EMU.CLI.csproj index 351a6d65..2a412076 100644 --- a/SAP1EMU.Engine-CLI/SAP1EMU.Engine-CLI.csproj +++ b/SAP1EMU.CLI/SAP1EMU.CLI.csproj @@ -1,15 +1,15 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> - <RootNamespace>SAP1EMU.Engine_CLI</RootNamespace> + <RootNamespace>SAP1EMU.CLI</RootNamespace> <Authors>Bob Baker</Authors> <Company /> <RepositoryUrl>https://github.com/rbaker26/SAP1EMU/wiki</RepositoryUrl> <RepositoryType>https://github.com/rbaker26/SAP1EMU/</RepositoryType> <AssemblyName>SAP1Emu</AssemblyName> - <StartupObject>SAP1EMU.Engine_CLI.Program</StartupObject> + <StartupObject>SAP1EMU.CLI.Program</StartupObject> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <AssemblyVersion>1.14.0.0</AssemblyVersion> <FileVersion>1.14.0.0</FileVersion> @@ -44,6 +44,4 @@ </None> </ItemGroup> - - </Project> diff --git a/SAP1EMU.Engine-CLI/packages-microsoft-prod.deb b/SAP1EMU.Engine-CLI/packages-microsoft-prod.deb deleted file mode 100644 index 90280347..00000000 Binary files a/SAP1EMU.Engine-CLI/packages-microsoft-prod.deb and /dev/null differ diff --git a/SAP1EMU.Lib.Test/EngineTest.cs b/SAP1EMU.Engine.Test/EngineTest.cs similarity index 95% rename from SAP1EMU.Lib.Test/EngineTest.cs rename to SAP1EMU.Engine.Test/EngineTest.cs index 089bf896..9ff5fc97 100644 --- a/SAP1EMU.Lib.Test/EngineTest.cs +++ b/SAP1EMU.Engine.Test/EngineTest.cs @@ -1,15 +1,16 @@ -using System; using System.Collections.Generic; -using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; using SAP1EMU.Engine; -namespace SAP1EMU.Lib.Test +using SAP1EMU.Lib; + +namespace SAP1EMU.Engine.Test { [TestClass] public class EngineTest { - + IDecoder _decoder = new InstructionDecoder(); // LDA Tests 1-3 ************************************************************ #region LDA Tests 1-3 // Test_LDA_PROG_1 ********************************************************** @@ -62,7 +63,7 @@ public void Test_LDA_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -122,7 +123,7 @@ public void Test_LDA_PROG_2() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -183,7 +184,7 @@ public void Test_LDA_PROG_3() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -247,7 +248,7 @@ public void Test_ADD_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -308,7 +309,7 @@ public void Test_ADD_PROG_2() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -368,7 +369,7 @@ public void Test_ADD_PROG_3() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -434,7 +435,7 @@ public void Test_SUB_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -495,7 +496,7 @@ public void Test_SUB_PROG_2() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -555,7 +556,7 @@ public void Test_SUB_PROG_3() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -621,7 +622,7 @@ public void Test_OVERFLOW_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -681,7 +682,7 @@ public void Test_OVERFLOW_PROG_2() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -742,7 +743,7 @@ public void Test_OVERFLOW_PROG_3() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -809,7 +810,7 @@ public void Test_UNDERFLOW_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -869,7 +870,7 @@ public void Test_UNDERFLOW_PROG_2() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -929,7 +930,7 @@ public void Test_UNDERFLOW_PROG_3() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -969,7 +970,7 @@ public void Test_STA_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1007,7 +1008,7 @@ public void Test_JMP_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1044,7 +1045,7 @@ public void Test_JEQ_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1082,7 +1083,7 @@ public void Test_JNQ_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1120,7 +1121,7 @@ public void Test_JLT_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1158,7 +1159,7 @@ public void Test_JLT_PROG_2() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1196,7 +1197,7 @@ public void Test_JGT_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1234,7 +1235,7 @@ public void Test_JGT_PROG_2() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1255,7 +1256,7 @@ public void Test_JIC_PROG_1() "00011110", // ADD E "10010100", // JIC 4 "00001101", // LDA D (should miss) - "11100000", + "11100000", "11110000", "00000000", "00000000", @@ -1272,7 +1273,7 @@ public void Test_JIC_PROG_1() EngineProc engine = new EngineProc(); - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); engine.Run(); string output = engine.GetOutputReg(); @@ -1310,17 +1311,17 @@ public void Infinite_Loop_Test() EngineProc engine = new EngineProc(); bool caught = false; - engine.Init(new RAMProgram(program)); + engine.Init(new RAMProgram(program), _decoder); try { engine.Run(); } - catch(EngineRuntimeException) + catch (EngineRuntimeException) { caught = true; } - if(!caught) + if (!caught) { Assert.Fail(); } @@ -1329,7 +1330,6 @@ public void Infinite_Loop_Test() } // ************************************************************************** - } -} \ No newline at end of file +} diff --git a/SAP1EMU.Engine.Test/SAP1EMU.Engine.Test.csproj b/SAP1EMU.Engine.Test/SAP1EMU.Engine.Test.csproj new file mode 100644 index 00000000..69d482f0 --- /dev/null +++ b/SAP1EMU.Engine.Test/SAP1EMU.Engine.Test.csproj @@ -0,0 +1,26 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>netcoreapp3.1</TargetFramework> + + <IsPackable>false</IsPackable> + </PropertyGroup> + + <ItemGroup> + <Content Include="..\SAP1EMU.Lib\InstructionSets.json" Link="InstructionSets.json"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + </ItemGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> + <PackageReference Include="MSTest.TestAdapter" Version="2.1.0" /> + <PackageReference Include="MSTest.TestFramework" Version="2.1.0" /> + <PackageReference Include="coverlet.collector" Version="1.2.0" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\SAP1EMU.Engine\SAP1EMU.Engine.csproj" /> + </ItemGroup> + +</Project> diff --git a/SAP1EMU.Engine/EngineProc.cs b/SAP1EMU.Engine/EngineProc.cs index d0470816..099082d7 100644 --- a/SAP1EMU.Engine/EngineProc.cs +++ b/SAP1EMU.Engine/EngineProc.cs @@ -3,7 +3,6 @@ using System.Text; using SAP1EMU.Lib; -using Serilog; using SAP1EMU.Lib.Registers; using SAP1EMU.Lib.Components; @@ -20,36 +19,41 @@ public class EngineProc private RAMProgram Program { get; set; } private InstructionSet InstructionSet { get; set; } private const string DefaultInstructionSetName = "SAP1Emu"; + IDecoder _decoder { get; set; } + // ************************************************************************* // Init Engine // ************************************************************************* - public void Init(RAMProgram program, string InstructionSetName = DefaultInstructionSetName) + public void Init(RAMProgram program, IDecoder decoder, string InstructionSetName = DefaultInstructionSetName) { - string log_name = "runtime_log.txt"; - // Clear Old Log - if (File.Exists(log_name)) - { - File.Delete(log_name); - } - File.Create(log_name).Close(); // must close the file or the handle will stay open and be locked + //string log_name = "runtime_log.txt"; + //// Clear Old Log + //if (File.Exists(log_name)) + //{ + // File.Delete(log_name); + //} + //File.Create(log_name).Close(); // must close the file or the handle will stay open and be locked - // Init Logger - Log.Logger = new LoggerConfiguration() - .WriteTo.File(log_name) - // .WriteTo.Console() - .CreateLogger(); + //// Init Logger + //Log.Logger = new LoggerConfiguration() + // .WriteTo.File(log_name) + // // .WriteTo.Console() + // .CreateLogger(); - Serilog.Debugging.SelfLog.Enable(msg => Debug.WriteLine(msg)); - Serilog.Debugging.SelfLog.Enable(Console.Error); + //Serilog.Debugging.SelfLog.Enable(msg => Debug.WriteLine(msg)); + //Serilog.Debugging.SelfLog.Enable(Console.Error); - Log.Information("SAP1Emu: Begin Engine Initialization"); + //Log.Information("SAP1Emu: Begin Engine Initialization"); // Get Instruction Set - Log.Information($"SAP1Emu: Using Instruction Set: \"{InstructionSetName}\""); + //Log.Information($"SAP1Emu: Using Instruction Set: \"{InstructionSetName}\""); InstructionSet = OpCodeLoader.GetSet(InstructionSetName); + _decoder = decoder; + + //_decoder = new InstructionDecoder(); // Init RAM if (program == null) @@ -58,7 +62,7 @@ public void Init(RAMProgram program, string InstructionSetName = DefaultInstruct } this.Program = program; - Log.Information("SAP1Emu: Finished Engine Initialization"); + //Log.Information("SAP1Emu: Finished Engine Initialization"); } // ************************************************************************* @@ -69,9 +73,9 @@ public void Init(RAMProgram program, string InstructionSetName = DefaultInstruct // ************************************************************************* public void Run() { - Log.Information("SAP1Emu: Begin Engine Run"); + //Log.Information("SAP1Emu: Begin Engine Run"); - Log.Verbose("SAP1Emu: Initializing Registers"); + //Log.Verbose("SAP1Emu: Initializing Registers"); Clock clock = new Clock(); TicTok tictok = new TicTok(); @@ -102,18 +106,18 @@ public void Run() ram.Subscribe(clock); - Log.Verbose("SAP1Emu: Initialized Registers"); + // Log.Verbose("SAP1Emu: Initialized Registers"); - Log.Information("SAP1Emu: Loading Ram"); + // Log.Information("SAP1Emu: Loading Ram"); // Load the program into the RAM ram.LoadProgram(Program); - Log.Information("SAP1Emu: RAM:\n{RAM}", Program.RamContents); + // Log.Information("SAP1Emu: RAM:\n{RAM}", Program.RamContents); // Load the intsructionSet into the SEQ seq.Load(InstructionSet); - Log.Information($"SAP1Emu: Loaded Instruction Set: \"{InstructionSet.SetName}\""); + // Log.Information($"SAP1Emu: Loaded Instruction Set: \"{InstructionSet.SetName}\""); @@ -133,7 +137,7 @@ public void Run() int loop_counter = 0; int TState = 1; - Log.Information("SAP1Emu: Start Program Execution"); + // Log.Information("SAP1Emu: Start Program Execution"); while(clock.IsEnabled) { if(TState <= 3) @@ -152,47 +156,47 @@ public void Run() string iname = InstructionSet.instructions.Find(x => x.BinCode.Equals(ireg.ToString())).OpCode; int operandVal = Convert.ToInt32(ireg.ToString_Frame_Use().Substring(4, 4), 2); string hexOperand = "0x" + operandVal.ToString("X"); - Log.Information($"SAP1Emu: Instruction: {iname}, Operand: {hexOperand}"); + // Log.Information($"SAP1Emu: Instruction: {iname}, Operand: {hexOperand}"); } clock.SendTicTok(tictok); tictok.ToggleClockState(); clock.SendTicTok(tictok); tictok.ToggleClockState(); - tempFrame = new Frame(ireg.ToString(), TState, areg, breg, ireg, mreg, oreg, pc, alu, ram.RAMDump(), ram, seq, Wbus.Instance().ToString()); + tempFrame = new Frame(ireg.ToString(), TState, areg, breg, ireg, mreg, oreg, pc, alu, ram.RAMDump(), ram, seq, Wbus.Instance().ToString(), Flags.Instance(), _decoder, InstructionSet.SetName); _FrameStack.Add(tempFrame); if (ireg.ToString() == "1111" && TState == 6) { - Log.Information("SAP1Emu: HLT Detected"); + // Log.Information("SAP1Emu: HLT Detected"); clock.IsEnabled = false; } // Infinite Loop Checks - if(loop_counter == warning1_loop_counter) - { - Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning1_loop_counter} "); - } - else if (loop_counter == warning2_loop_counter) - { - Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning2_loop_counter} "); - } - else if (loop_counter == warning3_loop_counter) - { - Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning3_loop_counter} "); - } - else if (loop_counter == warning4_loop_counter) - { - Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning4_loop_counter} "); - } + //if(loop_counter == warning1_loop_counter) + //{ + // Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning1_loop_counter} "); + //} + //else if (loop_counter == warning2_loop_counter) + //{ + // Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning2_loop_counter} "); + //} + //else if (loop_counter == warning3_loop_counter) + //{ + // Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning3_loop_counter} "); + //} + //else if (loop_counter == warning4_loop_counter) + //{ + // Log.Warning($"SAP1Emu: Infinite Loop Warning: interations count: {warning4_loop_counter} "); + //} if (loop_counter >= max_loop_count) { - Log.Fatal($"SAP1Emu: Infinite Loop Fatal Error: Infinite Loop Detected"); - Log.CloseAndFlush(); + // Log.Fatal($"SAP1Emu: Infinite Loop Fatal Error: Infinite Loop Detected"); + // Log.CloseAndFlush(); throw new EngineRuntimeException("Engine Error: Infinite Loop Detected"); } else @@ -209,13 +213,13 @@ public void Run() TState = 1; } } - Log.Information("SAP1Emu: End Program Execution"); + // Log.Information("SAP1Emu: End Program Execution"); OutPutRegContents = oreg.ToString(); - Log.Information("SAP1Emu: End Engine Run"); + // Log.Information("SAP1Emu: End Engine Run"); - Log.CloseAndFlush(); + // Log.CloseAndFlush(); #endregion } diff --git a/SAP1EMU.Engine/SAP1EMU.Engine.csproj b/SAP1EMU.Engine/SAP1EMU.Engine.csproj index a134eb5a..b923b3b6 100644 --- a/SAP1EMU.Engine/SAP1EMU.Engine.csproj +++ b/SAP1EMU.Engine/SAP1EMU.Engine.csproj @@ -10,6 +10,12 @@ <Company /> </PropertyGroup> + <ItemGroup> + <Content Include="..\SAP1EMU.Lib\InstructionSets.json" Link="InstructionSets.json"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + </ItemGroup> + <ItemGroup> <PackageReference Include="Serilog" Version="2.9.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> diff --git a/SAP1EMU.GUI.TEST/SAP1EMU.GUI.Test.csproj b/SAP1EMU.GUI.TEST/SAP1EMU.GUI.Test.csproj new file mode 100644 index 00000000..a2e87aa3 --- /dev/null +++ b/SAP1EMU.GUI.TEST/SAP1EMU.GUI.Test.csproj @@ -0,0 +1,25 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>netcoreapp3.1</TargetFramework> + + <IsPackable>false</IsPackable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.7" /> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> + <PackageReference Include="xunit" Version="2.4.0" /> + <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> + <PackageReference Include="coverlet.collector" Version="1.2.0" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\SAP1EMU.GUI\SAP1EMU.GUI.csproj" /> + </ItemGroup> + + <ItemGroup> + <Folder Include="Tests\Shared\" /> + </ItemGroup> + +</Project> diff --git a/SAP1EMU.GUI.TEST/Tests/Home/HomePageOnGet.cs b/SAP1EMU.GUI.TEST/Tests/Home/HomePageOnGet.cs new file mode 100644 index 00000000..df14c1dd --- /dev/null +++ b/SAP1EMU.GUI.TEST/Tests/Home/HomePageOnGet.cs @@ -0,0 +1,38 @@ +using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.Extensions.Hosting; +using System; +using System.Net.Http; +using Xunit; +using SAP1EMU.GUI.Test; +using System.Threading.Tasks; + +namespace SAP1EMU.GUI.Test.Tests.Home +{ + + + [Collection("Sequential")] + public class HomePageOnGet : IClassFixture<WebTestFixture> + { + public HttpClient Client { get; } + + public HomePageOnGet(WebTestFixture factory) + { + Client = factory.CreateClient(); + } + + + + + [Fact] + public async Task ReturnsHomePage() + { + // Arrange & Act + var response = await Client.GetAsync("/"); + response.EnsureSuccessStatusCode(); + var stringResponse = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Contains("Welcome to the SAP1Emu Project", stringResponse); + } + } +} diff --git a/SAP1EMU.GUI.TEST/WebTestFixture.cs b/SAP1EMU.GUI.TEST/WebTestFixture.cs new file mode 100644 index 00000000..7972753c --- /dev/null +++ b/SAP1EMU.GUI.TEST/WebTestFixture.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc.Testing; +using System; +using System.Collections.Generic; +using System.Text; + +namespace SAP1EMU.GUI.Test +{ + public class WebTestFixture : WebApplicationFactory<Startup> + { + // If i needed to configure the server in a different way, aka - point to a test db instead of a prod db + //protected override void ConfigureWebHost(IWebHostBuilder builder) + //{ + // Those congig changes would happen here + // See: https://docs.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/test-asp-net-core-mvc-apps + // for more info + //} + } +} diff --git a/SAP1EMU.GUI/.config/dotnet-tools.json b/SAP1EMU.GUI/.config/dotnet-tools.json new file mode 100644 index 00000000..e53f8660 --- /dev/null +++ b/SAP1EMU.GUI/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "3.1.7", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/SAP1EMU.GUI/Contexts/Sap1EmuContext.cs b/SAP1EMU.GUI/Contexts/Sap1EmuContext.cs new file mode 100644 index 00000000..74080a33 --- /dev/null +++ b/SAP1EMU.GUI/Contexts/Sap1EmuContext.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore; +using SAP1EMU.GUI.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace SAP1EMU.GUI.Contexts +{ + public class Sap1EmuContext : DbContext + { + public Sap1EmuContext(DbContextOptions<Sap1EmuContext> options) + : base(options) + { + + } + + public DbSet<CodeSubmit> CodeStore { get; set; } + + + } +} diff --git a/SAP1EMU.WebApp/Controllers/AssemblerController.cs b/SAP1EMU.GUI/Controllers/AssemblerController.cs similarity index 96% rename from SAP1EMU.WebApp/Controllers/AssemblerController.cs rename to SAP1EMU.GUI/Controllers/AssemblerController.cs index 6b0b26d7..d129f05b 100644 --- a/SAP1EMU.WebApp/Controllers/AssemblerController.cs +++ b/SAP1EMU.GUI/Controllers/AssemblerController.cs @@ -8,7 +8,7 @@ using SAP1EMU.Assembler; using SAP1EMU.Lib; -namespace SAP1EMU.WebApp.Controllers +namespace SAP1EMU.GUI.Controllers { [Route("api/[controller]")] [ApiController] @@ -21,13 +21,11 @@ public ActionResult<IEnumerable<string>> Get() try { return Ok(OpCodeLoader.GetISetNames()); - } catch (Exception e) { return BadRequest(e.Message + " " + e.InnerException.Message); } - } public class AssemblePacket diff --git a/SAP1EMU.GUI/Controllers/DocsController.cs b/SAP1EMU.GUI/Controllers/DocsController.cs new file mode 100644 index 00000000..5120b0cf --- /dev/null +++ b/SAP1EMU.GUI/Controllers/DocsController.cs @@ -0,0 +1,56 @@ +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SAP1EMU.GUI.Models; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace SAP1EMU.GUI.Controllers +{ + public class DocsController : Controller + { + private readonly ILogger<HomeController> _logger; + + public DocsController(ILogger<HomeController> logger) + { + _logger = logger; + } + + public IActionResult Docs() + { + return View(); + } + + public IActionResult EightBitProgramming_1() + { + return View(); + } + + public IActionResult EightBitProgramming_2() + { + return View(); + } + + public IActionResult EightBitProgramming_3() + { + return View(); + } + + public IActionResult EightBitProgramming_4() + { + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/SAP1EMU.GUI/Controllers/EightBitController.cs b/SAP1EMU.GUI/Controllers/EightBitController.cs new file mode 100644 index 00000000..1666a425 --- /dev/null +++ b/SAP1EMU.GUI/Controllers/EightBitController.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Mvc; + +namespace SAP1EMU.GUI.Controllers +{ + public class EightBitController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult EightBitProgramming() + { + return View(); + } + } +} diff --git a/SAP1EMU.GUI/Controllers/EmulatorController.cs b/SAP1EMU.GUI/Controllers/EmulatorController.cs new file mode 100644 index 00000000..01ad0cc3 --- /dev/null +++ b/SAP1EMU.GUI/Controllers/EmulatorController.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +using SAP1EMU.Engine; +using SAP1EMU.Assembler; +using SAP1EMU.Lib; +using Microsoft.EntityFrameworkCore; +using SAP1EMU.GUI.Contexts; +using SAP1EMU.GUI.Models; + +namespace SAP1EMU.GUI.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class EmulatorController : ControllerBase + { + IDecoder _decoder { get; set; } + Sap1EmuContext _sap1EmuContext { get; set; } + public EmulatorController(IDecoder decoder, Sap1EmuContext sap1EmuContext) + { + _decoder = decoder; + _sap1EmuContext = sap1EmuContext; + } + + + public class EmulatorPacket + { + public List<string> CodeList { get; set; } + public string SetName { get; set; } + } + // POST: api/Emulator + [HttpPost] + public async Task<ActionResult> PostAsync([FromBody] EmulatorPacket emulatorPacket) + { + try + { + List<string> compiled_binary = Assemble.Parse(emulatorPacket.CodeList, emulatorPacket.SetName); + RAMProgram rmp = new RAMProgram(compiled_binary); + + + EngineProc engine = new EngineProc(); + engine.Init(rmp, _decoder, emulatorPacket.SetName); + + engine.Run(); + + try + { + _sap1EmuContext.Add<CodeSubmit>(new CodeSubmit + { + code = emulatorPacket.CodeList.Aggregate("", (current, s) => current + (s + ",")), + submitted_at = DateTime.Now + }); + await _sap1EmuContext.SaveChangesAsync(); + } + catch(Exception) + { + // TODO: Log DB Error + } + + + return Ok(engine.FrameStack()); + + } + catch (Exception e) + { + if(e.InnerException != null) + { + return BadRequest(e.Message + " " + e.InnerException.Message); + } + else + { + return BadRequest(e.Message); + } + } + } + + + //// TODO start from here + //[HttpGet] + //public string Get(string binCode, string setName) + //{ + // return _decoder.Decode(binCode, setName); + //} + + } +} diff --git a/SAP1EMU.GUI/Controllers/HomeController.cs b/SAP1EMU.GUI/Controllers/HomeController.cs new file mode 100644 index 00000000..a1bb2999 --- /dev/null +++ b/SAP1EMU.GUI/Controllers/HomeController.cs @@ -0,0 +1,59 @@ +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SAP1EMU.GUI.Models; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace SAP1EMU.GUI.Controllers +{ + public class HomeController : Controller + { + private readonly ILogger<HomeController> _logger; + + public HomeController(ILogger<HomeController> logger) + { + _logger = logger; + } + + public IActionResult Index() + { + return View(); + } + public IActionResult About() + { + return View(); + } + public IActionResult Emulator() + { + return View(); + } + public IActionResult Assembler() + { + return View(); + } + + public IActionResult Privacy() + { + return View(); + } + + public IActionResult Contributors() + { + return View(); + } + + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/SAP1EMU.GUI/InstructionSets.json b/SAP1EMU.GUI/InstructionSets.json new file mode 100644 index 00000000..990253cc --- /dev/null +++ b/SAP1EMU.GUI/InstructionSets.json @@ -0,0 +1,356 @@ +[ + { + "SetName": "SAP1Emu", + "SetDescription": "The full intruction set for the SAP1Emu Project.", + "instructions": [ + { + "OpCode": "LDA", + "BinCode": "0000", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101100001111000", + "00111110001111000" + ] + }, + { + "OpCode": "ADD", + "BinCode": "0001", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101110000111000", + "00111100011111000" + ] + }, + { + "OpCode": "SUB", + "BinCode": "0010", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101110000111000", + "00111100111111000" + ] + }, + { + "OpCode": "STA", + "BinCode": "0011", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00111111001101000", + "00111110001111000" + ] + }, + { + "OpCode": "JMP", + "BinCode": "0100", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111010001110000", + "00111110001111000", + "00111110001111000" + ] + }, + { + "OpCode": "JEQ", + "BinCode": "0101", + "MicroCode": [ + "01011110001111001", + "10111110001111001", + "00100110001111001", + "00111010001110001", + "00111110001111001", + "00111110001111001" + ] + }, + { + "OpCode": "JNQ", + "BinCode": "0110", + "MicroCode": [ + "01011110001111010", + "10111110001111010", + "00100110001111010", + "00111010001110010", + "00111110001111010", + "00111110001111010" + ] + }, + { + "OpCode": "JLT", + "BinCode": "0111", + "MicroCode": [ + "01011110001111011", + "10111110001111011", + "00100110001111011", + "00111010001110011", + "00111110001111011", + "00111110001111011" + ] + }, + { + "OpCode": "JGT", + "BinCode": "1000", + "MicroCode": [ + "01011110001111100", + "10111110001111100", + "00100110001111100", + "00111010001110100", + "00111110001111100", + "00111110001111100" + ] + }, + { + "OpCode": "JIC", + "BinCode": "1001", + "MicroCode": [ + "01011110001111101", + "10111110001111101", + "00100110001111101", + "00111010001110101", + "00111110001111101", + "00111110001111101" + ] + }, + { + "OpCode": "OUT", + "BinCode": "1110", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111111001011000", + "00111110001111000", + "00111110001111000" + ] + }, + { + "OpCode": "HLT", + "BinCode": "1111", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111110001111000", + "00111110001111000", + "00111110001111000" + ] + } + ] + }, + { + "SetName": "Malvino", + "SetDescription": "The instruction set outlined in Digital Computer Electronics by Malvino & Brown.\nThe SAP1Emu Set is a superset of the Malvino Set.", + "instructions": [ + { + "OpCode": "LDA", + "BinCode": "0000", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101100001111000", + "00111110001111000" + ] + }, + { + "OpCode": "ADD", + "BinCode": "0001", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101110000111000", + "00111100011111000" + ] + }, + { + "OpCode": "SUB", + "BinCode": "0010", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101110000111000", + "00111100111111000" + ] + }, + { + "OpCode": "OUT", + "BinCode": "1110", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111111001011000", + "00111110001111000", + "00111110001111000" + ] + }, + { + "OpCode": "HLT", + "BinCode": "1111", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111110001111000", + "00111110001111000", + "00111110001111000" + ] + } + ] + }, + { + "SetName": "BenEater", + "SetDescription": "The instruction set outlined by Ben Eater.", + "instructions": [ + { + "OpCode": "NOP", + "BinCode": "0000", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111110001111000", + "00111110001111000", + "00111110001111000" + ] + }, + { + "OpCode": "LDA", + "BinCode": "0001", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101100001111000", + "00111110001111000" + ] + }, + { + "OpCode": "ADD", + "BinCode": "0010", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101110000111000", + "00111100011111000" + ] + }, + { + "OpCode": "SUB", + "BinCode": "0011", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00101110000111000", + "00111100111111000" + ] + }, + { + "OpCode": "STA", + "BinCode": "0100", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00011010001111000", + "00111111001101000", + "00111110001111000" + ] + }, + { + "OpCode": "LDI", + "BinCode": "0101", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111000001111000", + "00111110001111000", + "00111110001111000" + ] + }, + { + "OpCode": "JMP", + "BinCode": "0110", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111010001110000", + "00111110001111000", + "00111110001111000" + ] + }, + { + "OpCode": "JIC", + "BinCode": "0111", + "MicroCode": [ + "01011110001111010", + "10111110001111010", + "00100110001111010", + "00111010001110010", + "00111110001111010", + "00111110001111010" + ] + }, + { + "OpCode": "JEQ", + "BinCode": "1000", + "MicroCode": [ + "01011110001111001", + "10111110001111001", + "00100110001111001", + "00111010001110001", + "00111110001111001", + "00111110001111001" + ] + }, + { + "OpCode": "OUT", + "BinCode": "1110", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111111001011000", + "00111110001111000", + "00111110001111000" + ] + }, + { + "OpCode": "HLT", + "BinCode": "1111", + "MicroCode": [ + "01011110001111000", + "10111110001111000", + "00100110001111000", + "00111110001111000", + "00111110001111000", + "00111110001111000" + ] + } + ] + } +] \ No newline at end of file diff --git a/SAP1EMU.GUI/Migrations/20200925040849_CodeStoreMigration.Designer.cs b/SAP1EMU.GUI/Migrations/20200925040849_CodeStoreMigration.Designer.cs new file mode 100644 index 00000000..6f4ddf94 --- /dev/null +++ b/SAP1EMU.GUI/Migrations/20200925040849_CodeStoreMigration.Designer.cs @@ -0,0 +1,44 @@ +// <auto-generated /> +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SAP1EMU.GUI.Contexts; + +namespace SAP1EMU.GUI.Migrations +{ + [DbContext(typeof(Sap1EmuContext))] + [Migration("20200925040849_CodeStoreMigration")] + partial class CodeStoreMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("SAP1EMU.GUI.Models.CodeSubmit", b => + { + b.Property<int>("id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property<string>("code") + .HasColumnType("nvarchar(max)"); + + b.Property<DateTime>("submitted_at") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.ToTable("CodeStore"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SAP1EMU.GUI/Migrations/20200925040849_CodeStoreMigration.cs b/SAP1EMU.GUI/Migrations/20200925040849_CodeStoreMigration.cs new file mode 100644 index 00000000..be8395b4 --- /dev/null +++ b/SAP1EMU.GUI/Migrations/20200925040849_CodeStoreMigration.cs @@ -0,0 +1,31 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SAP1EMU.GUI.Migrations +{ + public partial class CodeStoreMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CodeStore", + columns: table => new + { + id = table.Column<int>(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + code = table.Column<string>(nullable: true), + submitted_at = table.Column<DateTime>(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CodeStore", x => x.id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CodeStore"); + } + } +} diff --git a/SAP1EMU.GUI/Migrations/Sap1EmuContextModelSnapshot.cs b/SAP1EMU.GUI/Migrations/Sap1EmuContextModelSnapshot.cs new file mode 100644 index 00000000..1af43eda --- /dev/null +++ b/SAP1EMU.GUI/Migrations/Sap1EmuContextModelSnapshot.cs @@ -0,0 +1,42 @@ +// <auto-generated /> +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SAP1EMU.GUI.Contexts; + +namespace SAP1EMU.GUI.Migrations +{ + [DbContext(typeof(Sap1EmuContext))] + partial class Sap1EmuContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("SAP1EMU.GUI.Models.CodeSubmit", b => + { + b.Property<int>("id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property<string>("code") + .HasColumnType("nvarchar(max)"); + + b.Property<DateTime>("submitted_at") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.ToTable("CodeStore"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SAP1EMU.WebApp/Models/CodeAreaModel.cs b/SAP1EMU.GUI/Models/CodeAreaModel.cs similarity index 85% rename from SAP1EMU.WebApp/Models/CodeAreaModel.cs rename to SAP1EMU.GUI/Models/CodeAreaModel.cs index 21b42846..3da2ed5e 100644 --- a/SAP1EMU.WebApp/Models/CodeAreaModel.cs +++ b/SAP1EMU.GUI/Models/CodeAreaModel.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace SAP1EMU.WebApp.Models +namespace SAP1EMU.GUI.Models { public class CodeAreaModel { diff --git a/SAP1EMU.GUI/Models/CodeSubmit.cs b/SAP1EMU.GUI/Models/CodeSubmit.cs new file mode 100644 index 00000000..d91935b1 --- /dev/null +++ b/SAP1EMU.GUI/Models/CodeSubmit.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace SAP1EMU.GUI.Models +{ + public class CodeSubmit + { + public int id { get; set; } + public string code { get; set; } + public DateTime submitted_at { get; set; } + } +} diff --git a/SAP1EMU.WebApp/Models/ErrorViewModel.cs b/SAP1EMU.GUI/Models/ErrorViewModel.cs similarity index 84% rename from SAP1EMU.WebApp/Models/ErrorViewModel.cs rename to SAP1EMU.GUI/Models/ErrorViewModel.cs index a9da596c..91499ed3 100644 --- a/SAP1EMU.WebApp/Models/ErrorViewModel.cs +++ b/SAP1EMU.GUI/Models/ErrorViewModel.cs @@ -1,6 +1,6 @@ using System; -namespace SAP1EMU.WebApp.Models +namespace SAP1EMU.GUI.Models { public class ErrorViewModel { diff --git a/SAP1EMU.GUI/Models/GitHubProfileModel.cs b/SAP1EMU.GUI/Models/GitHubProfileModel.cs new file mode 100644 index 00000000..958b3ab8 --- /dev/null +++ b/SAP1EMU.GUI/Models/GitHubProfileModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using System.Text.Json; + + +namespace SAP1EMU.GUI.Models +{ + public class GitHubProfileModel + { + public static async Task<GitHubProfileModel> GetProfile(string username) + { + HttpClient httpClient = new HttpClient(); + httpClient.DefaultRequestHeaders.Add("User-Agent", "SAP1Emu WebApp"); + var result = await httpClient.GetAsync($"https://api.github.com/users/{username}"); + return JsonSerializer.Deserialize<GitHubProfileModel>(await result.Content.ReadAsStringAsync()); + } + + public string login { get; set; } + public string avatar_url { get; set; } + public string html_url { get; set; } + public string followers_url { get; set; } + public string following_url { get; set; } + public string name { get; set; } + public string bio { get; set; } + public int public_repos { get; set; } + public int followers { get; set; } + + } +} diff --git a/SAP1EMU.GUI/Models/PageNavHelperModel.cs b/SAP1EMU.GUI/Models/PageNavHelperModel.cs new file mode 100644 index 00000000..e891c8fc --- /dev/null +++ b/SAP1EMU.GUI/Models/PageNavHelperModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace SAP1EMU.GUI.Models +{ + public class PageNavHelperModel + { + public string ControllerName { get; set; } + public string PreviousView { get; set; } + public string PreviousViewDisplay { get; set; } + public string NextView { get; set; } + public string NextViewDisplay { get; set; } + } +} diff --git a/SAP1EMU.WebApp/Models/TestAJAXModel.cs b/SAP1EMU.GUI/Models/TestAJAXModel.cs similarity index 94% rename from SAP1EMU.WebApp/Models/TestAJAXModel.cs rename to SAP1EMU.GUI/Models/TestAJAXModel.cs index 6729c6d6..9bfb8d2a 100644 --- a/SAP1EMU.WebApp/Models/TestAJAXModel.cs +++ b/SAP1EMU.GUI/Models/TestAJAXModel.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -namespace SAP1EMU.WebApp.Models +namespace SAP1EMU.GUI.Models { public class InputModel { diff --git a/SAP1EMU.WebApp/Program.cs b/SAP1EMU.GUI/Program.cs similarity index 50% rename from SAP1EMU.WebApp/Program.cs rename to SAP1EMU.GUI/Program.cs index db3bfcf9..96da85c2 100644 --- a/SAP1EMU.WebApp/Program.cs +++ b/SAP1EMU.GUI/Program.cs @@ -8,7 +8,7 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -namespace SAP1EMU.WebApp +namespace SAP1EMU.GUI { public class Program { @@ -16,12 +16,18 @@ public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup<Startup>().UseElectron(args); - }); + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup<Startup>(); + }); + //public static IHostBuilder CreateHostBuilder(string[] args) => + // Host.CreateDefaultBuilder(args) + // .ConfigureWebHostDefaults(webBuilder => + // { + // webBuilder.UseElectron(args); + // webBuilder.UseStartup<Startup>(); + // }); } } diff --git a/SAP1EMU.WebApp/SAP1EMU.WebApp.csproj b/SAP1EMU.GUI/SAP1EMU.GUI.csproj similarity index 56% rename from SAP1EMU.WebApp/SAP1EMU.WebApp.csproj rename to SAP1EMU.GUI/SAP1EMU.GUI.csproj index b675c0b0..f9d664ef 100644 --- a/SAP1EMU.WebApp/SAP1EMU.WebApp.csproj +++ b/SAP1EMU.GUI/SAP1EMU.GUI.csproj @@ -1,26 +1,35 @@ <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> - <Version>1.14.0</Version> + <Version>2.0.1</Version> + <UserSecretsId>cc757b8c-63b5-49b2-8dd9-e2960a0882aa</UserSecretsId> + <AssemblyVersion>2.0.1.0</AssemblyVersion> + <Authors>Bob Baker, Sean Raven, Bryce Callender</Authors> + <Company>SAP1Emu Project</Company> + <PackageProjectUrl>sap1emu.net</PackageProjectUrl> + <RepositoryUrl>https://github.com/rbaker26/SAP1EMU</RepositoryUrl> + <RepositoryType>git</RepositoryType> + <NeutralLanguage>en</NeutralLanguage> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <DefineConstants>DEBUG;TRACE</DefineConstants> </PropertyGroup> <ItemGroup> - <Content Include="..\SAP1EMU.Lib\InstructionSets.json" Link="InstructionSets.json"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </Content> + <Content Remove="InstructionSets.json" /> </ItemGroup> <ItemGroup> - <PackageReference Include="ElectronNET.API" Version="8.31.1" /> + <PackageReference Include="ElectronNET.API" Version="9.31.1" /> <PackageReference Include="jQuery" Version="3.5.1" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2"> + <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.14.0" /> + <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.7" /> + <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.8" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="Microsoft.jQuery.Unobtrusive.Ajax" Version="3.2.6" /> - <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" /> + <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> </ItemGroup> <ItemGroup> @@ -32,11 +41,18 @@ </Content> </ItemGroup> <ItemGroup> - <Folder Include="wwwroot\img\" /> + <None Include="InstructionSets.json"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> </ItemGroup> <ItemGroup> <ProjectReference Include="..\SAP1EMU.Assembler\SAP1EMU.Assembler.csproj" /> <ProjectReference Include="..\SAP1EMU.Engine\SAP1EMU.Engine.csproj" /> <ProjectReference Include="..\SAP1EMU.Lib\SAP1EMU.Lib.csproj" /> </ItemGroup> + <ItemGroup> + <Folder Include="Migrations\" /> + <Folder Include="wwwroot\img\Docs\" /> + </ItemGroup> + <ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions> </Project> \ No newline at end of file diff --git a/SAP1EMU.GUI/Startup.cs b/SAP1EMU.GUI/Startup.cs new file mode 100644 index 00000000..b87b3bda --- /dev/null +++ b/SAP1EMU.GUI/Startup.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using ElectronNET.API; +using ElectronNET.API.Entities; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.FileProviders; +using System.IO; +using SAP1EMU.Lib; +using SAP1EMU.GUI.Contexts; +using Microsoft.EntityFrameworkCore; + +namespace SAP1EMU.GUI +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.Configure<CookiePolicyOptions>(options => + { + // This lambda determines whether user consent for non-essential + // cookies is needed for a given request. + options.CheckConsentNeeded = context => true; + // requires using Microsoft.AspNetCore.Http; + options.MinimumSameSitePolicy = SameSiteMode.None; + }); + + // The following line enables Application Insights telemetry collection. + services.AddApplicationInsightsTelemetry(); + + + services.AddSingleton<IDecoder, InstructionDecoder>(); + + services.AddControllersWithViews().AddRazorRuntimeCompilation(); + services.AddDbContext<Sap1EmuContext>(options => + options.UseSqlServer(Configuration.GetConnectionString("sap1emu_db_conn_string"))); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseStaticFiles(); + app.UseCookiePolicy(); + + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}"); + }); + + //app.Use(async (context, next) => + //{ + // context.Response.Headers.Add("X-Xss-Protection", "1"); + // await next(); + //}); + + + //ElectronBootstrap(); + //Task.Run(async () => await Electron.WindowManager.CreateWindowAsync(browserWindowOptions)).Result.WebContents.Session.ClearCacheAsync(); + //Electron.WindowManager.CreateWindowAsync().Result.BlurWebView(); + } + + private async void ElectronBootstrap() + { + var display = Electron.Screen.GetPrimaryDisplayAsync().Result; + + + var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions() + { + Width = display.WorkAreaSize.Width, + Height = display.WorkAreaSize.Height, + Show = false, + + WebPreferences = new WebPreferences + { + WebSecurity = false + } + }); + + await browserWindow.WebContents.Session.ClearCacheAsync(); + browserWindow.OnReadyToShow += () => browserWindow.Show(); + browserWindow.SetTitle("SAP1Emu"); + } + } +} diff --git a/SAP1EMU.GUI/Views/Docs/Docs.cshtml b/SAP1EMU.GUI/Views/Docs/Docs.cshtml new file mode 100644 index 00000000..c0703cf3 --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/Docs.cshtml @@ -0,0 +1,23 @@ +@{ + ViewData["Title"] = "Docs"; +} + + + +<div class="jumbotron"> + <h1 class="display-4">Welcome to SAP1Emu Project Docs</h1> + <p class="lead">The only resource you need to find all the information, tutorials and example programs for the SAP1 computer.</p> + <hr class="my-4"> + <p class="mb-0">For information about code and other documentation, please visit the GitHub Repository below.</p> + <p class="mt-0">If you would like to contribute to this project financially, please see the Sponsor link below.</p> + <a class="btn btn-primary btn-lg" href="https://github.com/rbaker26/SAP1EMU" role="button" target="_blank">GitHub</a> + <a class="btn btn-danger btn-lg" href="https://github.com/sponsors/rbaker26" role="button" target="_blank">Sponsor</a> + +</div> + +<p class="mt-3"> + Note: We are slowly migrating from our wiki to this site for all SAP1Emu documentation. Click the link above to go the wiki if you cannot find answers here. +</p> + + +@{ await Html.RenderPartialAsync("_DocNav"); } diff --git a/SAP1EMU.GUI/Views/Docs/EightBitProgramming_1.cshtml b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_1.cshtml new file mode 100644 index 00000000..26514eb9 --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_1.cshtml @@ -0,0 +1,87 @@ +@{ + ViewData["Title"] = "8Bit"; +} + +<h1>8-Bit Programming</h1> +<p class="lead"> + An Introduction to Limited Instruction Set Programs +</p> + + +<p> + This learning module will go over everything you need to start writting programs for the SAP1 Computer. +</p> + + +@{ await Html.RenderPartialAsync("_EightBitProgramming_TOC"); } + + + + +<h2 class="mt-4">What does 8-Bit mean?</h2> +<p> + 8-Bit describes the bus-width of a CPU, meaning that it can transfer 8 bits of data in a single operation. + This means our CPU can only use 8 bits of data to make up one instruction. <br /> <br /> + + Now, you might think that with 8 ones and zeros we could have 256 different instructions/operations, and you would be half right. + In addition to the instruction, our CPU will need some data to use in that instruction. + The SAP1 Computer accomplishes this by reserving the first 4 bits for the instruction and the last 4 bits for the data / instruction parameter. <br /> + + <small> + Note: The first 4 bits are called the <span class="text-muted">Upper Nibble</span> and the last 4 bits are called the <span class="text-muted">Lower Nibble</span>. + </small> + <br /> <br /> + + So if we were to look at an instruction in Machine Language (ones and zeros) entering the CPU we might see something like this: + <div class="alert alert-dark mb-1" role="alert"> + 0001 1010 + </div> + <small> + In the above example, <code>0001</code> would be the instruction and <code>1010</code> would the the data / instruction parameter. + </small> + + <br /> <br /> + + Knowing that we have only 4 bits to store our instruction, we can say that our SAP1 Computer can only use 16, or 2<sup>4</sup> instructions. + This is because we only have 4 ones and zeros to represent our instruction (0000, 0001, 0010, ..., 1110, 1111). +</p> + +<h2 class="mt-4">One-to-One Compiling</h2> +<p> + In the above example, a complete instruction is listed as <code>0001 1010</code>. This type of Machine Language code is not very easy to program with + because it requires the programmer to remember what all the ones and zeros mean. + To help programmers write code, most Machine Languages are accompanied by an One-To-One Assembly Language, in this case, the SAP1Emu Project supports three. + + <br /> + <br /> + + A One-to-One language means there is some human-readable code that directly maps to the Machine Language. If we were to write the above code in SAP1Emu Assembly Language, + it would look like this: + <div class="alert alert-dark mb-1" role="alert"> + ADD 0xA + </div> + <small> + In the above example, <code>0xA</code> is the Hex value for <code>10</code> in decimal. The <code>0x</code> prefix denotes a hex-number. + </small> +</p> +@*<div class="row"> + <div class="col-auto"></div> + <div class="col"></div> + <div class="col-auto"> + <button class="btn btn-primary">Next - Exploring the Instruction Set</button> + </div> + </div>*@ + +<div class="mt-4"> + @{ await Html.RenderPartialAsync("_PageNavHelper", new PageNavHelperModel + { + ControllerName = "Docs", + PreviousView = "", + PreviousViewDisplay = "", + NextView = "EightBitProgramming_2", + NextViewDisplay = "Exploring the Instruction Set" + } + ); + } +</div> + diff --git a/SAP1EMU.GUI/Views/Docs/EightBitProgramming_2.cshtml b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_2.cshtml new file mode 100644 index 00000000..97468aad --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_2.cshtml @@ -0,0 +1,38 @@ +@{ + ViewData["Title"] = "8Bit"; +} + +<h1>8-Bit Programming</h1> +<p class="lead"> + An Introduction to Limited Instruction Set Programs +</p> + + +@{ await Html.RenderPartialAsync("_EightBitProgramming_TOC"); } + +<p class="mb-4"> + Below are lists the three different Instruction Sets, or Assmebly Languages, that the SAP1Emu Emulator supports. + If an instruction, or <span class="text-muted">OpCode</span>, is followed by a <code>0xH</code>, that means <code>H</code> can be replaced by any + valid hex digit (0 - F). + <br /> + If a <span class="text-muted">OpCode</span> is follwed by a <code>0x0</code>, that means the <span class="text-muted">Lower Nibble</span> is not used and its value does not matter. + <br /> + <br /> + <small>Note, you can only use instructions from one instruction set at a time. They cannot be mixed.</small> +</p> + +@{ await Html.RenderPartialAsync("_InstructionSets"); } + + +<div class="mt-4"> + @{ await Html.RenderPartialAsync("_PageNavHelper", new PageNavHelperModel + { + ControllerName = "Docs", + PreviousView = "EightBitProgramming_1", + PreviousViewDisplay = "Introduction to 8-Bit", + NextView = "EightBitProgramming_3", + NextViewDisplay = "Macros and Comments" + } + ); + } +</div> diff --git a/SAP1EMU.GUI/Views/Docs/EightBitProgramming_3.cshtml b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_3.cshtml new file mode 100644 index 00000000..4963158f --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_3.cshtml @@ -0,0 +1,81 @@ +@{ + ViewData["Title"] = "8Bit"; +} + +<script src="/js/CodeMirror/lib/codemirror.js"></script> +<script src="/js/CodeMirror/mode/gas/gas_sap1.js" type="text/javascript"></script> +<link href="/js/CodeMirror/lib/codemirror.css" rel="stylesheet" type="text/css" /> +<script src="/js/Views/Docs/8BitDocs.js" type="text/javascript"></script> + +<h1>8-Bit Programming</h1> +<p class="lead"> + An Introduction to Limited Instruction Set Programs +</p> + + + +@{ await Html.RenderPartialAsync("_EightBitProgramming_TOC"); } + +<h2 class="mt-4">Macros</h2> +<p> + The SAP1Emu Emulator supports one marco, the <code>...</code> macro. + Since each program needs example 16 lines of code, the <code>...</code> macro will fill in the + extra lines in your program with <code>0x0 0x0</code>'s. This will be covered in more detail in the next section. + <br /> <br /> + Below is an example of the <code>...</code> macro in use. +</p> +<div class="row"> + <div class="col"> + <h6>Before the macro-expansion</h6> + @Html.TextArea("8Bit_P3_Example_Left", null, new { rows = "20", cols = "80", @class = "codebox", id = "8Bit_P3_Example_Left" }) + </div> + <div class="col"> + <h6>After the macro-expansion</h6> + @Html.TextArea("8Bit_P3_Example_Right", null, new { rows = "20", cols = "80", @class = "codebox", id = "8Bit_P3_Example_Right" }) + </div> +</div> +<p class="mt-3"> + As you can see, the <code>...</code> macro filled the empty space with <code>0x0 0x0</code>'s until the program + has 16 lines of code. + <br /> + It is also important to note that the macro is executed by the Parser, not the Emulator. + This means the Emulator will never see the macro. Instead it will only see the <code>0x0 0x0</code>'s left behind + by the Parser. +</p> + + +<h2 class="mt-4">Comments</h2> +<p> + A comment is a line of code that is not executed. They are stripped out by the Parser, so they never reach the Emulator. + Due to the difficulty in reading Assembly-like code, comments should be used to help you remember what your code does. + <br /> <br /> + The SAP1Emu uses Bash-Style comments utilizing the <code>#</code>. Anything that comes after a <code>#</code> is + not treated as code. Comments can take up their own line or come after code. + <br /> + Below is an example of comments in use. +</p> +<div class="row"> + <div class="col"> + <h6>Before comments are stripped out</h6> + @Html.TextArea("8Bit_P3_Example_Comment_Left", null, new { rows = "20", cols = "80", @class = "codebox", id = "8Bit_P3_Example_Comment_Left" }) + </div> + <div class="col"> + <h6>After comments are stripped out</h6> + @Html.TextArea("8Bit_P3_Example_Comment_Right", null, new { rows = "20", cols = "80", @class = "codebox", id = "8Bit_P3_Example_Comment_Right" }) + </div> +</div> + + + +<div class="mt-4"> + @{ await Html.RenderPartialAsync("_PageNavHelper", new PageNavHelperModel + { + ControllerName = "Docs", + PreviousView = "EightBitProgramming_2", + PreviousViewDisplay = "Exploring the Instruction Set", + NextView = "EightBitProgramming_4", + NextViewDisplay = "Exploring the Binary" + } + ); + } +</div> diff --git a/SAP1EMU.GUI/Views/Docs/EightBitProgramming_4.cshtml b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_4.cshtml new file mode 100644 index 00000000..708f6f36 --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/EightBitProgramming_4.cshtml @@ -0,0 +1,42 @@ +@{ + ViewData["Title"] = "8Bit"; +} + +<h1>8-Bit Programming</h1> +<p class="lead"> + An Introduction to Limited Instruction Set Programs +</p> + +@{ await Html.RenderPartialAsync("_EightBitProgramming_TOC"); } + + +<p class="mb-4"> + Below are list of the three different Instruction Sets, or Assembly Langueges, and the related binary equivalents to their instructions. + <br /> + Unless you are progamming your physical SAP1 Computer or trying to perform a step-by-step debug of a SAP1Emu Program, knowing the + binary translations is not crucial. It is more important to know of their existence so you can reference them if needed. + <br /><br /> + If you see that an <span class="text-muted">OpCode</span> is followed by a <code>0xH</code>, that means <code>H</code> can be replaced by any + valid hex digit (0 - F). Likewise, if you see a <span class="text-muted">binary half-word</span> with <code>bbbb</code>, that means <code>bbbb</code> can be replaced by any + valid binary digit (0 or 1). + <br /> + <br /> + <small>Note, you can only use instructions from one instruction set at a time. They cannot be mixed.</small> +</p> +<p>test</p> + +@{ await Html.RenderPartialAsync("_InstructionSetsBinary"); } + + +<div class="mt-4"> + @{ await Html.RenderPartialAsync("_PageNavHelper", new PageNavHelperModel + { + ControllerName = "Docs", + PreviousView = "EightBitProgramming_3", + PreviousViewDisplay = "Macros and Comments", + NextView = "", + NextViewDisplay = "" + } + ); + } +</div> \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Docs/_DocNav.cshtml b/SAP1EMU.GUI/Views/Docs/_DocNav.cshtml new file mode 100644 index 00000000..4dfa7486 --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/_DocNav.cshtml @@ -0,0 +1,119 @@ +<div class="card-columns"> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/cpu.svg" width="50" class="p-2" /> + <h3 class="pt-2">The SAP1 Computer</h3> + </div> + + <p class="card-text"> + Explore the architecture and design of the SAP1 Computer. + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/modern-computer.svg" width="50" class="p-2" /> + <h3 class="pt-2">Modern Computing</h3> + </div> + + <p class="card-text"> + How are 8-Bit Computers similar and different from out modern computers? + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/learn.svg" width="50" class="p-2" /> + <h3 class="pt-2">Learning Resources</h3> + </div> + + <p class="card-text"> + Find other great learning resources. + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/code.svg" width="50" class="p-2" /> + <h3 class="pt-2">8-Bit Programming</h3> + </div> + + <p class="card-text"> + Write your first program and learn about different Instruction Sets. + </p> + <button class="btn btn-primary" onclick="location.href='@Url.Action("EightBitProgramming_1", "Docs")'">Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/asm.svg" width="50" class="p-2" /> + <h3 class="pt-2">Low-Level Languages</h3> + </div> + + <p class="card-text"> + Learn the basics of low level languages, like ARM, and how they relate to 8-Bit Computers. + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/cpp.svg" width="50" class="p-2" /> + <h3 class="pt-2">High-Level Languages</h3> + </div> + + <p class="card-text"> + Learn the basics of how high level languages work and why developers prefer them over low level languages. + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/cli.svg" width="50" class="p-2" /> + <h3 class="pt-2">SAP1Emu CLI</h3> + </div> + + <p class="card-text"> + Prefer to user our command line interface? + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/api.svg" width="50" class="p-2" /> + <h3 class="pt-2">SAP1Emu API</h3> + </div> + + <p class="card-text"> + Want to integrate your app directly to our API? + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <img src="~/img/Docs/netcore.svg" width="50" class="p-2" /> + <h3 class="pt-2">SAP1Emu Library</h3> + </div> + + <p class="card-text"> + Want to use our C# .Net Core Library? + </p> + <button class="btn btn-secondary" disabled>Learn More</button> + </div> + </div> +</div> \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Docs/_EightBitProgramming_TOC.cshtml b/SAP1EMU.GUI/Views/Docs/_EightBitProgramming_TOC.cshtml new file mode 100644 index 00000000..af3ce784 --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/_EightBitProgramming_TOC.cshtml @@ -0,0 +1,10 @@ +<div> + <h5>Table of Contents</h5> + <ol> + <li><a class="text-primary" onclick="location.href='@Url.Action("EightBitProgramming_1", "Docs")'">Introduction to 8-Bit</a></li> + <li><a class="text-primary" onclick="location.href='@Url.Action("EightBitProgramming_2", "Docs")'">Exploring the Instruction Set</a></li> + <li><a class="text-primary" onclick="location.href='@Url.Action("EightBitProgramming_3", "Docs")'">Macros and Comments</a></li> + <li><a class="text-primary" onclick="location.href='@Url.Action("EightBitProgramming_4", "Docs")'">Exploring the Binary</a></li> + <li><a class="text-primary">Your First Program</a></li> + </ol> +</div> \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Docs/_InstructionSets.cshtml b/SAP1EMU.GUI/Views/Docs/_InstructionSets.cshtml new file mode 100644 index 00000000..e23285d0 --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/_InstructionSets.cshtml @@ -0,0 +1,208 @@ +<div class="card"> + <div class="card-header"> + <h4 class="mb-4">Instruction Sets</h4> + <ul class="nav nav-tabs card-header-tabs" id="docTabs"> + <li class="nav-item"> + <a data-toggle="tab" class="nav-link active" href="#sap1emu-doc">SAP1Emu</a> + </li> + <li class="nav-item"> + <a data-toggle="tab" class="nav-link" href="#malvino-doc">Malvino</a> + </li> + <li class="nav-item"> + <a data-toggle="tab" class="nav-link" href="#beneater-doc">Ben Eater</a> + </li> + </ul> + </div> + <div class="card-body"> + <div class="tab-content mt-3"> + <div class="tab-pane active" id="sap1emu-doc" role="tabpanel"> + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">OpCode</th> + <th style="width: 150px;">Usage</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>LDA</td> + <td><code>LDA 0xH</code></td> + <td>Loads the value of <code>RAM[0xH]</code> into the <span class="text-muted">A Register</span>.</td> + </tr> + <tr> + <td>ADD</td> + <td><code>ADD 0xH</code></td> + <td> + Adds the value of <code>RAM[0xH]</code> to the value stored in the <span class="text-muted">A Register</span> + and stores the result in the <span class="text-muted">A Register</span>. + <br /> + <span class="badge badge-pill badge-info mt-4">Side Effects</span> + <br /> + Can set the <span class="text-muted">Carry Flag</span> or the <span class="text-muted">Zero Flag</span>. + </td> + </tr> + <tr> + <td>SUB</td> + <td><code>SUB 0xH</code></td> + <td> + Subtracts the value of <code>RAM[0xH]</code> from the value stored in the <span class="text-muted">A Register</span> + and stores the result in the <span class="text-muted">A Register</span>. + <br /> + <span class="badge badge-pill badge-info mt-4">Side Effects</span> + <br /> + Can set the <span class="text-muted">Underflow Flag</span> or the <span class="text-muted">Zero Flag</span>. + </td> + </tr> + <tr> + <td>STA</td> + <td><code>STA 0xH</code></td> + <td> + Stores the value of the <span class="text-muted">A Register</span> into <code>RAM[0xH]</code>. + <br /> + <span class="badge badge-pill badge-warning mt-4">Warning</span> + <br /> + This can overwrite code stored in <span class="text-muted">RAM</span> and cause an infinite loop or other undefined behavior. + </td> + </tr> + <tr> + <td>JMP</td> + <td><code>JMP 0xH</code></td> + <td> + Performs an unconditional jump to the specified address. + </td> + </tr> + <tr> + <td>JEQ</td> + <td><code>JEQ 0xH</code></td> + <td> + Performs a jump to the specified address if the value of the <span class="text-muted">A Register</span> is equal to zero. + </td> + </tr> + <tr> + <td>JNQ</td> + <td><code>JNQ 0xH</code></td> + <td> + Performs a jump to the specified address if the value of the <span class="text-muted">A Register</span> is NOT equal to zero. + </td> + </tr> + <tr> + <td>JLT</td> + <td><code>JLT 0xH</code></td> + <td> + Performs a jump to the specified address if the value of the <span class="text-muted">A Register</span> is less than zero. + <br /> + If the first bit of the value in the <span class="text-muted">A Register</span> is non-zero, it will treat it as a negitive + number for the purpose of this OpCode. + </td> + </tr> + <tr> + <td>JGT</td> + <td><code>JGT 0xH</code></td> + <td> + Performs a jump to the specified address if the value of the <span class="text-muted">A Register</span> is greater than zero. + <br /> + If the value in the <span class="text-muted">A Register</span> is non-zero but the first bit of the <span class="text-muted">A Register</span> is zero, it will treat it as a positive + number for the purpose of this OpCode. + </td> + </tr> + <tr> + <td>JIC</td> + <td><code>JIC 0xH</code></td> + <td> + Performs a jump to the specified address if the <span class="text-muted">Carry Flag</span> is set. + </td> + </tr> + <tr> + <td>OUT</td> + <td><code>OUT 0x0</code></td> + <td> + Stores the value of the <span class="text-muted">A Register</span> in the <span class="text-muted">Output Register</span>. + </td> + </tr> + <tr> + <td>HLT</td> + <td><code>HLT 0x0</code></td> + <td> + Halts the program execution. + </td> + </tr> + <tr> + <td>NOP</td> + <td><code>NOP 0x0</code></td> + <td> + A no-operation instruction. + <br /> + Must come after a <code>HLT</code> instruction. + <br /> + Also, see the <code>...</code> macro. + </td> + </tr> + </tbody> + </table> + </div> + <div class="tab-pane" id="malvino-doc" role="tabpanel"> + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">OpCode</th> + <th style="width: 150px;">Usage</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>LDA</td> + <td><code>LDA 0xH</code></td> + <td>Loads the value of <code>RAM[0xH]</code> into the <span class="text-muted">A Register</span>.</td> + </tr> + <tr> + <td>ADD</td> + <td><code>ADD 0xH</code></td> + <td> + Adds the value of <code>RAM[0xH]</code> to the value stored in the <span class="text-muted">A Register</span> + and stores the result in the <span class="text-muted">A Register</span>. + <br /> + <span class="badge badge-pill badge-info mt-4">Side Effects</span> + <br /> + Can set the <span class="text-muted">Carry Flag</span> or the <span class="text-muted">Zero Flag</span>. + </td> + </tr> + <tr> + <td>SUB</td> + <td><code>SUB 0xH</code></td> + <td> + Subtracts the value of <code>RAM[0xH]</code> from the value stored in the <span class="text-muted">A Register</span> + and stores the result in the <span class="text-muted">A Register</span>. + <br /> + <span class="badge badge-pill badge-info mt-4">Side Effects</span> + <br /> + Can set the <span class="text-muted">Underflow Flag</span> or the <span class="text-muted">Zero Flag</span>. + </td> + </tr> + <tr> + <td>OUT</td> + <td><code>OUT 0x0</code></td> + <td> + Stores the value of the <span class="text-muted">A Register</span> in the <span class="text-muted">Output Register</span>. + </td> + </tr> + <tr> + <td>HLT</td> + <td><code>HLT 0x0</code></td> + <td> + Halts the program execution. + </td> + </tr> + </tbody> + </table> + </div> + <div class="tab-pane" id="beneater-doc" role="tabpanel"> + <p class="lead"> + Documentation Coming Soon + </p> + </div> + </div> + </div> +</div> + diff --git a/SAP1EMU.GUI/Views/Docs/_InstructionSetsBinary.cshtml b/SAP1EMU.GUI/Views/Docs/_InstructionSetsBinary.cshtml new file mode 100644 index 00000000..beed541c --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/_InstructionSetsBinary.cshtml @@ -0,0 +1,144 @@ +<div class="card"> + <div class="card-header"> + <h4 class="mb-4">Instruction Sets</h4> + <ul class="nav nav-tabs card-header-tabs" id="docTabs"> + <li class="nav-item"> + <a data-toggle="tab" class="nav-link active" href="#sap1emu-doc">SAP1Emu</a> + </li> + <li class="nav-item"> + <a data-toggle="tab" class="nav-link" href="#malvino-doc">Malvino</a> + </li> + <li class="nav-item"> + <a data-toggle="tab" class="nav-link" href="#beneater-doc">Ben Eater</a> + </li> + </ul> + </div> + <div class="card-body"> + <div class="tab-content mt-3"> + <div class="tab-pane active" id="sap1emu-doc" role="tabpanel"> + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">OpCode</th> + <th style="width: 150px;">Usage</th> + <th>Binary Half-Word</th> + </tr> + </thead> + <tbody> + <tr> + <td>LDA</td> + <td><code>LDA 0xH</code></td> + <td><code>0000 bbbb</code></td> + </tr> + <tr> + <td>ADD</td> + <td><code>ADD 0xH</code></td> + <td><code>0001 bbbb</code></td> + + </tr> + <tr> + <td>SUB</td> + <td><code>SUB 0xH</code></td> + <td><code>0010 bbbb</code></td> + + </tr> + <tr> + <td>STA</td> + <td><code>STA 0xH</code></td> + <td><code>0011 bbbb</code></td> + </tr> + <tr> + <td>JMP</td> + <td><code>JMP 0xH</code></td> + <td><code>0100 bbbb</code></td> + </tr> + <tr> + <td>JEQ</td> + <td><code>JEQ 0xH</code></td> + <td><code>0101 bbbb</code></td> + </tr> + <tr> + <td>JNQ</td> + <td><code>JNQ 0xH</code></td> + <td><code>0110 bbbb</code></td> + </tr> + <tr> + <td>JLT</td> + <td><code>JLT 0xH</code></td> + <td><code>0111 bbbb</code></td> + </tr> + <tr> + <td>JGT</td> + <td><code>JGT 0xH</code></td> + <td><code>1000 bbbb</code></td> + </tr> + <tr> + <td>JIC</td> + <td><code>JIC 0xH</code></td> + <td><code>1001 bbbb</code></td> + </tr> + <tr> + <td>OUT</td> + <td><code>OUT 0x0</code></td> + <td><code>1110 0000</code></td> + </tr> + <tr> + <td>HLT</td> + <td><code>HLT 0x0</code></td> + <td><code>1111 0000</code></td> + </tr> + <tr> + <td>NOP</td> + <td><code>NOP 0x0</code></td> + <td><code>0000 0000</code></td> + </tr> + </tbody> + </table> + </div> + <div class="tab-pane" id="malvino-doc" role="tabpanel"> + <table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">OpCode</th> + <th style="width: 150px;">Usage</th> + <th>Binary Half-Word</th> + </tr> + </thead> + <tbody> + <tr> + <td>LDA</td> + <td><code>LDA 0xH</code></td> + <td><code>0000 bbbb</code></td> + </tr> + <tr> + <td>ADD</td> + <td><code>ADD 0xH</code></td> + <td><code>0001 bbbb</code></td> + </tr> + <tr> + <td>SUB</td> + <td><code>SUB 0xH</code></td> + <td><code>0010 bbbb</code></td> + </tr> + <tr> + <td>OUT</td> + <td><code>OUT 0x0</code></td> + <td><code>1110 0000</code></td> + </tr> + <tr> + <td>HLT</td> + <td><code>HLT 0x0</code></td> + <td><code>1111 0000</code></td> + </tr> + </tbody> + </table> + </div> + <div class="tab-pane" id="beneater-doc" role="tabpanel"> + <p class="lead"> + Documentation Coming Soon + </p> + </div> + </div> + </div> +</div> + diff --git a/SAP1EMU.GUI/Views/Docs/_PageNavHelper.cshtml b/SAP1EMU.GUI/Views/Docs/_PageNavHelper.cshtml new file mode 100644 index 00000000..f528c25f --- /dev/null +++ b/SAP1EMU.GUI/Views/Docs/_PageNavHelper.cshtml @@ -0,0 +1,22 @@ +@model PageNavHelperModel + +<div class="row justify-content-between"> + <div class="col-auto"> + @{ + if (!String.IsNullOrEmpty(Model.PreviousView)) + { + <button class="btn btn-primary" onclick="location.href='@Url.Action(Model.PreviousView, Model.ControllerName)'">Previous - @Model.PreviousViewDisplay</button> + } + } + </div> + @*<div class="col"></div>*@ + <div class="col-auto"> + @{ + if (!String.IsNullOrEmpty(Model.NextView)) + { + <button class="btn btn-primary" onclick="location.href='@Url.Action(Model.NextView, Model.ControllerName)'">Next - @Model.NextViewDisplay</button> + } + } + + </div> +</div> \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Home/About.cshtml b/SAP1EMU.GUI/Views/Home/About.cshtml new file mode 100644 index 00000000..a271bcd5 --- /dev/null +++ b/SAP1EMU.GUI/Views/Home/About.cshtml @@ -0,0 +1,69 @@ +@{ + ViewData["Title"] = "About"; +} + +<script src="~/js/Views/AboutView.js" type="text/javascript"></script> + + +<div class="jumbotron"> + <h1 class="display-4">Welcome to the SAP1Emu Project!</h1> + <p class="lead">The only open-source, multiplatform SAP1 Computer Emulator.</p> + <hr class="my-4"> + <p class="mb-0">For information about code and other documentation, please visit the GitHub Repository below.</p> + <p class="mt-0">If you would like to contribute to this project financially, please see the Sponsor link below.</p> + <a class="btn btn-primary btn-lg" href="https://github.com/rbaker26/SAP1EMU" role="button" target="_blank">GitHub</a> + <a class="btn btn-danger btn-lg" href="https://github.com/sponsors/rbaker26" role="button" target="_blank">Sponsor</a> + +</div> + +<div class="container mb-5"> + <h2>About this Project</h2> + <p> + The SAP1Emu Project is an open-source suite of tools designed for students and educators teaching + introductory courses in Computer Architecture or Digital Electronics. + It emulates the SAP1 Computer from <i>Digital Computer Electronics by Malvino and Brown</i>. <br /> <br /> + + This website provides an easy interface to the SAP1Emu API and Engine. + Also, the Engine CLI and Libary is also availble for download from the GitHub Repo.<br /> + </p> +</div> + +<div class="container mt-5"> + <h2>About the Author</h2> + <div class="row"> + <div class="col-8"> + <p class="mb-4"> + My name is Bob Baker and I am a Software Engineer mostly focusing on C#/.NET Core and C++. + <br /> + <br /> + Before becoming a Profesional Developer, I worked at Saddleback College as a Teacher's Assistant for the Intro to Computer Architecture and Machine Language Lab (CS1C). + As a TA I assisted many students in the building and debugging of SAP1 Computers. + During this time I found that, while there are a few software solutions to assist students; most were "half-baked", were no longer supported, or did not follow + the specification outlined by Malvino. + <br /> + <br /> + In the middle of Spring 2020, Saddleback had to shutdown due to the SARS-CoV-2 Pandemic and many students could not finish their final assignment for the course. + To help with that challange, I started this project and it has grown since then. + <br /> + <br /> + If you have any questions, my details are on my GitHub. Please feel free to reach out. + <br /> + <br /> + </p> + + <h2 class="mt-4">Contribute to this Project</h2> + <p> + I am always looking for help with this project. Check out the <a href="https://github.com/rbaker26/SAP1EMU/issues">GitHub Issues Page</a> or send me a Pull Request. If it benifits the project, I'd love to add it in. + <br /> + <br /> + <a asp-area="" asp-controller="Home" asp-action="Contributors">Click here</a> for a list of all Project Contributors. + </p> + </div> + + + <div class="col-4"> + @{ await Html.RenderPartialAsync("_GitHubProfilePartial", GitHubProfileModel.GetProfile("rbaker26").Result); } + </div> + </div> +</div> + diff --git a/SAP1EMU.GUI/Views/Home/Assembler.cshtml b/SAP1EMU.GUI/Views/Home/Assembler.cshtml new file mode 100644 index 00000000..86440886 --- /dev/null +++ b/SAP1EMU.GUI/Views/Home/Assembler.cshtml @@ -0,0 +1,71 @@ +<script src="/js/CodeMirror/lib/codemirror.js"></script> +<script src="/js/CodeMirror/mode/gas/gas_sap1.js" type="text/javascript"></script> +<link href="/js/CodeMirror/lib/codemirror.css" rel="stylesheet" type="text/css" /> + +<script src="/lib/jquery/dist/jquery.js" type="text/javascript"></script> +<script src="/js/Views/AssemblerView.js" type="text/javascript"></script> + +@{ + ViewData["Title"] = "Assembler"; +} + +<h1>Assembler</h1> + +<div class="card-deck"> + + <div class="card"> + <div class="card-header"> + <h4>Assembly</h4> + </div> + + <div class="card-body"> + <div class="form-row"> + <div class="col"> + @Html.TextArea("CodeList", null, new { rows = "20", cols = "80", @class = "codebox", id = "asm_code" }) + </div> + </div> + + <div class="form-row mt-4"> + <div class="form-group mx-2"> + <label for="langs">Instruction Set</label> + <select id="langs" class="form-control"></select> + </div> + <div class="form-group mx-2 d-flex align-items-center"> + <button class="btn btn-light" name="CodeList" onclick="AssembleCode()">Assemble</button> + </div> + <div class="form-group mx-2 d-flex align-items-center"> + <button class="btn btn-light" onclick="getFromFile()">Load from File</button> + </div> + </div> + + </div> + </div> + + <div class="card"> + <div class="card-header"> + <h4>Binary</h4> + </div> + + <div class="card-body"> + <div class="form-row"> + <div class="col"> + @Html.TextArea("bin_code", null, new { rows = "20", cols = "80", @class = "codebox", id = "bin_code" }) + </div> + </div> + + </div> + </div> +</div> + + +<div class="card-deck mt-4"> + <div class="card"> + <div class="card-header"> + <h4>Assembler Errors</h4> + </div> + <div class="card-body"> + <code class="assembler-out" id="assembler-out"><br /></code> + </div> + </div> +</div> + diff --git a/SAP1EMU.GUI/Views/Home/Contributors.cshtml b/SAP1EMU.GUI/Views/Home/Contributors.cshtml new file mode 100644 index 00000000..3cd05e03 --- /dev/null +++ b/SAP1EMU.GUI/Views/Home/Contributors.cshtml @@ -0,0 +1,22 @@ +@{ + ViewData["Title"] = "About"; +} + + <div class="container"> + <h1 class="mb-4">Contributors</h1> + + <div class="row"> + @*<div class="card-deck"> Will come later once more cards are made*@ + <div class="col-auto"> + @{ await Html.RenderPartialAsync("_GitHubProfilePartial", GitHubProfileModel.GetProfile("rbaker26").Result); } + </div> + <div class="col-auto"> + @{ await Html.RenderPartialAsync("_GitHubProfilePartial", GitHubProfileModel.GetProfile("dragon0").Result); } + </div> + <div class="col-auto"> + @{ await Html.RenderPartialAsync("_GitHubProfilePartial", GitHubProfileModel.GetProfile("BryceCallender").Result); } + </div> + <div class="col-6"> + </div> + </div> + </div> \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Home/Emulator.cshtml b/SAP1EMU.GUI/Views/Home/Emulator.cshtml new file mode 100644 index 00000000..1dffc40b --- /dev/null +++ b/SAP1EMU.GUI/Views/Home/Emulator.cshtml @@ -0,0 +1,143 @@ +<script src="/js/CodeMirror/lib/codemirror.js"></script> +<script src="/js/CodeMirror/mode/gas/gas_sap1.js" type="text/javascript"></script> +<link href="/js/CodeMirror/lib/codemirror.css" rel="stylesheet" type="text/css" /> + +<script src="/lib/jquery/dist/jquery.js" type="text/javascript"></script> +<script src="/js/Views/EmulatorView.js" type="text/javascript"></script> + +@{ + ViewData["Title"] = "Emulator"; +} + +<h1>Emulator</h1> + +<div class="card-deck"> + + <div class="card"> + <div class="card-header"> + <h4>Assembly</h4> + </div> + + <div class="card-body"> + <div class="form-row"> + <div class="col"> + @Html.TextArea("CodeList", null, new { rows = "20", cols = "80", @class = "codebox", id = "asm_code" }) + </div> + <div class="col-auto"> + @Html.TextArea("ram_dump", null, new { rows = "16", cols = "20", @class = "codebox", id = "ram_dump" }) + </div> + </div> + + <div class="form-row mt-4"> + <div class="form-group mx-2"> + <label for="langs">Instruction Set</label> + <select id="langs" class="form-control"></select> + </div> + <div class="form-group mx-2 d-flex align-items-center"> + <button id="loadFile" onclick="getFromFile()" class="btn btn-light mt-auto">Load from File</button> + </div> + <div class="form-group mx-2 d-flex align-items-center"> + <button id="loadRAM" class="btn btn-light mt-auto" onclick="LoadIntoRAM()">Load into RAM</button> + </div> + </div> + </div> + </div> + + + + <div class="card"> + <div class="card-header"> + <h4>SAP1</h4> + </div> + <div class="card-body"> + <div class="row mb-0"> + <div class="col-auto mr-0"> + <button class="btn" id="back-button" onclick="back_button_onclick()"><img src="~/img/skip_previous-24px.svg " /></button> + <button class="btn" id="play-pause-button" onclick="play_button_onclick()"><img id="play-pause-img" src="~/img/play_arrow-24px.svg" /></button> + <button class="btn" id="next-button" onclick="next_button_onclick()"><img src="~/img/skip_next-24px.svg" /></button> + <button class="btn" id="reset-button" onclick="reset_button_onclick()"><img src="~/img/replay-24px.svg" /></button> + </div> + <div class="col mt-2 ml-0"> + <div class="form-group row"> + <label for="formControlRange" class="col-auto"><img src="~/img/speed-24px.svg" /></label> + <input type="range" class="form-control-range col mb-1" id="formControlRange" style="padding: 0;" min="0" max="2" value="1" step=".125" oninput="changeIntervalTiming(value);"> + </div> + </div> + <div class="col-sm"> + <div class="input-group"> + <div class="input-group-prepend"> + <span class="input-group-text" id="instruction-box">???</span> + </div> + <input id="tstate-box" type="text" class="form-control input-disabled-correct-background tstate-width-correction" value="T1" aria-label="Zero Flag" aria-describedby="instruction-box" disabled> + </div> + </div> + </div> + <div class="row mt-0 mb-3"> + <div class="col"> + <div class="progress" style="height: 5px;"> + <div class="progress-bar" role="progressbar" id="frameProgressBar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div> + </div> + </div> + </div> + <div class="row"> + <div class="col pr-2"> + <div class="alert alert-secondary"><h6>Program Counter</h6><pre class="mb-0 pb-0" id="pc-block"></pre></div> + <div class="alert alert-secondary"><h6>MAR</h6><pre class="mb-0 pb-0" id="mar-block"></pre></div> + <div class="alert alert-secondary"><h6>RAM</h6><pre class="mb-0 pb-0" id="ram-block"></pre></div> + <div class="alert alert-secondary pr-0"><h6>Instruction Register</h6><pre class="mb-0 pb-0" id="ireg-block"></pre></div> + <div class="alert alert-secondary"><h6>Sequencer</h6><pre class="mb-0 pb-0" id="seq-block"></pre></div> + </div> + <div class="col-auto d-flex px-1"> + <div class="alert alert-secondary flex-fill"> + <h6>WBus</h6><pre id="wbus-block"></pre> + </div> + </div> + <div class="col pl-2"> + <div class="alert alert-secondary"><h6>A Register</h6><pre class="mb-0 pb-0" id="areg-block"> </pre></div> + <div class="alert alert-secondary"><h6>ALU</h6><pre class="mb-0 pb-0" id="alu-block"></pre></div> + <div class="alert alert-secondary"><h6>B Register</h6><pre class="mb-0 pb-0" id="breg-block"></pre></div> + <div class="alert alert-secondary"><h6>Output Register</h6><pre class="mb-0 pb-0" id="oreg-block"></pre></div> + <div class="alert alert-secondary"><h6>Display</h6><pre class="mb-0 pb-0" id="dis-block"></pre></div> + </div> + </div> + <div class="row"> + <div class="col"> + <div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text" id="carry-flag">Carry</span> + </div> + <input type="text" class="form-control input-disabled-correct-background" value="0" aria-label="Carry Flag" aria-describedby="carry-flag" id="carryFlagBox" disabled> + </div> + </div> + <div class="col"> + <div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text" id="underflow-flag">Underflow</span> + </div> + <input type="text" class="form-control input-disabled-correct-background" value="0" aria-label="Underflow Flag" aria-describedby="underflow-flag" id="underflowFlagBox" disabled> + </div> + </div> + <div class="col"> + <div class="input-group"> + <div class="input-group-prepend"> + <span class="input-group-text" id="zero-flag">Zero</span> + </div> + <input type="text" class="form-control input-disabled-correct-background" value="0" aria-label="Zero Flag" aria-describedby="zero-flag" disabled> + </div> + </div> + </div> + </div> + </div> +</div> + +<div class="card-deck mt-4"> + <div class="card"> + <div class="card-header"> + <h4>Emulator Errors</h4> + </div> + <div class="card-body"> + <code class="emulator-out" id="emulator-out"><br /></code> + </div> + </div> +</div> + diff --git a/SAP1EMU.WebApp/Views/Home/Index.cshtml b/SAP1EMU.GUI/Views/Home/Index.cshtml similarity index 53% rename from SAP1EMU.WebApp/Views/Home/Index.cshtml rename to SAP1EMU.GUI/Views/Home/Index.cshtml index 91f36f46..f1c9583e 100644 --- a/SAP1EMU.WebApp/Views/Home/Index.cshtml +++ b/SAP1EMU.GUI/Views/Home/Index.cshtml @@ -4,17 +4,18 @@ <div class="text-center"> <h1 class="display-4">Welcome to the SAP1Emu Project</h1> - @*<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>*@ + <br /> + <br /> - <img src="img/sap1-logo.png" width="650" /> + <img src="img/sap1-logo.png" width="450" /> <br /> <br /> <br /> <br /> <p>SAP1Emu Project - by Bob Baker</p> - <p>github.com/rbaker26</p> + <a class="text-dark" href="https://github.com/rbaker26/" target="_blank">github.com/rbaker26</a> - </div> + </div> \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Home/Privacy.cshtml b/SAP1EMU.GUI/Views/Home/Privacy.cshtml new file mode 100644 index 00000000..9f0ef1f1 --- /dev/null +++ b/SAP1EMU.GUI/Views/Home/Privacy.cshtml @@ -0,0 +1,13 @@ +@{ + ViewData["Title"] = "Privacy Policy"; +} +<h1>@ViewData["Title"]</h1> + +<p> + This site is still in beta. <br /> + We don't sell, give away, or transfer any user-data to anyone for any reason. + <br /> + <br /> + Any user-data will be used for internal site inprovements for the purposes of this beta. <br /> + This policy is subject to change in the future. +</p> diff --git a/SAP1EMU.WebApp/Views/Shared/Error.cshtml b/SAP1EMU.GUI/Views/Shared/Error.cshtml similarity index 100% rename from SAP1EMU.WebApp/Views/Shared/Error.cshtml rename to SAP1EMU.GUI/Views/Shared/Error.cshtml diff --git a/SAP1EMU.GUI/Views/Shared/_CookieConsentPartial.cshtml b/SAP1EMU.GUI/Views/Shared/_CookieConsentPartial.cshtml new file mode 100644 index 00000000..916924c0 --- /dev/null +++ b/SAP1EMU.GUI/Views/Shared/_CookieConsentPartial.cshtml @@ -0,0 +1,25 @@ +@using Microsoft.AspNetCore.Http.Features + +@{ + var consentFeature = Context.Features.Get<ITrackingConsentFeature>(); + var showBanner = !consentFeature?.CanTrack ?? false; + var cookieString = consentFeature?.CreateConsentCookie(); +} + +@if (showBanner) +{ + <div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert"> + We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. <br /> By clicking “Accept”, you consent to the use of ALL the cookies. <a asp-controller="Home" asp-action="Privacy">Learn More</a>. + <button type="button" class="accept-policy close mt-2" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString"> + <span aria-hidden="true">Accept</span> + </button> + </div> + <script> + (function () { + var button = document.querySelector("#cookieConsent button[data-cookie-string]"); + button.addEventListener("click", function (event) { + document.cookie = button.dataset.cookieString; + }, false); + })(); + </script> +} \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Shared/_Favicons.cshtml b/SAP1EMU.GUI/Views/Shared/_Favicons.cshtml new file mode 100644 index 00000000..3b1a4930 --- /dev/null +++ b/SAP1EMU.GUI/Views/Shared/_Favicons.cshtml @@ -0,0 +1,6 @@ +<link rel="apple-touch-icon" sizes="180x180" href="/lib/apple-touch-icon.png"> +<link rel="icon" type="image/png" href="/lib/favicon-32x32.png" sizes="32x32"> +<link rel="icon" type="image/png" href="/lib/favicon-16x16.png" sizes="16x16"> +@*<link rel="manifest" href="/manifest.json">*@ +<link rel="mask-icon" href="/lib/safari-pinned-tab.svg" color="#5bbad5"> +@*<meta name="theme-color" content="#00ffff">*@ \ No newline at end of file diff --git a/SAP1EMU.GUI/Views/Shared/_GitHubProfilePartial.cshtml b/SAP1EMU.GUI/Views/Shared/_GitHubProfilePartial.cshtml new file mode 100644 index 00000000..651f72fc --- /dev/null +++ b/SAP1EMU.GUI/Views/Shared/_GitHubProfilePartial.cshtml @@ -0,0 +1,28 @@ +@model GitHubProfileModel + + +<div class="card" style="width: 18rem;"> + @{ + if (@Model.login == "rbaker26") + { + <div class="card-header"> + Main Author + </div> + } + else + { + <div class="card-header"> + Contributor + </div> + } + } + + <img src="@Model.avatar_url" class="card-img-top rounded-circle p-3" alt="@Model.login profile picure"> + <div class="card-body"> + <h5 class="card-title mb-0">@Model.name</h5> + <p class="card-subtitle mt-0">@Model.login</p> + <p class="card-text">@Model.bio</p> + <a href="@Model.html_url" class="btn btn-primary" target="_blank">Follow</a> + + </div> +</div> \ No newline at end of file diff --git a/SAP1EMU.WebApp/Views/Shared/_Layout.cshtml b/SAP1EMU.GUI/Views/Shared/_Layout.cshtml similarity index 73% rename from SAP1EMU.WebApp/Views/Shared/_Layout.cshtml rename to SAP1EMU.GUI/Views/Shared/_Layout.cshtml index a99531c6..a585003c 100644 --- a/SAP1EMU.WebApp/Views/Shared/_Layout.cshtml +++ b/SAP1EMU.GUI/Views/Shared/_Layout.cshtml @@ -1,6 +1,17 @@ <!DOCTYPE html> <html lang="en"> <head> + <!-- Global site tag (gtag.js) - Google Analytics --> + <script async src="https://www.googletagmanager.com/gtag/js?id=UA-177411441-1"></script> + <script> + window.dataLayer = window.dataLayer || []; + function gtag() { dataLayer.push(arguments); } + gtag('js', new Date()); + + gtag('config', 'UA-177411441-1'); + </script> + <!-- Google Analytics - END--> + <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>@ViewData["Title"] - SAP1Emu Project</title> @@ -9,6 +20,7 @@ <script src="/js/Views/_LayoutView.js" type="text/javascript"></script> + @await Html.PartialAsync("_Favicons") </head> <body> <header> @@ -34,7 +46,10 @@ <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Assembler">Assembler</a> </li> <li class="nav-item"> - <a class="nav-link text-dark" onclick="openWiki()" >Wiki</a> + <a class="nav-link text-dark" href="https://github.com/rbaker26/SAP1EMU/wiki" target="_blank">Wiki</a> + </li> + <li> + <a class="nav-link text-dark" asp-area="" asp-controller="Docs" asp-action="Docs">Docs</a> </li> </ul> </div> @@ -42,6 +57,7 @@ </nav> </header> <div class="container"> + <partial name="_CookieConsentPartial" /> <main role="main" class="pb-3"> @RenderBody() </main> @@ -49,7 +65,7 @@ <footer class="border-top footer text-muted"> <div class="container"> - © 2020 - SAP1EMU.WebApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a> + © 2020 - SAP1EMU.WebApp @typeof(SAP1EMU.GUI.Program).Assembly.GetName().Version - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a> </div> </footer> <script src="~/lib/jquery/dist/jquery.min.js"></script> diff --git a/SAP1EMU.WebApp/Views/Shared/_ValidationScriptsPartial.cshtml b/SAP1EMU.GUI/Views/Shared/_ValidationScriptsPartial.cshtml similarity index 100% rename from SAP1EMU.WebApp/Views/Shared/_ValidationScriptsPartial.cshtml rename to SAP1EMU.GUI/Views/Shared/_ValidationScriptsPartial.cshtml diff --git a/SAP1EMU.GUI/Views/_ViewImports.cshtml b/SAP1EMU.GUI/Views/_ViewImports.cshtml new file mode 100644 index 00000000..8c529219 --- /dev/null +++ b/SAP1EMU.GUI/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using SAP1EMU.GUI +@using SAP1EMU.GUI.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/SAP1EMU.WebApp/Views/_ViewStart.cshtml b/SAP1EMU.GUI/Views/_ViewStart.cshtml similarity index 100% rename from SAP1EMU.WebApp/Views/_ViewStart.cshtml rename to SAP1EMU.GUI/Views/_ViewStart.cshtml diff --git a/SAP1EMU.GUI/appsettings.json b/SAP1EMU.GUI/appsettings.json new file mode 100644 index 00000000..34be7b9b --- /dev/null +++ b/SAP1EMU.GUI/appsettings.json @@ -0,0 +1,11 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "ConnectionStrings": { + "DefaultConnection": "", + "sap1emu_db_conn_string": "Server=localhost;Database=master;Trusted_Connection=True;" + } +} \ No newline at end of file diff --git a/SAP1EMU.GUI/docuFile.json b/SAP1EMU.GUI/docuFile.json new file mode 100644 index 00000000..d177980a --- /dev/null +++ b/SAP1EMU.GUI/docuFile.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/SAP1EMU.GUI/wwwroot/css/site.css b/SAP1EMU.GUI/wwwroot/css/site.css new file mode 100644 index 00000000..a19a4a16 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/css/site.css @@ -0,0 +1,173 @@ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +for details on configuring this project to bundle and minify static web assets. */ + +a.navbar-brand { + white-space: normal; + text-align: center; + word-break: break-all; +} + +/* Provide sufficient contrast against white background */ +a { + color: #0366d6; +} + +.btn-primary { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.nav-pills .nav-link.active, .nav-pills .show > .nav-link { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + font-size: 14px; +} + +@media (min-width: 768px) { + html { + font-size: 16px; + } +} + +.border-top { + border-top: 1px solid #e5e5e5; +} + +.border-bottom { + border-bottom: 1px solid #e5e5e5; +} + +.box-shadow { + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); +} + +button.accept-policy { + font-size: 1rem; + line-height: inherit; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + position: relative; + min-height: 100%; +} + +body { + /* Margin bottom by footer height */ + margin-bottom: 60px; +} + +.footer { + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + line-height: 60px; /* Vertically center the text there */ +} + +/* For Columns in Pages*/ +.column3 { + float: left; + width: 32%; + border: 1px solid #a39898; + padding: 8px; + margin: 5px; +} + +.column2 { + float: left; + width: 49%; + border: 1px solid #a39898; + padding: 8px; + margin: 5px; +} + +.column1 { + float: left; + width: 99%; + border: 1px solid #a39898; + padding: 8px; + margin: 5px; +} + +/* Clear floats after the columns */ +.row:after { + margin: auto; + width: 100%; + content: ""; + display: table; + clear: both; + align-content: center; + align-items: center; +} + +.assembler-out { +} + +.vbox_sap { + display: flex; + flex-direction: column; +} + +.hbox_sap { + display: flex; + flex-direction: row; +} + + .hbox_sap > * { + margin: 5px; + } + +.profile-pic { + max-width: 50%; +} + +.sap1-grid { + display: grid; + grid-template-columns: 35% 30% 35%; + grid-template-rows: 20% 20% 20% 20% 20%; +} + + .sap1-grid > div { + /* border: 2px solid black; + + background-color: grey; + margin: 2px; + justify-self: stretch; + min-height: 48px;*/ + max-height: 70px; + } + +.sap1-grid-span { + justify-content: center; + /* grid-column-start: 2; + grid-column-end: 2; + grid-row-start: 1; + grid-row-end: span 5; + + justify-self: stretch; + text-align: center; + max-height: none;*/ +} + +.flags-box { + /* border: 2px solid black; + background-color: grey; + margin: 2px;*/ +} + +.input-disabled-correct-background:disabled { + background: white; +} + +.tstate-width-correction { + max-width: 70px; +} \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/api.svg b/SAP1EMU.GUI/wwwroot/img/Docs/api.svg new file mode 100644 index 00000000..908edf5f --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/api.svg @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> + <g> + <path d="M127.059657,255.996921 C58.8506544,255.526472 -0.457073619,198.918442 0.00265506057,126.998303 C0.444649399,57.7958628 57.9516598,-0.468967577 129.11002,0.00284555012 C198.267128,0.462386081 256.613109,57.8667711 255.995136,128.194199 C256.568091,197.883453 197.934268,256.489189 127.059657,255.996921 Z M127.059657,255.996921 C58.8506544,255.526472 -0.457073619,198.918442 0.00265506057,126.998303 C0.444649399,57.7958628 57.9516598,-0.468967577 129.11002,0.00284555012 C198.267128,0.462386081 256.613109,57.8667711 255.995136,128.194199 C256.568091,197.883453 197.934268,256.489189 127.059657,255.996921 Z" fill="#FFFFFF"></path> + <path d="M127.184644,238.997327 C68.0323765,238.589271 16.6036091,189.498744 17.0023028,127.131428 C17.3860285,67.1185953 67.2554,16.5917106 128.963117,17.0024872 C188.934544,17.4010221 239.531905,67.1825241 238.995778,128.169251 C239.492444,188.602381 188.64743,239.424426 127.184644,238.997327 Z M127.184644,238.997327 C68.0323765,238.589271 16.6036091,189.498744 17.0023028,127.131428 C17.3860285,67.1185953 67.2554,16.5917106 128.963117,17.0024872 C188.934544,17.4010221 239.531905,67.1825241 238.995778,128.169251 C239.492444,188.602381 188.64743,239.424426 127.184644,238.997327 Z" fill="#49A32B"></path> + <path d="M169.327319,127.956161 C169.042723,133.246373 164.421106,137.639224 159.866213,136.872586 C159.844426,136.872586 159.821277,136.872586 159.798128,136.872586 C154.753021,136.879395 150.658383,132.794288 150.652936,127.749182 C150.824511,122.690458 155.019915,118.703395 160.08,118.789182 C165.125106,118.813692 169.59966,123.077182 169.327319,127.956161 Z M88.2011915,179.220161 C90.1034894,179.27599 92.0071489,179.235139 94.2008511,179.235139 L94.2008511,193.021012 C80.5661277,195.326373 69.3348085,191.455054 66.5787234,179.929607 C65.6350638,175.69199 65.0549787,171.380841 64.8425532,167.04382 C64.5497872,162.452161 65.0563404,157.808756 64.706383,153.225267 C63.7368511,140.613182 62.1028085,136.30748 50,135.711054 L50,120.014714 C50.8674043,119.81182 51.7470638,119.662033 52.6321702,119.562629 C59.2677447,119.23582 62.0646809,117.201437 63.5489362,110.665267 C64.2243404,106.992756 64.6246809,103.275309 64.7431489,99.5428839 C65.268766,92.3258627 65.0822128,84.991735 66.2845957,77.8918201 C68.0221277,67.6245861 74.3962553,62.6366712 84.9249362,62.0783733 C87.9206809,61.9176925 90.9259574,62.0538627 94.3206809,62.0538627 L94.3206809,76.1447563 C92.9235745,76.2441605 91.6435745,76.4470542 90.3717447,76.4089265 C81.7916596,76.146118 81.3477447,79.0683308 80.7213617,86.1709691 C80.3305532,90.6250967 80.8697872,95.1554797 80.5661277,99.6245861 C80.2488511,104.071905 79.6537872,108.496075 78.7850213,112.869863 C77.547234,119.208586 73.6500426,123.922799 68.2495319,127.92348 C78.7332766,134.745607 79.9261277,145.346458 80.6069787,156.110714 C80.9732766,161.895224 80.8057872,167.720586 81.3926809,173.476501 C81.8502128,177.944246 83.5877447,179.08399 88.2011915,179.220161 Z M97.0372766,118.789182 C97.0917447,118.789182 97.1448511,118.789182 97.1993191,118.789182 C102.211745,118.872246 106.209702,123.002288 106.126638,128.016075 C106.126638,128.180841 106.121191,128.344246 106.11166,128.50765 C105.829787,133.407054 101.630298,137.149012 96.7308936,136.867139 C96.5334468,136.871224 96.3373617,136.867139 96.1399149,136.857607 C91.1506383,136.609778 87.3065532,132.36399 87.554383,127.374714 C87.8022128,122.385437 92.048,118.541352 97.0372766,118.789182 Z M128.273362,118.789182 C133.755574,118.746969 137.396766,122.29965 137.425362,127.719224 C137.455319,133.284501 134.003404,136.845352 128.556596,136.868501 C123.017191,136.893012 119.370553,133.389352 119.340596,128.002458 C119.324255,127.727395 119.32017,127.452331 119.32834,127.177267 C119.482213,122.390884 123.486979,118.635309 128.273362,118.789182 Z M193.673191,111.92348 C195.131574,117.370288 197.970723,119.284841 203.704851,119.546288 C204.644426,119.589863 205.579915,119.749182 206.868085,119.892161 L206.868085,135.584416 C206.170894,135.813182 205.456,135.984756 204.730213,136.096416 C197.046128,136.574373 193.54383,139.726714 192.76766,147.431224 C192.272,152.349692 192.312851,157.322629 191.972426,162.258799 C191.829447,167.678373 191.336511,173.082969 190.49634,178.438544 C188.535489,188.142033 182.477277,192.982884 172.467404,193.573863 C169.245617,193.764501 166.000681,193.60382 162.526979,193.60382 L162.526979,179.578288 C164.396596,179.462544 166.046979,179.303224 167.701447,179.263735 C173.682043,179.120756 175.796766,177.192586 176.089532,171.252841 C176.413617,164.727565 176.555234,158.194118 176.846638,151.66748 C177.270128,142.233607 179.853277,133.806033 188.641702,127.922118 C183.612936,124.336756 179.575489,119.994288 178.529702,114.138969 C177.264681,107.041778 176.85617,99.7879903 176.175319,92.5913946 C175.838979,88.9937776 175.855319,85.3648414 175.504,81.7699478 C175.125447,77.8890967 172.459234,76.5464584 168.926979,76.4593095 C166.903489,76.4102882 164.87183,76.4497776 162.284596,76.4497776 L162.284596,62.7537776 C178.793872,60.0126712 190.198128,65.5057776 191.257532,81.3015222 C191.701447,87.9343733 191.636085,94.5985435 192.060936,101.231395 C192.247489,104.839905 192.786723,108.421182 193.673191,111.92348 Z" fill="#FFFFFF"></path> + </g> +</svg> diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/asm.svg b/SAP1EMU.GUI/wwwroot/img/Docs/asm.svg new file mode 100644 index 00000000..ab81fe4c --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/asm.svg @@ -0,0 +1,32 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" + "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<svg version="1.0" xmlns="http://www.w3.org/2000/svg" + width="600.000000pt" height="600.000000pt" viewBox="0 0 600.000000 600.000000" + preserveAspectRatio="xMidYMid meet"> + +<g transform="translate(0.000000,600.000000) scale(0.100000,-0.100000)" +fill="#000000" stroke="none"> +<path d="M1713 5093 c-22 -38 -304 -524 -627 -1080 l-587 -1013 625 -1077 625 +-1078 1253 -3 1253 -2 628 1081 627 1082 -624 1076 -624 1076 -1255 3 -1255 2 +-39 -67z m1422 -1318 c33 -8 92 -31 130 -49 67 -33 155 -99 155 -115 0 -9 +-119 -161 -126 -161 -2 0 -28 16 -57 35 -143 95 -368 113 -458 38 -81 -68 -79 +-174 4 -237 18 -14 87 -48 153 -75 326 -135 374 -161 444 -237 69 -75 85 -121 +85 -249 0 -101 -2 -115 -29 -170 -107 -217 -417 -319 -716 -235 -91 26 -230 +97 -289 148 l-44 38 73 84 c40 47 74 87 76 89 2 2 25 -12 51 -32 117 -85 225 +-122 358 -122 88 0 107 3 157 27 71 33 98 72 98 143 0 58 -22 101 -72 138 -18 +14 -129 67 -247 118 -238 103 -312 150 -365 231 -167 252 8 559 349 612 54 8 +208 -3 270 -19z m-1058 -725 c128 -393 233 -718 233 -722 0 -5 -62 -8 -138 -8 +l-138 0 -55 195 -54 195 -241 0 -241 0 -55 -192 -55 -193 -136 -3 -135 -3 72 +223 c40 123 146 449 236 726 l164 502 155 -2 155 -3 233 -715z m1940 445 c46 +-148 97 -323 115 -388 18 -68 35 -113 39 -105 4 7 17 49 29 93 12 44 62 214 +113 378 l91 297 143 0 143 0 0 -213 c0 -118 3 -444 7 -725 l6 -512 -123 0 +-122 0 5 418 c3 233 12 490 21 582 8 91 13 166 12 168 -2 1 -24 -71 -49 -160 +-42 -146 -108 -346 -184 -556 l-26 -73 -75 3 -76 3 -77 225 c-42 124 -97 295 +-120 380 -24 85 -45 147 -47 138 -2 -10 2 -73 8 -140 7 -68 14 -318 17 -555 +l5 -433 -116 0 -116 0 0 725 0 726 147 -3 147 -3 83 -270z"/> +<path d="M1671 3530 c-6 -25 -38 -144 -71 -265 -32 -121 -68 -248 -78 -282 +l-20 -63 179 0 c98 0 179 3 179 6 0 3 -38 141 -84 307 -46 166 -86 311 -88 +322 -3 14 -8 7 -17 -25z"/> +</g> +</svg> diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/cli.svg b/SAP1EMU.GUI/wwwroot/img/Docs/cli.svg new file mode 100644 index 00000000..3ba4b611 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/cli.svg @@ -0,0 +1,3 @@ +<svg height="1024" width="896" xmlns="http://www.w3.org/2000/svg"> + <path d="M831 127H63c-35.35 0-64 28.65-64 64v640c0 35.35 28.65 64 64 64h768c35.35 0 64-28.65 64-64V191C895 155.64999999999998 866.35 127 831 127zM127 575l128-128L127 319l64-64 192 192L191 639 127 575zM639 639H383v-64h256V639z" /> +</svg> diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/code.svg b/SAP1EMU.GUI/wwwroot/img/Docs/code.svg new file mode 100644 index 00000000..9e4a639c --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/code.svg @@ -0,0 +1 @@ +<svg height="512pt" viewBox="0 -31 512 511" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m256 448.714844h256v-320.644532l-276.015625-20.015624zm0 0" fill="#03232e"/><path d="m0 128.070312v320.644532h256v-340.660156zm0 0" fill="#07485e"/><path d="m256 .5-20.015625 63.785156 20.015625 63.785156h256v-127.570312zm0 0" fill="#b4d2d7"/><path d="m0 .5h256v127.570312h-256zm0 0" fill="#e1ebf0"/><path d="m47.839844 49.285156h31.890625v30h-31.890625zm0 0" fill="#ff4a4a"/><path d="m111.625 49.285156h31.894531v30h-31.894531zm0 0" fill="#ffd422"/><path d="m175.410156 49.285156h31.894532v30h-31.894532zm0 0" fill="#00cc76"/><path d="m184.121094 383.054688-74.484375-94.660157 74.484375-94.664062 23.578125 18.550781-59.886719 76.113281 59.886719 76.105469zm0 0" fill="#fff5f5"/><path d="m327.878906 383.054688-23.578125-18.554688 59.886719-76.105469-59.886719-76.113281 23.578125-18.550781 74.484375 94.664062zm0 0" fill="#efe2dd"/><path d="m241 192.734375h30v191.316406h-30zm0 0" fill="#fff5f5"/></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/cpp.svg b/SAP1EMU.GUI/wwwroot/img/Docs/cpp.svg new file mode 100644 index 00000000..5e117077 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/cpp.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + width="306px" height="344.35px" viewBox="0 0 306 344.35" enable-background="new 0 0 306 344.35" xml:space="preserve"> +<path fill="#00599C" d="M302.107,258.262c2.401-4.159,3.893-8.845,3.893-13.053V99.14c0-4.208-1.49-8.893-3.892-13.052L153,172.175 + L302.107,258.262z"/> +<path fill="#004482" d="M166.25,341.193l126.5-73.034c3.644-2.104,6.956-5.737,9.357-9.897L153,172.175L3.893,258.263 + c2.401,4.159,5.714,7.793,9.357,9.896l126.5,73.034C147.037,345.401,158.963,345.401,166.25,341.193z"/> +<path fill="#659AD2" d="M302.108,86.087c-2.402-4.16-5.715-7.793-9.358-9.897L166.25,3.156c-7.287-4.208-19.213-4.208-26.5,0 + L13.25,76.19C5.962,80.397,0,90.725,0,99.14v146.069c0,4.208,1.491,8.894,3.893,13.053L153,172.175L302.108,86.087z"/> +<g> + <path fill="#FFFFFF" d="M153,274.175c-56.243,0-102-45.757-102-102s45.757-102,102-102c36.292,0,70.139,19.53,88.331,50.968 + l-44.143,25.544c-9.105-15.736-26.038-25.512-44.188-25.512c-28.122,0-51,22.878-51,51c0,28.121,22.878,51,51,51 + c18.152,0,35.085-9.776,44.191-25.515l44.143,25.543C223.142,254.644,189.294,274.175,153,274.175z"/> +</g> +<g> + <polygon fill="#FFFFFF" points="255,166.508 243.666,166.508 243.666,155.175 232.334,155.175 232.334,166.508 221,166.508 + 221,177.841 232.334,177.841 232.334,189.175 243.666,189.175 243.666,177.841 255,177.841 "/> +</g> +<g> + <polygon fill="#FFFFFF" points="297.5,166.508 286.166,166.508 286.166,155.175 274.834,155.175 274.834,166.508 263.5,166.508 + 263.5,177.841 274.834,177.841 274.834,189.175 286.166,189.175 286.166,177.841 297.5,177.841 "/> +</g> +</svg> diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/cpu.svg b/SAP1EMU.GUI/wwwroot/img/Docs/cpu.svg new file mode 100644 index 00000000..0e9c2c81 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/cpu.svg @@ -0,0 +1 @@ +<svg height="512pt" viewBox="0 0 512 512.00002" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m90.878906 0h30v75.855469h-30zm0 0" fill="#ffd422"/><path d="m150.929688 0h30v75.855469h-30zm0 0" fill="#ffd422"/><path d="m210.976562 0h30v75.855469h-30zm0 0" fill="#ffd422"/><path d="m271.023438 0h30v75.855469h-30zm0 0" fill="#ff9f22"/><path d="m331.070312 0h30v75.855469h-30zm0 0" fill="#ff9f22"/><path d="m391.121094 0h30v75.855469h-30zm0 0" fill="#ff9f22"/><path d="m90.878906 436.144531h30v75.855469h-30zm0 0" fill="#ffd422"/><path d="m150.929688 436.144531h30v75.855469h-30zm0 0" fill="#ffd422"/><path d="m210.976562 436.144531h30v75.855469h-30zm0 0" fill="#ffd422"/><g fill="#ff9f22"><path d="m271.023438 436.144531h30v75.855469h-30zm0 0"/><path d="m331.070312 436.144531h30v75.855469h-30zm0 0"/><path d="m391.121094 436.144531h30v75.855469h-30zm0 0"/><path d="m436.144531 90.878906h75.855469v30h-75.855469zm0 0"/><path d="m436.144531 150.929688h75.855469v30h-75.855469zm0 0"/><path d="m436.144531 210.976562h75.855469v30h-75.855469zm0 0"/><path d="m436.144531 271.023438h75.855469v30h-75.855469zm0 0"/><path d="m436.144531 331.070312h75.855469v30h-75.855469zm0 0"/><path d="m436.144531 391.121094h75.855469v30h-75.855469zm0 0"/></g><path d="m0 90.878906h75.855469v30h-75.855469zm0 0" fill="#ffd422"/><path d="m0 150.929688h75.855469v30h-75.855469zm0 0" fill="#ffd422"/><path d="m0 210.976562h75.855469v30h-75.855469zm0 0" fill="#ffd422"/><path d="m0 271.023438h75.855469v30h-75.855469zm0 0" fill="#ffd422"/><path d="m0 331.070312h75.855469v30h-75.855469zm0 0" fill="#ffd422"/><path d="m0 391.121094h75.855469v30h-75.855469zm0 0" fill="#ffd422"/><path d="m457 55h-201l-20.015625 201 20.015625 201h201zm0 0" fill="#00884f"/><path d="m55 55h201v402h-201zm0 0" fill="#00cc76"/><path d="m335.644531 176.355469h-79.644531l-20.015625 78.785156 20.015625 80.503906h79.644531zm0 0" fill="#b4d2d7"/><path d="m176.355469 176.355469h79.644531v159.289062h-79.644531zm0 0" fill="#e1ebf0"/></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/learn.svg b/SAP1EMU.GUI/wwwroot/img/Docs/learn.svg new file mode 100644 index 00000000..22ad259c --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/learn.svg @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="512" height="512"> +<g> + <rect x="451" y="200.688" style="fill:#FDBF00;" width="30" height="142.207"/> + <path style="fill:#FDBF00;" d="M466,454.105l-47-48.252l47-96.504l46,96.504L466,454.105z"/> + <polygon style="fill:#0095FF;" points="512,192.895 256,327.895 0,192.895 256,57.895 "/> + <polygon style="fill:#006EFF;" points="512,192.895 256,327.895 256,57.895 "/> + <path style="fill:#4BB9EC;" d="M382.599,207.594C343.001,188.094,299.5,178.195,256,178.195s-87.001,9.899-126.599,29.399 l-8.401,4.2v146.1h270v-146.1L382.599,207.594z"/> + <path style="fill:#0095FF;" d="M391,211.795v146.1H256v-179.7c43.5,0,87.001,9.899,126.599,29.399L391,211.795z"/> +</g> + + + + + + + + + + + + + + + +</svg> diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/modern-computer.svg b/SAP1EMU.GUI/wwwroot/img/Docs/modern-computer.svg new file mode 100644 index 00000000..5f198823 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/modern-computer.svg @@ -0,0 +1 @@ +<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><g><g><path d="m31 137h450v60h-450z" fill="#384949"/></g></g><path d="m256 137h225v60h-225z" fill="#293939"/><g><g><path d="m31 317h450v60h-450z" fill="#384949"/></g></g><path d="m256 317h225v60h-225z" fill="#293939"/><g><path d="m0 0v152h512v-152z" fill="#4a696f"/></g><path d="m256 0h256v152h-256z" fill="#384949"/><g><g><g><path d="m61 62h30v30h-30z" fill="#9bfcff"/></g></g></g><g><g><path d="m121 62h30v30h-30z" fill="#9bfcff"/></g></g><g><g><g><path d="m181 62h30v30h-30z" fill="#9bfcff"/></g></g></g><g><g><path d="m301 62h150v30h-150z" fill="#293939"/></g></g><g><path d="m0 182v150h512v-150z" fill="#4a696f"/></g><path d="m256 182h256v150h-256z" fill="#384949"/><g><g><g><path d="m61 242h30v30h-30z" fill="#9bfcff"/></g></g></g><g><g><path d="m121 242h30v30h-30z" fill="#9bfcff"/></g></g><g><g><g><path d="m181 242h30v30h-30z" fill="#9bfcff"/></g></g></g><g><g><path d="m301 242h150v30h-150z" fill="#293939"/></g></g><g><path d="m0 362v150h512v-150z" fill="#4a696f"/></g><path d="m256 362h256v150h-256z" fill="#384949"/><g><g><g><path d="m61 422h30v30h-30z" fill="#9bfcff"/></g></g></g><g><g><g><path d="m121 422h30v30h-30z" fill="#9bfcff"/></g></g></g><g><g><g><path d="m181 422h30v30h-30z" fill="#9bfcff"/></g></g></g><g><path d="m301 422h150v30h-150z" fill="#293939"/></g></g></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/Docs/netcore.svg b/SAP1EMU.GUI/wwwroot/img/Docs/netcore.svg new file mode 100644 index 00000000..43a66f8c --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/Docs/netcore.svg @@ -0,0 +1 @@ +<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><defs><style>.cls-1{fill:#5c2d91;}.cls-2,.cls-3{fill:#fff;}.cls-2{opacity:0.1;}.cls-4{fill:#f2f2f2;}</style></defs><title>logo_NETcore</title><circle class="cls-1" cx="32" cy="32" r="32"/><path class="cls-2" d="M9.82,9A32,32,0,1,0,55,54.18Z"/><path class="cls-3" d="M7.4,37.25a1.35,1.35,0,0,1-1-.42,1.38,1.38,0,0,1-.41-1,1.4,1.4,0,0,1,.41-1,1.34,1.34,0,0,1,1-.43,1.37,1.37,0,0,1,1,.43,1.39,1.39,0,0,1,.42,1,1.37,1.37,0,0,1-.42,1A1.38,1.38,0,0,1,7.4,37.25Z"/><path class="cls-3" d="M27.27,37H24.65L15.28,22.46a6,6,0,0,1-.58-1.14h-.08a18.72,18.72,0,0,1,.1,2.5V37H12.59V18.77h2.77l9.12,14.28q.57.89.74,1.22h.05a19.28,19.28,0,0,1-.13-2.68V18.77h2.13Z"/><path class="cls-3" d="M41.69,37H32V18.77h9.24V20.7H34.18v6.06h6.58v1.92H34.18V35h7.52Z"/><path class="cls-3" d="M56,20.7H50.7V37H48.57V20.7H43.33V18.77H56Z"/><path class="cls-4" d="M26.12,49.4a4.93,4.93,0,0,1-2.32.49,3.74,3.74,0,0,1-2.87-1.15,4.26,4.26,0,0,1-1.08-3,4.46,4.46,0,0,1,1.21-3.26,4.12,4.12,0,0,1,3.08-1.24,4.93,4.93,0,0,1,2,.35v1a4,4,0,0,0-2-.5,3.06,3.06,0,0,0-2.35,1,3.64,3.64,0,0,0-.9,2.58,3.47,3.47,0,0,0,.84,2.45,2.86,2.86,0,0,0,2.21.91,4.14,4.14,0,0,0,2.19-.56Z"/><path class="cls-4" d="M30.21,49.89A2.78,2.78,0,0,1,28.08,49a3.11,3.11,0,0,1-.79-2.23,3.24,3.24,0,0,1,.83-2.36,3,3,0,0,1,2.23-.85,2.69,2.69,0,0,1,2.09.83,3.28,3.28,0,0,1,.75,2.29,3.22,3.22,0,0,1-.81,2.3A2.84,2.84,0,0,1,30.21,49.89Zm.07-5.47a1.83,1.83,0,0,0-1.46.63,2.59,2.59,0,0,0-.54,1.74,2.45,2.45,0,0,0,.54,1.68,1.85,1.85,0,0,0,1.46.62,1.76,1.76,0,0,0,1.43-.6,2.62,2.62,0,0,0,.5-1.72,2.66,2.66,0,0,0-.5-1.73A1.75,1.75,0,0,0,30.28,44.42Z"/><path class="cls-4" d="M37.86,44.72a1.18,1.18,0,0,0-.73-.19,1.23,1.23,0,0,0-1,.58,2.68,2.68,0,0,0-.41,1.58v3.06h-1v-6h1V45h0a2.1,2.1,0,0,1,.63-1,1.43,1.43,0,0,1,.94-.35,1.57,1.57,0,0,1,.57.08Z"/><path class="cls-4" d="M43.72,47H39.49A2.24,2.24,0,0,0,40,48.54a1.86,1.86,0,0,0,1.42.54,3,3,0,0,0,1.86-.67v.9a3.48,3.48,0,0,1-2.09.57,2.54,2.54,0,0,1-2-.82,3.35,3.35,0,0,1-.73-2.3,3.28,3.28,0,0,1,.79-2.28,2.55,2.55,0,0,1,2-.88,2.26,2.26,0,0,1,1.82.76,3.18,3.18,0,0,1,.64,2.12Zm-1-.81a2,2,0,0,0-.4-1.29,1.37,1.37,0,0,0-1.1-.46,1.55,1.55,0,0,0-1.15.49,2.21,2.21,0,0,0-.59,1.27Z"/></svg> \ No newline at end of file diff --git a/SAP1EMU.WebApp/wwwroot/img/github-profile.png b/SAP1EMU.GUI/wwwroot/img/github-profile.png similarity index 100% rename from SAP1EMU.WebApp/wwwroot/img/github-profile.png rename to SAP1EMU.GUI/wwwroot/img/github-profile.png diff --git a/SAP1EMU.GUI/wwwroot/img/pause-24px.svg b/SAP1EMU.GUI/wwwroot/img/pause-24px.svg new file mode 100644 index 00000000..63a1c461 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/pause-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/play_arrow-24px.svg b/SAP1EMU.GUI/wwwroot/img/play_arrow-24px.svg new file mode 100644 index 00000000..fe2e5786 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/play_arrow-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M8 5v14l11-7z"/></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/replay-24px.svg b/SAP1EMU.GUI/wwwroot/img/replay-24px.svg new file mode 100644 index 00000000..a923269c --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/replay-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/sap1-logo.png b/SAP1EMU.GUI/wwwroot/img/sap1-logo.png new file mode 100644 index 00000000..f4c341ac Binary files /dev/null and b/SAP1EMU.GUI/wwwroot/img/sap1-logo.png differ diff --git a/SAP1EMU.GUI/wwwroot/img/skip_next-24px.svg b/SAP1EMU.GUI/wwwroot/img/skip_next-24px.svg new file mode 100644 index 00000000..25b78bb8 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/skip_next-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/skip_previous-24px.svg b/SAP1EMU.GUI/wwwroot/img/skip_previous-24px.svg new file mode 100644 index 00000000..fe2bd534 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/skip_previous-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 6h2v12H6zm3.5 6l8.5 6V6z"/></svg> \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/img/speed-24px.svg b/SAP1EMU.GUI/wwwroot/img/speed-24px.svg new file mode 100644 index 00000000..ac9e2c2d --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/img/speed-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M20.38 8.57l-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/></svg> \ No newline at end of file diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/LICENSE b/SAP1EMU.GUI/wwwroot/js/CodeMirror/LICENSE similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/LICENSE rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/LICENSE diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/lib/codemirror.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/lib/codemirror.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/lib/codemirror.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/lib/codemirror.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/lib/codemirror.js b/SAP1EMU.GUI/wwwroot/js/CodeMirror/lib/codemirror.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/lib/codemirror.js rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/lib/codemirror.js diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/mode/clike/clike.js b/SAP1EMU.GUI/wwwroot/js/CodeMirror/mode/clike/clike.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/mode/clike/clike.js rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/mode/clike/clike.js diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/mode/gas/gas_sap1.js b/SAP1EMU.GUI/wwwroot/js/CodeMirror/mode/gas/gas_sap1.js similarity index 99% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/mode/gas/gas_sap1.js rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/mode/gas/gas_sap1.js index e339339a..af6762c4 100644 --- a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/mode/gas/gas_sap1.js +++ b/SAP1EMU.GUI/wwwroot/js/CodeMirror/mode/gas/gas_sap1.js @@ -45,6 +45,7 @@ registers.add = "variable-3"; registers.sub = "variable-3"; registers.sta = "variable-3"; + registers.ldi = "variable-3"; // The Value Regerenced Instructions registers.jmp = "keyword"; diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/mode/meta.js b/SAP1EMU.GUI/wwwroot/js/CodeMirror/mode/meta.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/mode/meta.js rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/mode/meta.js diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/3024-day.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/3024-day.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/3024-day.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/3024-day.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/3024-night.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/3024-night.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/3024-night.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/3024-night.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/abcdef.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/abcdef.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/abcdef.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/abcdef.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ambiance-mobile.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ambiance-mobile.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ambiance-mobile.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ambiance-mobile.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ambiance.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ambiance.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ambiance.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ambiance.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ayu-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ayu-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ayu-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ayu-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ayu-mirage.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ayu-mirage.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ayu-mirage.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ayu-mirage.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/base16-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/base16-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/base16-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/base16-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/base16-light.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/base16-light.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/base16-light.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/base16-light.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/bespin.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/bespin.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/bespin.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/bespin.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/blackboard.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/blackboard.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/blackboard.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/blackboard.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/cobalt.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/cobalt.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/cobalt.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/cobalt.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/colorforth.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/colorforth.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/colorforth.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/colorforth.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/darcula.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/darcula.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/darcula.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/darcula.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/dracula.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/dracula.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/dracula.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/dracula.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/duotone-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/duotone-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/duotone-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/duotone-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/duotone-light.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/duotone-light.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/duotone-light.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/duotone-light.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/eclipse.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/eclipse.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/eclipse.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/eclipse.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/elegant.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/elegant.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/elegant.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/elegant.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/erlang-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/erlang-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/erlang-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/erlang-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/gruvbox-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/gruvbox-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/gruvbox-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/gruvbox-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/hopscotch.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/hopscotch.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/hopscotch.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/hopscotch.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/icecoder.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/icecoder.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/icecoder.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/icecoder.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/idea.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/idea.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/idea.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/idea.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/isotope.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/isotope.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/isotope.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/isotope.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/lesser-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/lesser-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/lesser-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/lesser-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/liquibyte.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/liquibyte.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/liquibyte.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/liquibyte.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/lucario.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/lucario.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/lucario.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/lucario.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material-darker.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material-darker.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material-darker.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material-darker.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material-ocean.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material-ocean.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material-ocean.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material-ocean.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material-palenight.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material-palenight.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material-palenight.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material-palenight.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/material.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/material.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/mbo.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/mbo.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/mbo.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/mbo.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/mdn-like.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/mdn-like.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/mdn-like.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/mdn-like.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/midnight.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/midnight.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/midnight.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/midnight.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/monokai.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/monokai.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/monokai.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/monokai.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/moxer.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/moxer.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/moxer.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/moxer.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/neat.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/neat.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/neat.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/neat.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/neo.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/neo.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/neo.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/neo.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/night.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/night.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/night.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/night.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/nord.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/nord.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/nord.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/nord.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/oceanic-next.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/oceanic-next.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/oceanic-next.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/oceanic-next.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/panda-syntax.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/panda-syntax.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/panda-syntax.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/panda-syntax.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/paraiso-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/paraiso-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/paraiso-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/paraiso-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/paraiso-light.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/paraiso-light.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/paraiso-light.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/paraiso-light.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/pastel-on-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/pastel-on-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/pastel-on-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/pastel-on-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/railscasts.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/railscasts.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/railscasts.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/railscasts.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/rubyblue.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/rubyblue.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/rubyblue.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/rubyblue.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/seti.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/seti.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/seti.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/seti.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/shadowfox.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/shadowfox.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/shadowfox.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/shadowfox.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/solarized.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/solarized.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/solarized.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/solarized.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ssms.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ssms.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ssms.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ssms.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/the-matrix.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/the-matrix.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/the-matrix.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/the-matrix.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/tomorrow-night-bright.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/tomorrow-night-bright.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/tomorrow-night-bright.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/tomorrow-night-bright.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/tomorrow-night-eighties.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/tomorrow-night-eighties.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/tomorrow-night-eighties.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/tomorrow-night-eighties.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ttcn.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ttcn.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/ttcn.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/ttcn.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/twilight.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/twilight.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/twilight.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/twilight.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/vibrant-ink.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/vibrant-ink.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/vibrant-ink.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/vibrant-ink.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/xq-dark.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/xq-dark.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/xq-dark.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/xq-dark.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/xq-light.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/xq-light.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/xq-light.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/xq-light.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/yeti.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/yeti.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/yeti.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/yeti.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/yonce.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/yonce.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/yonce.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/yonce.css diff --git a/SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/zenburn.css b/SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/zenburn.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/CodeMirror/theme/zenburn.css rename to SAP1EMU.GUI/wwwroot/js/CodeMirror/theme/zenburn.css diff --git a/SAP1EMU.WebApp/wwwroot/js/Views/AboutView.js b/SAP1EMU.GUI/wwwroot/js/Views/AboutView.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/Views/AboutView.js rename to SAP1EMU.GUI/wwwroot/js/Views/AboutView.js diff --git a/SAP1EMU.WebApp/wwwroot/js/Views/AssemblerView.js b/SAP1EMU.GUI/wwwroot/js/Views/AssemblerView.js similarity index 76% rename from SAP1EMU.WebApp/wwwroot/js/Views/AssemblerView.js rename to SAP1EMU.GUI/wwwroot/js/Views/AssemblerView.js index c1ef2c21..c5963ea7 100644 --- a/SAP1EMU.WebApp/wwwroot/js/Views/AssemblerView.js +++ b/SAP1EMU.GUI/wwwroot/js/Views/AssemblerView.js @@ -73,22 +73,28 @@ function AssembleCode() { -function openFromFile() { - // Send Request to ASP.NET - const { ipcRenderer } = require("electron"); - ipcRenderer.send("open-from-file-asm"); - - // Receive code back from ASP.NET - ipcRenderer.once("code-from-file-asm", - (sender, asm_code) => { - asm_editor.setValue(asm_code); - } - ); +//function openFromFile() { +// // Send Request to ASP.NET +// const { ipcRenderer } = require("electron"); +// ipcRenderer.send("open-from-file-asm"); + +// // Receive code back from ASP.NET +// ipcRenderer.once("code-from-file-asm", +// (sender, asm_code) => { +// asm_editor.setValue(asm_code); +// } +// ); + +//} + +//function saveToFile() { +// // Send Request to ASP.NET +// const { ipcRenderer } = require("electron"); +// ipcRenderer.send("save-to-file-asm", bin_editor.getValue()); +//} + +function getFromFile() { + readFromFile(".s,.asm", asm_editor, "assembler-out"); } -function saveToFile() { - // Send Request to ASP.NET - const { ipcRenderer } = require("electron"); - ipcRenderer.send("save-to-file-asm", bin_editor.getValue()); -} \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/js/Views/Docs/8BitDocs.js b/SAP1EMU.GUI/wwwroot/js/Views/Docs/8BitDocs.js new file mode 100644 index 00000000..c3a572e3 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/js/Views/Docs/8BitDocs.js @@ -0,0 +1,50 @@ +// These are global so they presist throught the page lifetime +var EightBit_P3_Example_Left; +var EightBit_P3_Example_Right; +var EightBit_P3_Example_Comment_Left; +var EightBit_P3_Example_Comment_Right; + +window.onload = function () { + // Setup Code Editor Boxes + + // Macro Example + EightBit_P3_Example_Left = CodeMirror.fromTextArea(document.getElementById("8Bit_P3_Example_Left"), { + lineNumbers: true, + matchBrackets: true, + mode: { name: "gas_sap1", architecture: "x86" }, + readOnly: true, + }); + + EightBit_P3_Example_Right = CodeMirror.fromTextArea(document.getElementById("8Bit_P3_Example_Right"), { + lineNumbers: true, + matchBrackets: true, + mode: { name: "gas_sap1", architecture: "x86" }, + readOnly: true, + }); + + + // Comments Example + EightBit_P3_Example_Comment_Left = CodeMirror.fromTextArea(document.getElementById("8Bit_P3_Example_Comment_Left"), { + lineNumbers: true, + matchBrackets: true, + mode: { name: "gas_sap1", architecture: "x86" }, + readOnly: true, + }); + + EightBit_P3_Example_Comment_Right = CodeMirror.fromTextArea(document.getElementById("8Bit_P3_Example_Comment_Right"), { + lineNumbers: true, + matchBrackets: true, + mode: { name: "gas_sap1", architecture: "x86" }, + readOnly: true, + }); + + // Macro Example + EightBit_P3_Example_Left.setValue("LDA 0xF\nADD 0xE\nOUT 0x0\nHLT 0x0\n...\n0x7 0x1\n0xF 0xE"); + EightBit_P3_Example_Right.setValue("LDA 0xF\nADD 0xE\nOUT 0x0\nHLT 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x7 0x1\n0xF 0xE"); + + // Comments Example + EightBit_P3_Example_Comment_Left.setValue("LDA 0xF\nADD 0xE # A = A + RAM[14]\nJIC 0x4 # if Carry==1, exit loop\nJMP 0x1 # JMP to ADD 0xE\nOUT 0x0\nHLT 0x0\n...\n# Data Section:\n0x0 0x1 # 1\n0xF 0xD # 253"); + EightBit_P3_Example_Comment_Right.setValue("LDA 0xF\nADD 0xE\nJIC 0x4\nJMP 0x1\nOUT 0x0\nHLT 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x0\n0x0 0x1\n0xF 0xD"); + + +} \ No newline at end of file diff --git a/SAP1EMU.GUI/wwwroot/js/Views/EmulatorView.js b/SAP1EMU.GUI/wwwroot/js/Views/EmulatorView.js new file mode 100644 index 00000000..db36ec8e --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/js/Views/EmulatorView.js @@ -0,0 +1,280 @@ +var asm_editor; +var ram_dump; +var frame_stack; +var interval_slider; +var interval_time = 500; +//var playerInstance; + +window.onload = function () { + interval_slider = document.getElementById("formControlRange"); + + asm_editor = CodeMirror.fromTextArea(document.getElementById("asm_code"), { + lineNumbers: true, + matchBrackets: true, + mode: { name: "gas_sap1", architecture: "x86" }, + }); + + ram_dump = CodeMirror.fromTextArea(document.getElementById("ram_dump"), { + lineNumbers: true, + matchBrackets: true, + mode: { name: "gas_sap1", architecture: "x86" }, + readOnly: true, + firstLineNumber: 0, + lineNumberFormatter: function (line) { return "0x" + line.toString(16).toLocaleUpperCase(); }, + }); + + initRam(); + initBoard(); + setControlButtonsDisabled(true); + + + // Setup ComboBox + $.ajax({ + url: "../api/Assembler/supported_sets", + type: "GET", + success: function (data) { + var selectDOM = document.getElementById("langs"); + var options = data; + + for (var i = 0; i < options.length; i++) { + var opt = options[i]; + + var elem = document.createElement("option"); + elem.text = opt; + elem.value = opt; + + selectDOM.add(elem); + } + }, + error: function (request, status, error) { + alert("SAP1EMU ERROR: JSON CONFIG FILE ERROR:\n" + request.responseText); + } + }); + +} + +function initBoard() { + $('#pc-block').html("0000"); + $('#wbus-block').html("0000 0000"); + $('#areg-block').html("0000 0000"); + $('#mar-block').html("0000"); + $('#alu-block').html("0000 0000"); + $('#ram-block').html("0000 0000"); + $('#breg-block').html("0000 0000"); + $('#ireg-block').html("0000 0000"); + $('#oreg-block').html("0000 0000"); + $('#seq-block').html("0011 1110 0011 11"); + $('#dis-block').html("0"); + $('#carryFlagBox').html("0"); + $('#underflowFlagBox').html("0"); +} + +function updateBoard(frame) { + $('#pc-block').html(frame.pc); + $('#wbus-block').html(frame.wBus.match(/.{1,4}/g).join(' ')); + $('#areg-block').html(frame.aReg.match(/.{1,4}/g).join(' ')); + $('#mar-block').html(frame.mReg.match(/.{1,4}/g).join(' ')); + $('#alu-block').html(frame.alu.match(/.{1,4}/g).join(' ')); + $('#ram-block').html(frame.raM_Reg.match(/.{1,4}/g).join(' ')); + $('#breg-block').html(frame.bReg.match(/.{1,4}/g).join(' ')); + $('#ireg-block').html(frame.iReg.match(/.{1,4}/g).join(' ')); + $('#oreg-block').html(frame.oReg.match(/.{1,4}/g).join(' ')); + $('#seq-block').html(frame.seq.substring(0, 14).match(/.{1,4}/g).join(' ')); // TODO This substring should be handled at the API level, not the UI level + $('#carryFlagBox').val(frame.overflow_Flag); + $('#underflowFlagBox').val(frame.underflow_Flag); + + var posVal = parseInt(frame.oReg, 2); + var negVal = posVal; + + if (posVal > 127) { + negVal = (-1) * (256 - posVal); + } + var displayString = "" + posVal; + if (negVal < 0) { + displayString += " " + negVal; + } + + $('#dis-block').html(displayString); +} + +function initRam() { + // Init RAM Box + var ram_string = ""; + + for (var i = 0; i < 15; i++) { + ram_string += "0000 0000\n"; + } + ram_string += "0000 0000"; + ram_dump.setValue(ram_string); +} + +function loadRam(ram) { + var tempString = ""; + for (var i = 0; i < 16; i++) { + tempString += ram[i].substring(0, 4); + tempString += " "; + tempString += ram[i].substring(4, 8); + if (i < 15) { + tempString += "\n"; + } + } + ram_dump.setValue(tempString); +} + +function LoadIntoRAM() { + var asm_code = asm_editor.getValue().split('\n'); + var langChoice = document.getElementById("langs").value; + + jsonData = JSON.stringify({ CodeList: asm_code, SetName: langChoice }); + //console.log(jsonData); + + $.ajax({ + url: "../api/Emulator", + type: "POST", + contentType: 'application/json; charset=UTF-8', + data: jsonData, + success: function (data) { + $('#emulator-out').html('<br />'); // clear the error msg box + + frame_stack = data; + first_frame = frame_stack[0]; + + //console.log(frame_stack); + //console.log(frame_stack.length); + + loadRam(first_frame.ram); + + return data; + }, + error: function (request, status, error) { + initRam(); + $('#emulator-out').html(request.responseText); + } + }); + + + + setControlButtonsDisabled(false); +} + +var job_id = null; +var justPaused = false; +function play_button_onclick() { + if (job_id == null) { + $("#play-pause-img").attr("src", "/img/pause-24px.svg"); + job_id = setInterval(frame_advance, interval_time); + + // Disable back and next + $("#back-button").prop('disabled', true); + $("#next-button").prop('disabled', true); + } + else { + justPaused = true; + clearInterval(job_id); + job_id = null; + $("#play-pause-img").attr("src", "/img/play_arrow-24px.svg"); + + // Enable back and next + $("#back-button").prop('disabled', false); + $("#next-button").prop('disabled', false); + } +} + +function back_button_onclick() { + frame_reverse(); +} + +function next_button_onclick() { + frame_advance(); +} + +function reset_button_onclick() { + current_frame = 0; + updateBoard(frame_stack[current_frame]); + loadRam(frame_stack[current_frame].ram); + $("#instruction-box").text(frame_stack[current_frame].instruction); + $("#tstate-box").val('T' + frame_stack[current_frame].tState); + updateProgressBar(current_frame, frame_stack.length); +} + + + +var current_frame = 0; +function frame_advance() { + if (current_frame < frame_stack.length - 1) { + current_frame++; + updateBoard(frame_stack[current_frame]); + loadRam(frame_stack[current_frame].ram); + $("#instruction-box").text(frame_stack[current_frame].instruction); + $("#tstate-box").val('T' + frame_stack[current_frame].tState); + + // Update Progress Bar + updateProgressBar(current_frame, frame_stack.length); + } + else { + $('#frameProgressBar').css("width", "100%"); + clearInterval(job_id); + job_id = null; + + + } + + //console.log(frame_stack[current_frame]); +} + +function frame_reverse() { + if (justPaused) { + current_frame--; + justPaused = false; + } + if (current_frame > 0) { + current_frame--; + updateBoard(frame_stack[current_frame]); + loadRam(frame_stack[current_frame].ram); + $("#instruction-box").text(frame_stack[current_frame].instruction); + $("#tstate-box").val('T' + frame_stack[current_frame].tState); + + // Update Progress Bar + updateProgressBar(current_frame, frame_stack.length); + } +} + +function getFromFile() { + readFromFile(".s,.asm", asm_editor, "emulator-out"); +} + +function setControlButtonsDisabled(isDisabled) { + $("#back-button").prop('disabled', isDisabled); + $("#play-pause-button").prop('disabled', isDisabled); + $("#next-button").prop('disabled', isDisabled); + $("#reset-button").prop('disabled', isDisabled); +} + + +function updateProgressBar(currentFrame, frameStackLength) { + + if (currentFrame == frameStackLength - 1) { + $('#frameProgressBar').css("width", "100%"); + } + else { + var frameProgress = (current_frame / frame_stack.length) * 100; + $('#frameProgressBar').css("width", frameProgress + "%"); + } +} + +function changeIntervalTiming(value) { + + // keep the time from getting too long + if (value <= .250) { + value = .250; + } + interval_time = (1 / value) * 500; + + // If we currently have a job in process meaning the code is executing then + // clear it and change the interval time and start again + if (job_id != null) { + clearInterval(job_id); + job_id = setInterval(frame_advance, interval_time); + } +} + diff --git a/SAP1EMU.WebApp/wwwroot/js/Views/_LayoutView.js b/SAP1EMU.GUI/wwwroot/js/Views/_LayoutView.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/js/Views/_LayoutView.js rename to SAP1EMU.GUI/wwwroot/js/Views/_LayoutView.js diff --git a/SAP1EMU.GUI/wwwroot/js/site.js b/SAP1EMU.GUI/wwwroot/js/site.js new file mode 100644 index 00000000..6313c884 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/js/site.js @@ -0,0 +1,31 @@ +// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +// for details on configuring this project to bundle and minify static web assets. + +// Write your JavaScript code. + +function readFromFile(type, codeMirror, errorBoxID) { + var input = document.createElement('input'); + input.type = 'file'; + input.accept = type; + input.onchange = e => { + var file = e.target.files[0]; + + // Read the file contents + var reader = new FileReader(); + reader.readAsText(file, 'UTF-8'); + + // Send contents to CodeMiror Box + reader.onload = readerEvent => { + content = readerEvent.target.result; + codeMirror.setValue(content); + } + + reader.onerror = readerEvent => { + $("#" + errorBoxID).setValue(readerEvent.target.error); + } + + } + input.click(); +} + + diff --git a/SAP1EMU.GUI/wwwroot/lib/android-chrome-192x192.png b/SAP1EMU.GUI/wwwroot/lib/android-chrome-192x192.png new file mode 100644 index 00000000..dfed6d4e Binary files /dev/null and b/SAP1EMU.GUI/wwwroot/lib/android-chrome-192x192.png differ diff --git a/SAP1EMU.GUI/wwwroot/lib/android-chrome-512x512.png b/SAP1EMU.GUI/wwwroot/lib/android-chrome-512x512.png new file mode 100644 index 00000000..b3dd943e Binary files /dev/null and b/SAP1EMU.GUI/wwwroot/lib/android-chrome-512x512.png differ diff --git a/SAP1EMU.GUI/wwwroot/lib/apple-touch-icon.png b/SAP1EMU.GUI/wwwroot/lib/apple-touch-icon.png new file mode 100644 index 00000000..1398cf68 Binary files /dev/null and b/SAP1EMU.GUI/wwwroot/lib/apple-touch-icon.png differ diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/LICENSE b/SAP1EMU.GUI/wwwroot/lib/bootstrap/LICENSE similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/LICENSE rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/LICENSE diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.css b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.css rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.css diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.js b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.js rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map b/SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map rename to SAP1EMU.GUI/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map diff --git a/SAP1EMU.GUI/wwwroot/lib/favicon-16x16.png b/SAP1EMU.GUI/wwwroot/lib/favicon-16x16.png new file mode 100644 index 00000000..014e9b80 Binary files /dev/null and b/SAP1EMU.GUI/wwwroot/lib/favicon-16x16.png differ diff --git a/SAP1EMU.GUI/wwwroot/lib/favicon-32x32.png b/SAP1EMU.GUI/wwwroot/lib/favicon-32x32.png new file mode 100644 index 00000000..69789c16 Binary files /dev/null and b/SAP1EMU.GUI/wwwroot/lib/favicon-32x32.png differ diff --git a/SAP1EMU.GUI/wwwroot/lib/favicon.ico b/SAP1EMU.GUI/wwwroot/lib/favicon.ico new file mode 100644 index 00000000..b15b459a Binary files /dev/null and b/SAP1EMU.GUI/wwwroot/lib/favicon.ico differ diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/LICENSE.txt b/SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/LICENSE.txt similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/LICENSE.txt rename to SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/LICENSE.txt diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/README.md b/SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/README.md similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/README.md rename to SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/README.md diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.js b/SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.min.js b/SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.min.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.min.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/dist/jquery.unobtrusive-ajax.min.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/package.json b/SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/package.json similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-ajax-unobtrusive/package.json rename to SAP1EMU.GUI/wwwroot/lib/jquery-ajax-unobtrusive/package.json diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt b/SAP1EMU.GUI/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js b/SAP1EMU.GUI/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js b/SAP1EMU.GUI/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation/LICENSE.md b/SAP1EMU.GUI/wwwroot/lib/jquery-validation/LICENSE.md similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation/LICENSE.md rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation/LICENSE.md diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/additional-methods.js b/SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/additional-methods.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/additional-methods.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/additional-methods.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/additional-methods.min.js b/SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/additional-methods.min.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/additional-methods.min.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/additional-methods.min.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/jquery.validate.js b/SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/jquery.validate.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/jquery.validate.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/jquery.validate.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js b/SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js rename to SAP1EMU.GUI/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery/LICENSE.txt b/SAP1EMU.GUI/wwwroot/lib/jquery/LICENSE.txt similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery/LICENSE.txt rename to SAP1EMU.GUI/wwwroot/lib/jquery/LICENSE.txt diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery/dist/jquery.js b/SAP1EMU.GUI/wwwroot/lib/jquery/dist/jquery.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery/dist/jquery.js rename to SAP1EMU.GUI/wwwroot/lib/jquery/dist/jquery.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery/dist/jquery.min.js b/SAP1EMU.GUI/wwwroot/lib/jquery/dist/jquery.min.js similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery/dist/jquery.min.js rename to SAP1EMU.GUI/wwwroot/lib/jquery/dist/jquery.min.js diff --git a/SAP1EMU.WebApp/wwwroot/lib/jquery/dist/jquery.min.map b/SAP1EMU.GUI/wwwroot/lib/jquery/dist/jquery.min.map similarity index 100% rename from SAP1EMU.WebApp/wwwroot/lib/jquery/dist/jquery.min.map rename to SAP1EMU.GUI/wwwroot/lib/jquery/dist/jquery.min.map diff --git a/SAP1EMU.GUI/wwwroot/lib/site.webmanifest b/SAP1EMU.GUI/wwwroot/lib/site.webmanifest new file mode 100644 index 00000000..240873b9 --- /dev/null +++ b/SAP1EMU.GUI/wwwroot/lib/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/lib/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/lib/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} \ No newline at end of file diff --git a/SAP1EMU.Lib.Test/ComponentTests/ControllerTest.cs b/SAP1EMU.Lib.Test/ComponentTests/ControllerTest.cs index 449e24d7..e36c4c5b 100644 --- a/SAP1EMU.Lib.Test/ComponentTests/ControllerTest.cs +++ b/SAP1EMU.Lib.Test/ComponentTests/ControllerTest.cs @@ -9,9 +9,19 @@ namespace SAP1EMU.Lib.Test.ComponentTests [TestClass] public class ControllerTest { + private InstructionSet GetInstructionSet() + { + string InstructionSetName = "SAP1Emu"; + return OpCodeLoader.GetSet(InstructionSetName); + } + + + [TestMethod] public void TestControlWordTableInit() { + SEQ.Instance().Load(GetInstructionSet()); + const int INT_COUNT = 6; const int T_STATE_COUNT = 6; string[] INSTRUCTIONS = new string[6]{ "0000", "0001", "0010", "0011", "1110", "1111" }; diff --git a/SAP1EMU.Lib.Test/ComponentTests/PubSub_ClockTest.cs b/SAP1EMU.Lib.Test/ComponentTests/PubSub_ClockTest.cs index 8f217b2c..b42a6aaf 100644 --- a/SAP1EMU.Lib.Test/ComponentTests/PubSub_ClockTest.cs +++ b/SAP1EMU.Lib.Test/ComponentTests/PubSub_ClockTest.cs @@ -10,6 +10,12 @@ namespace SAP1EMU.Lib.Test.ComponentTests [TestClass] public class PubSub_ClockTest { + private InstructionSet GetInstructionSet() + { + string InstructionSetName = "SAP1Emu"; + return OpCodeLoader.GetSet(InstructionSetName); + } + [TestMethod] public void TestSubscribe() @@ -33,6 +39,8 @@ public void TestSubscribe() MReg mreg = new MReg(ref ram); SEQ seq = SEQ.Instance(); + seq.Load(GetInstructionSet()); + Wbus.Instance().Value = "00000000"; Flags.Instance().Clear(); @@ -44,6 +52,8 @@ public void TestSubscribe() pc.Subscribe(clock); alu.Subscribe(clock); // ALU must come after A and B ram.Subscribe(clock); + + } catch (Exception e) { @@ -61,7 +71,7 @@ public void TestUpdate() TicTok tictok = new TicTok(); - tictok.Init(); ; + tictok.Init(); AReg areg = new AReg(); BReg breg = new BReg(); @@ -73,6 +83,8 @@ public void TestUpdate() ALU alu = new ALU(ref areg, ref breg); MReg mreg = new MReg(ref ram); SEQ seq = SEQ.Instance(); + seq.Load(GetInstructionSet()); + Wbus.Instance().Value = "00000000"; Flags.Instance().Clear(); @@ -86,6 +98,7 @@ public void TestUpdate() alu.Subscribe(clock); // ALU must come after A and B ram.Subscribe(clock); + clock.IsEnabled = true; for (int i = 0; i < 500; i++) { @@ -120,6 +133,8 @@ public void TestUnsubscribe() ALU alu = new ALU(ref areg, ref breg); MReg mreg = new MReg(ref ram); SEQ seq = SEQ.Instance(); + seq.Load(GetInstructionSet()); + Wbus.Instance().Value = "00000000"; Flags.Instance().Clear(); diff --git a/SAP1EMU.Lib.Test/DecoderTest.cs b/SAP1EMU.Lib.Test/DecoderTest.cs new file mode 100644 index 00000000..25a3013a --- /dev/null +++ b/SAP1EMU.Lib.Test/DecoderTest.cs @@ -0,0 +1,44 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Text; + +namespace SAP1EMU.Lib.Test +{ + [TestClass] + + public class DecoderTest + { + + IDecoder _decoder = new InstructionDecoder(); + [TestMethod] + [DataRow("LDA", "0000", "SAP1Emu")] + [DataRow("ADD", "0001", "SAP1Emu")] + [DataRow("SUB", "0010", "SAP1Emu")] + [DataRow("STA", "0011", "SAP1Emu")] + [DataRow("JMP", "0100", "SAP1Emu")] + [DataRow("JEQ", "0101", "SAP1Emu")] + + [DataRow("LDA", "0000", "Malvino")] + [DataRow("ADD", "0001", "Malvino")] + [DataRow("SUB", "0010", "Malvino")] + [DataRow("OUT", "1110", "Malvino")] + [DataRow("HLT", "1111", "Malvino")] + [DataRow("???", "0101", "Malvino")] // Should not exist in Malvio + + + [DataRow("NOP", "0000", "BenEater")] + [DataRow("LDA", "0001", "BenEater")] + [DataRow("ADD", "0010", "BenEater")] + [DataRow("SUB", "0011", "BenEater")] + [DataRow("STA", "0100", "BenEater")] + [DataRow("LDI", "0101", "BenEater")] + [DataRow("OUT", "1110", "BenEater")] + [DataRow("HLT", "1111", "BenEater")] + + public void TestDecode(string OpCode, string BinCode, string SetName) + { + Assert.AreEqual(OpCode, _decoder.Decode(BinCode, SetName)); + } + } +} diff --git a/SAP1EMU.Lib.Test/FrameTest.cs b/SAP1EMU.Lib.Test/FrameTest.cs index 0481795d..7574ac10 100644 --- a/SAP1EMU.Lib.Test/FrameTest.cs +++ b/SAP1EMU.Lib.Test/FrameTest.cs @@ -10,6 +10,7 @@ namespace SAP1EMU.Lib.Test [TestClass] public class FrameTest { + IDecoder _decoder = new InstructionDecoder(); [TestMethod] public void TestToString() { @@ -35,7 +36,7 @@ public void TestToString() - Frame frame = new Frame(ireg.ToString(), TState, areg, breg, ireg, mreg, oreg, pc, alu, ram.RAMDump(), ram, seq, Wbus.Instance().ToString()); + Frame frame = new Frame(ireg.ToString(), TState, areg, breg, ireg, mreg, oreg, pc, alu, ram.RAMDump(), ram, seq, Wbus.Instance().ToString(), Flags.Instance(), _decoder); _ = frame.ToString(); _ = frame.OutputRegister(); diff --git a/SAP1EMU.Lib.Test/SAP1EMU.Lib.Test.csproj b/SAP1EMU.Lib.Test/SAP1EMU.Lib.Test.csproj index 0786b2bf..3555f911 100644 --- a/SAP1EMU.Lib.Test/SAP1EMU.Lib.Test.csproj +++ b/SAP1EMU.Lib.Test/SAP1EMU.Lib.Test.csproj @@ -13,9 +13,14 @@ </ItemGroup> <ItemGroup> + <PackageReference Include="coverlet.collector" Version="1.3.0"> + <PrivateAssets>all</PrivateAssets> + <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> + </PackageReference> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> <PackageReference Include="MSTest.TestAdapter" Version="2.1.1" /> <PackageReference Include="MSTest.TestFramework" Version="2.1.1" /> + <PackageReference Include="coverlet.collector" Version="1.2.0" /> </ItemGroup> <ItemGroup> diff --git a/SAP1EMU.Lib/Components/RAM.cs b/SAP1EMU.Lib/Components/RAM.cs index 104ebc60..c839986a 100644 --- a/SAP1EMU.Lib/Components/RAM.cs +++ b/SAP1EMU.Lib/Components/RAM.cs @@ -118,5 +118,11 @@ public override string ToString() { return RAM_Register_Content; } + + public string ToString_Frame_Use() + { + return (String.IsNullOrEmpty(this.RAM_Register_Content) ? "00000000" : this.RAM_Register_Content); + } + } } diff --git a/SAP1EMU.Lib/Components/SEQ.cs b/SAP1EMU.Lib/Components/SEQ.cs index 10292647..4901db09 100644 --- a/SAP1EMU.Lib/Components/SEQ.cs +++ b/SAP1EMU.Lib/Components/SEQ.cs @@ -19,7 +19,7 @@ public class SEQ /// <summary> /// The control word storage location for all registers and components /// <para> - /// CP EP LM_ CE_ LI_ EI_ LA_ EA SU EU LB_ LO_ | LR_ LP_ + /// CP EP LM_ CE_ LI_ EI_ LA_ EA SU EU LB_ LO_ | LR_ LP_ | 0bXXX (Jump Code) /// </para> /// </summary> public string ControlWord { get; private set; } @@ -71,6 +71,7 @@ public void Load(InstructionSet iset) ControlTable.Add(HashKey(i + 1, instruction.BinCode), instruction.MicroCode[i]); } } + _instance.ControlWord = ControlTable[HashKey(6,"1111")]; // sets the default to a NOP } @@ -84,9 +85,11 @@ public static SEQ Instance() if (_instance == null) { _instance = new SEQ(); - _instance.ControlWord = "001111100011"; + //_instance.ControlWord = "001111100011"; + // TODO - this wasnt enough chars bc the words got longer, I fixed by addding _instance.ControlWord = ControlTable[0]; abouve + // not a greate fix, but it works } - + return _instance; } diff --git a/SAP1EMU.Lib/Frame.cs b/SAP1EMU.Lib/Frame.cs index 886a44b6..c10632ec 100644 --- a/SAP1EMU.Lib/Frame.cs +++ b/SAP1EMU.Lib/Frame.cs @@ -10,56 +10,72 @@ namespace SAP1EMU.Lib { public class Frame { - public string Instruction { get; private set; } = "????"; + public string Instruction { get; private set; } = "???"; public int TState { get; private set; } = 0; - public string AReg { get; private set; } = "????"; - public string BReg { get; private set; } = "????"; - public string IReg { get; private set; } = "????"; - public string IRegShort { get; private set; } = "????"; - public string MReg { get; private set; } = "????"; - public string OReg { get; private set; } = "????"; - public string PC { get; private set; } = "????"; - public string ALU { get; private set; } = "????"; - public string SEQ { get; private set; } = "????"; - public string WBus { get; private set; } = "????"; - public string RAM_Reg { get; private set; } = "?????"; + public string AReg { get; private set; } = "0000 0000"; + public string BReg { get; private set; } = "0000 0000"; + public string IReg { get; private set; } = "0000 0000"; + public string IRegShort { get; private set; } = "0000 0000"; + public string MReg { get; private set; } = "0000 0000"; + public string OReg { get; private set; } = "0000 0000"; + public string PC { get; private set; } = "0000"; + public string ALU { get; private set; } = "0000 0000"; + public string SEQ { get; private set; } = "0000 0000"; + public string WBus { get; private set; } = "0000 0000"; + public string RAM_Reg { get; private set; } = "0000 0000"; + public string Overflow_Flag { get; private set; } = "0"; + public string Underflow_Flag { get; private set; } = "0"; public List<string> RAM { get; private set; } // The reason this is here is that the RAM might change if a STA simular command is issued. - public Frame(string instruction, int TState, AReg areg, BReg breg, IReg ireg, MReg mreg, OReg oreg, PC pc, ALU alu, List<string> ramContents, RAM ram, SEQ seq, string wbus_string) + public Frame(string instruction, int TState, AReg areg, BReg breg, IReg ireg, MReg mreg, OReg oreg, PC pc, ALU alu, List<string> ramContents, RAM ram, SEQ seq, string wbus_string, Flags flags, IDecoder decoder, string SetName = "SAP1EMU") { this.RAM = new List<string>(); this.TState = TState; - this.AReg = areg.ToString(); - this.BReg = breg.ToString(); + this.AReg = areg.ToString_Frame_Use(); + this.BReg = breg.ToString_Frame_Use(); this.IRegShort = ireg.ToString(); this.IReg = ireg.ToString_Frame_Use(); // The real ToString() is in use with a substring in it. This is needed for proper operation - this.MReg = mreg.ToString(); - this.OReg = oreg.ToString(); + this.MReg = mreg.ToString_Frame_Use(); + this.OReg = oreg.ToString_Frame_Use(); this.PC = pc.ToString().Substring(4, 4); this.ALU = alu.ToString(); this.WBus = wbus_string; + this.Overflow_Flag = flags.Overflow.ToString(); + this.Underflow_Flag = flags.Underflow.ToString(); + foreach(string s in ramContents) { RAM.Add(s); } - this.SEQ = seq.ToString(); this.WBus = wbus_string; // I didnt want to mess with the Singleton in the frame, so the value will just be passed as a string - this.RAM_Reg = ram.ToString(); + this.RAM_Reg = ram.ToString_Frame_Use(); if (instruction.Length == 0) { - this.IReg = "????"; + this.IReg = "???"; } + + if(TState > 3) + { + //Instruction = OpCodeLoader.DecodeInstruction(IReg.Substring(0, 4), SetName); // TODO this is really inifeciant. Should prob make a service and inject it + Instruction = decoder.Decode(IReg.Substring(0, 4), SetName); + } + else + { + Instruction = "???"; + + } } // TODO - Repleace with something in the LIB OpCodeLoader + // TODO - is the still used? I think I replaced this somewhere else in the code private string InstuctionDecode(string BinInstruction, int TState) { List<string> KnownInstructions = new List<string> { "LDA", "ADD", "SUB", "STA", "JMP", "JEQ", "", "", "", "JIC", "", "", "", "", "OUT", "HLT" }; diff --git a/SAP1EMU.Lib/IDecoder.cs b/SAP1EMU.Lib/IDecoder.cs new file mode 100644 index 00000000..96f482b0 --- /dev/null +++ b/SAP1EMU.Lib/IDecoder.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SAP1EMU.Lib +{ + public interface IDecoder + { + public string Decode(string binCode, string setName); + } +} diff --git a/SAP1EMU.Lib/InstructionDecoder.cs b/SAP1EMU.Lib/InstructionDecoder.cs new file mode 100644 index 00000000..9d895588 --- /dev/null +++ b/SAP1EMU.Lib/InstructionDecoder.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; + +namespace SAP1EMU.Lib +{ + public class InstructionDecoder : IDecoder + { + Dictionary<int, string> _instructions = new Dictionary<int, string>(); + string _filename = "InstructionSets.json"; + public InstructionDecoder() + { + string json = File.ReadAllText(_filename); + List<InstructionSet> sets = JsonSerializer.Deserialize<List<InstructionSet>>(json); + + foreach(InstructionSet iset in sets) + { + foreach(Instruction i in iset.instructions) + { + _instructions.Add((i.BinCode, iset.SetName).GetHashCode(), i.OpCode); + } + } + } + + public string Decode(string binCode, string setName) + { + try + { + return _instructions[(binCode, setName).GetHashCode()]; + } + catch(Exception) + { + return "???"; + } + } + } +} diff --git a/SAP1EMU.Lib/InstructionSets.json b/SAP1EMU.Lib/InstructionSets.json index b0aa7331..990253cc 100644 --- a/SAP1EMU.Lib/InstructionSets.json +++ b/SAP1EMU.Lib/InstructionSets.json @@ -58,7 +58,7 @@ "01011110001111000", "10111110001111000", "00100110001111000", - "00111010001100000", + "00111010001110000", "00111110001111000", "00111110001111000" ] @@ -70,7 +70,7 @@ "01011110001111001", "10111110001111001", "00100110001111001", - "00111010001100001", + "00111010001110001", "00111110001111001", "00111110001111001" ] @@ -82,7 +82,7 @@ "01011110001111010", "10111110001111010", "00100110001111010", - "00111010001100010", + "00111010001110010", "00111110001111010", "00111110001111010" ] @@ -94,7 +94,7 @@ "01011110001111011", "10111110001111011", "00100110001111011", - "00111010001100011", + "00111010001110011", "00111110001111011", "00111110001111011" ] @@ -106,7 +106,7 @@ "01011110001111100", "10111110001111100", "00100110001111100", - "00111010001100100", + "00111010001110100", "00111110001111100", "00111110001111100" ] @@ -118,7 +118,7 @@ "01011110001111101", "10111110001111101", "00100110001111101", - "00111010001100101", + "00111010001110101", "00111110001111101", "00111110001111101" ] @@ -286,7 +286,7 @@ "01011110001111000", "10111110001111000", "00100110001111000", - "00111110001111000", + "00111000001111000", "00111110001111000", "00111110001111000" ] @@ -298,7 +298,7 @@ "01011110001111000", "10111110001111000", "00100110001111000", - "00111010001100000", + "00111010001110000", "00111110001111000", "00111110001111000" ] @@ -310,7 +310,7 @@ "01011110001111010", "10111110001111010", "00100110001111010", - "00111010001100010", + "00111010001110010", "00111110001111010", "00111110001111010" ] @@ -322,7 +322,7 @@ "01011110001111001", "10111110001111001", "00100110001111001", - "00111010001100001", + "00111010001110001", "00111110001111001", "00111110001111001" ] diff --git a/SAP1EMU.Lib/OpCodeLoader.cs b/SAP1EMU.Lib/OpCodeLoader.cs index d2c88c58..78e1f2fd 100644 --- a/SAP1EMU.Lib/OpCodeLoader.cs +++ b/SAP1EMU.Lib/OpCodeLoader.cs @@ -80,5 +80,41 @@ public static List<string> GetISetNames() return names; } + + // Replaced by IDecoder + //public static string DecodeInstruction(string InstructionBin, string SetName = "SAP1EMU") + //{ + // string json; + // try + // { + // json = File.ReadAllText(jsonFile); + // } + // catch (Exception e) + // { + // throw new Exception($"SAP1EMU: Error reading Instruction Set File: \"{jsonFile}\" ", e); + // } + + + // List<InstructionSet> sets; + // try + // { + // sets = JsonSerializer.Deserialize<List<InstructionSet>>(json); + // } + // catch (Exception e) + // { + // throw new Exception($"SAP1EMU: Error reading Instruction Set File: \"{SetName}\", Invalid JSON", e); + // } + + // InstructionSet setChoice = sets.Find(x => x.SetName.ToLower().Equals(SetName.ToLower())); + + // if (setChoice == null || string.IsNullOrEmpty(setChoice.SetName)) + // { + // throw new Exception($"SAP1EMU: Instruction Set \"{SetName}\" does not exist"); + // } + + // string Instruction = setChoice.instructions.Find(x => x.BinCode == InstructionBin).OpCode; + // return Instruction; + //} + } } diff --git a/SAP1EMU.Lib/Registers/AReg.cs b/SAP1EMU.Lib/Registers/AReg.cs index b60ffce3..a501d25d 100644 --- a/SAP1EMU.Lib/Registers/AReg.cs +++ b/SAP1EMU.Lib/Registers/AReg.cs @@ -73,5 +73,10 @@ public override string ToString() { return this.RegContent; } + public string ToString_Frame_Use() + { + return (String.IsNullOrEmpty(this.RegContent) ? "00000000" : this.RegContent); + } + } } diff --git a/SAP1EMU.Lib/Registers/BReg.cs b/SAP1EMU.Lib/Registers/BReg.cs index acddc046..d4065299 100644 --- a/SAP1EMU.Lib/Registers/BReg.cs +++ b/SAP1EMU.Lib/Registers/BReg.cs @@ -61,5 +61,10 @@ public override string ToString() { return this.RegContent; } + + public string ToString_Frame_Use() + { + return (String.IsNullOrEmpty(this.RegContent) ? "00000000" : this.RegContent); + } } } diff --git a/SAP1EMU.Lib/Registers/IReg.cs b/SAP1EMU.Lib/Registers/IReg.cs index 77648257..dc511ce3 100644 --- a/SAP1EMU.Lib/Registers/IReg.cs +++ b/SAP1EMU.Lib/Registers/IReg.cs @@ -21,7 +21,7 @@ private void Exec(TicTok tictok) if (cw[5] == '0' & tictok.ClockState == TicTok.State.Tic) { // Send A to the WBus - Wbus.Instance().Value = RegContent; + Wbus.Instance().Value = "0000" + RegContent.Substring(4,4); //Instruction register only outputs the least significant bits to the WBus } // Active Low, Pull on Tok @@ -32,14 +32,14 @@ private void Exec(TicTok tictok) } /// <summary> - /// For the real ToString, use the ToString_Fram_use() method + /// For the real ToString, use the ToString_Frame_use() method /// </summary> - /// <returns></returns> + /// <returns></returns> public override string ToString() { // I dont know this this is the best place to put this substring command, but it is needed // Currently, - return RegContent.Substring(0,4); + return RegContent.Substring(0, 4); } #region IObserver Region private IDisposable unsubscriber; @@ -72,14 +72,13 @@ public virtual void Unsubscribe() #endregion - public string ToString_Frame_Use() + public string ToString_Frame_Use() { - return this.RegContent; + return (String.IsNullOrEmpty(this.RegContent) ? "0000 0000" : this.RegContent); } - } - + } } diff --git a/SAP1EMU.Lib/Registers/MReg.cs b/SAP1EMU.Lib/Registers/MReg.cs index 79f9c8d1..d08d39c8 100644 --- a/SAP1EMU.Lib/Registers/MReg.cs +++ b/SAP1EMU.Lib/Registers/MReg.cs @@ -64,11 +64,14 @@ public virtual void Unsubscribe() } #endregion - - public override string ToString() { - return RegContent; + return this.RegContent; + } + + public string ToString_Frame_Use() + { + return (String.IsNullOrEmpty(this.RegContent) ? "0000 0000" : this.RegContent); } } diff --git a/SAP1EMU.Lib/Registers/OReg.cs b/SAP1EMU.Lib/Registers/OReg.cs index 16e34818..d6fb411c 100644 --- a/SAP1EMU.Lib/Registers/OReg.cs +++ b/SAP1EMU.Lib/Registers/OReg.cs @@ -52,11 +52,14 @@ public virtual void Unsubscribe() unsubscriber.Dispose(); } #endregion - - public override string ToString() { return this.RegContent; } + + public string ToString_Frame_Use() + { + return (String.IsNullOrEmpty(this.RegContent) ? "00000000" : this.RegContent); + } } } diff --git a/SAP1EMU.WebApp/Controllers/HomeController.cs b/SAP1EMU.WebApp/Controllers/HomeController.cs deleted file mode 100644 index 1f6036f6..00000000 --- a/SAP1EMU.WebApp/Controllers/HomeController.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.IO; -using System.Text; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using ElectronNET.API; -using ElectronNET.API.Entities; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using SAP1EMU.WebApp.Models; - -namespace SAP1EMU.WebApp.Controllers -{ - public class HomeController : Controller - { - private readonly ILogger<HomeController> _logger; - public HomeController(ILogger<HomeController> logger) - { - _logger = logger; - } - - public IActionResult Index() - { - - if (HybridSupport.IsElectronActive) - { - // Must remvoe EL's before adding new ones or else duplicate EL's will be created - Electron.IpcMain.RemoveAllListeners("open-wiki"); - - Electron.IpcMain.On("open-wiki", async (args) => - { - await Electron.Shell.OpenExternalAsync("https://github.com/rbaker26/SAP1EMU/wiki"); - }); - } - - return View(); - } - public IActionResult About() - { - if (HybridSupport.IsElectronActive) - { - // Must remvoe EL's before adding new ones or else duplicate EL's will be created - Electron.IpcMain.RemoveAllListeners("open-github-profile"); - Electron.IpcMain.RemoveAllListeners("open-ben-eater"); - - Electron.IpcMain.On("open-github-profile", async (args) => - { - await Electron.Shell.OpenExternalAsync("https://github.com/rbaker26/"); - }); - Electron.IpcMain.On("open-ben-eater", async (args) => - { - await Electron.Shell.OpenExternalAsync("https://eater.net/"); - }); - - } - return View(); - } - public IActionResult Emulator() - { - return View(); - } - public IActionResult Assembler() - { - if (HybridSupport.IsElectronActive) - { - Electron.IpcMain.RemoveAllListeners("open-from-file-asm"); - - Electron.IpcMain.On("open-from-file-asm", async (args) => - { - var mainWindow = Electron.WindowManager.BrowserWindows.First(); - var options = new OpenDialogOptions { - Title = "Open SAP1Emu Assembly Code", - Filters = new FileFilter[] { - new FileFilter - { - Name = "SAP1Emu Assembly", - Extensions = new string[] {"s"} - } - }, - Properties = new OpenDialogProperty[] { - OpenDialogProperty.openFile, - } - }; - string[] files = await Electron.Dialog.ShowOpenDialogAsync(mainWindow, options); - - string code = ""; - if (files.Length != 0) - { - if(!string.IsNullOrEmpty(files[0])) - { - code = System.IO.File.ReadAllText(files[0]); - } - } - - Electron.IpcMain.Send(mainWindow, "code-from-file-asm", code); - - }); - - - Electron.IpcMain.On("save-to-file-asm", async (args) => - { - var mainWindow = Electron.WindowManager.BrowserWindows.First(); - var options = new SaveDialogOptions { - Title = "Save SAP1Emu Binary Code", - Filters = new FileFilter[] { - new FileFilter { - Name = "SAP1Emu Binary", - Extensions = new string[] {"b"} - } - } - }; - - var path = await Electron.Dialog.ShowSaveDialogAsync(mainWindow, options); - - if(!string.IsNullOrEmpty(path)) - { - string contents = (string)args; - System.IO.File.WriteAllText(path, contents); - } - - }); - } - return View(); - } - - public IActionResult Privacy() - { - return View(); - } - - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] - public IActionResult Error() - { - return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); - } - } -} diff --git a/SAP1EMU.WebApp/Properties/launchSettings.json b/SAP1EMU.WebApp/Properties/launchSettings.json deleted file mode 100644 index f316d54d..00000000 --- a/SAP1EMU.WebApp/Properties/launchSettings.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:53979", - "sslPort": 0 - } - }, - "profiles": { - "Electron.NET App": { - "commandName": "Executable", - "executablePath": "electronize", - "commandLineArgs": "start", - "workingDirectory": "." - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "SAP1EMU.WebApp": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:5000" - } - } -} \ No newline at end of file diff --git a/SAP1EMU.WebApp/Startup.cs b/SAP1EMU.WebApp/Startup.cs deleted file mode 100644 index 2b4afa5f..00000000 --- a/SAP1EMU.WebApp/Startup.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using ElectronNET.API; - -namespace SAP1EMU.WebApp -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddControllersWithViews(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseExceptionHandler("/Home/Error"); - } - app.UseStaticFiles(); - - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllerRoute( - name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); - }); - Task.Run(async () => await Electron.WindowManager.CreateWindowAsync()); - } - } -} diff --git a/SAP1EMU.WebApp/Views/Home/About.cshtml b/SAP1EMU.WebApp/Views/Home/About.cshtml deleted file mode 100644 index 0cba12c5..00000000 --- a/SAP1EMU.WebApp/Views/Home/About.cshtml +++ /dev/null @@ -1,50 +0,0 @@ - -<script src="~/js/Views/AboutView.js" type="text/javascript"></script> - - -@{ - ViewData["Title"] = "About"; -} - -<h1>About</h1> -<br /> -<h2>About the Project</h2> -<p> - The SAP1Emu Project is an open-source suite of tools designed for students and educators teaching introductory courses in Computer Architecture or Digital Electronics. - It emulates the SAP1 computer from <i>Digital Computer Electronics by Malvino and Brown</i>. - <br /> - This Project is designed to assist in the building and programing of a SAP1 Computer. - Ben Eater has a great series of videos detailing building the SAP1 computer in a breadboard setup. - This project compliments Ben Eater's videos by allowing the student access to step-by-step debugging of an emulated SAP1 Computer. - <br /> - Students can compare the output of their SAP1 to the output of the SAP1Emu Emulator. - This can be done on a step-by-step basis by setting breakpoints and single-stepping the Emulator through their program. - <br /> - This Project is free and open-souce. - <br /> - For more info, please see the license on the Project's Github page. - <br /> - Please also visit <a onclick="openBenEater()" class="text-dark"><u>Ben Eater's Website</u></a> to learn more about his project. -</p> - -<br /> -<h2>About the Author</h2> -<h4>Who am I?</h4> -<p> - My name is Bob Baker and, at the time of writing, I am a Computer Science Student at Saddleback College in Orange County, California. - <br /> - The majority of my programming focus is on C++ and C# with an emphasis on ASP.NET Core. - I have worked with other languages like Java, SQL, and Python, but mostly for academic projects. <br /> - - Checkout my <a onclick="openGithub()" class="text-dark"><u>Github Profile</u></a> for more about me or for my contact info. -</p> -<h4>Why this project?</h4> -<p> - At Saddleback College, I worked as a Teachers Assistant in the Intro to Computer Architecture and Machine Language Lab - where I assisted students in the building and debugging of SAP1 Computers. - I found that, while there are a few software solutions to assist students; most were "half-baked", were no longer supported, or did not follow - the specification outline by Malvino. - <br /> - For these reasons, I decided to create the SAP1Emu Project. -</p> - diff --git a/SAP1EMU.WebApp/Views/Home/Assembler.cshtml b/SAP1EMU.WebApp/Views/Home/Assembler.cshtml deleted file mode 100644 index fe855c85..00000000 --- a/SAP1EMU.WebApp/Views/Home/Assembler.cshtml +++ /dev/null @@ -1,51 +0,0 @@ -<script src="/js/CodeMirror/lib/codemirror.js"></script> -<script src="/js/CodeMirror/mode/gas/gas_sap1.js" type="text/javascript"></script> -<link href="/js/CodeMirror/lib/codemirror.css" rel="stylesheet" type="text/css" /> - -<script src="/lib/jquery/dist/jquery.js" type="text/javascript"></script> -<script src="/js/Views/AssemblerView.js" type="text/javascript"></script> - -@{ - ViewData["Title"] = "Assembler"; -} - -<h1>Assembler</h1> - -<div class="row"> - <div class="column2"> - <h3>Assembly</h3> - <br /> - - <form id="asm_form" method="post" action="AssembleCode"> - @Html.TextArea("CodeList", null, new { rows = "20", cols = "80", @class = "codebox", id = "asm_code" }) - - - <label>Instruction Set</label> - <select name="langs" id="langs"></select> - <input type="button" name="CodeList" value="Assemble" onclick="AssembleCode()" /> - <input type="button" value="Load from File" onclick="openFromFile()" /> - </form> - <br /> - <br /> - </div> - <div class="column2"> - <h3>Binary</h3> - <br /> - - @using (Html.BeginForm()) - { - @Html.TextArea("bin_code", null, new { rows = "20", cols = "80", @class = "codebox", id = "bin_code" }) - <input type="button" value="Save" onclick="saveToFile()"/> - } - </div> -</div> -<br /> -<div class="row"> - <div class="column1"> - <h4>Assembler Output</h4> - <code class="assembler-out" id="assembler-out"><br /></code> - </div> - <div>@*This blank div is req to trick the row::after or else the margins get screwed up*@</div> -</div> - - diff --git a/SAP1EMU.WebApp/Views/Home/Emulator.cshtml b/SAP1EMU.WebApp/Views/Home/Emulator.cshtml deleted file mode 100644 index 49cbae33..00000000 --- a/SAP1EMU.WebApp/Views/Home/Emulator.cshtml +++ /dev/null @@ -1,59 +0,0 @@ -<script src="/js/CodeMirror/lib/codemirror.js"></script> -<script src="/js/CodeMirror/mode/gas/gas_sap1.js" type="text/javascript"></script> -<link href="/js/CodeMirror/lib/codemirror.css" rel="stylesheet" type="text/css" /> - -<script src="/lib/jquery/dist/jquery.js" type="text/javascript"></script> -<script src="/js/Views/EmulatorView.js" type="text/javascript"></script> - -@{ - ViewData["Title"] = "Emulator"; -} - -<h1>Emulator</h1> - -<div class="row"> - <div class="column2"> - <h3>Assembly</h3> - <br /> - - <form id="asm_form" method="post" action="AssembleCode"> - @Html.TextArea("CodeList", null, new { rows = "20", cols = "80", @class = "codebox", id = "asm_code" }) - <input type="button" name="CodeList" value="Assemble" onclick="AssembleCode(this)" /> - <input type="button" value="Load from File" /> - </form> - <br /> - <br /> - </div> - <div class="column2"> - <div class="vbox_sap"> - <div> - <h3>SAP1</h3> - </div> - <div class="hbox_sap"> - <div> - <h3>RAM</h3> - @Html.TextArea("ram_dump", null, new { rows = "16", cols = "20", @class = "codebox", id = "ram_dump" }) - </div> - <div vbox_sap> - <div> - <h3>Controls</h3> - <button></button> <button></button> <br /> - <button></button> <br /> - </div> - <div> - <h3>Flags</h3> - </div> - </div> - </div> - </div> - </div> - <br /> -</div> - -<div class="row"> - <div class="column1"> - <h4>Emulator Output</h4> - <code class="emulator-out" id="emulator-out"><br /></code> - </div> - <div>@*This blank div is req to trick the row::after or else the margins get screwed up*@</div> -</div> diff --git a/SAP1EMU.WebApp/Views/Home/Privacy.cshtml b/SAP1EMU.WebApp/Views/Home/Privacy.cshtml deleted file mode 100644 index d3683bbf..00000000 --- a/SAP1EMU.WebApp/Views/Home/Privacy.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -@{ - ViewData["Title"] = "Privacy Policy"; -} -<h1>@ViewData["Title"]</h1> - -<p> - This app, if downloaded from github.com/rbaker26/SAP1EMU, contains no telemetry or analytics, nor does it collect any user data, system data or network data. <br /> - It does not connect to any server, service, API, database or IP Address. <br /> - <br /> - If you downloaded this app from any other source, including repository forks, I cannot guarantee any of the above. <br /> - Please only download this app from the only approved repository, github.com/rbaker26/SAP1EMU/releases. -</p> diff --git a/SAP1EMU.WebApp/Views/_ViewImports.cshtml b/SAP1EMU.WebApp/Views/_ViewImports.cshtml deleted file mode 100644 index 7adab201..00000000 --- a/SAP1EMU.WebApp/Views/_ViewImports.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@using SAP1EMU.WebApp -@using SAP1EMU.WebApp.Models -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/SAP1EMU.WebApp/appsettings.Development.json b/SAP1EMU.WebApp/appsettings.Development.json deleted file mode 100644 index 8983e0fc..00000000 --- a/SAP1EMU.WebApp/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/SAP1EMU.WebApp/appsettings.json b/SAP1EMU.WebApp/appsettings.json deleted file mode 100644 index d9d9a9bf..00000000 --- a/SAP1EMU.WebApp/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" -} diff --git a/SAP1EMU.WebApp/electron.manifest.json b/SAP1EMU.WebApp/electron.manifest.json deleted file mode 100644 index f22a742e..00000000 --- a/SAP1EMU.WebApp/electron.manifest.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "executable": "SAP1EMU.WebApp", - "splashscreen": { - "imageFile": "" - }, - "singleInstance": false, - "build": { - "appId": "com.SAP1EMU.WebApp.app", - "productName": "SAP1EMU.WebApp", - "copyright": "Copyright © 2019", - "buildVersion": "1.14.0", - "compression": "maximum", - "directories": { - "output": "../../../bin/Desktop" - }, - "extraResources": [ - { - "from": "./bin", - "to": "bin", - "filter": ["**/*"] - } - ], - "files": [ - { - "from": "./ElectronHostHook/node_modules", - "to": "ElectronHostHook/node_modules", - "filter": ["**/*"] - }, - "**/*" - ] - } -} \ No newline at end of file diff --git a/SAP1EMU.WebApp/libman.json b/SAP1EMU.WebApp/libman.json deleted file mode 100644 index f2cbfbbd..00000000 --- a/SAP1EMU.WebApp/libman.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1.0", - "defaultProvider": "cdnjs", - "libraries": [ - { - "provider": "unpkg", - "library": "jquery-ajax-unobtrusive@3.2.6", - "destination": "wwwroot/lib/jquery-ajax-unobtrusive/" - } - ] -} \ No newline at end of file diff --git a/SAP1EMU.WebApp/wwwroot/css/site.css b/SAP1EMU.WebApp/wwwroot/css/site.css deleted file mode 100644 index f9d4299c..00000000 --- a/SAP1EMU.WebApp/wwwroot/css/site.css +++ /dev/null @@ -1,141 +0,0 @@ -/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification -for details on configuring this project to bundle and minify static web assets. */ - -a.navbar-brand { - white-space: normal; - text-align: center; - word-break: break-all; -} - -/* Provide sufficient contrast against white background */ -a { - color: #0366d6; -} - -.btn-primary { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; -} - -.nav-pills .nav-link.active, .nav-pills .show > .nav-link { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; -} - -/* Sticky footer styles --------------------------------------------------- */ -html { - font-size: 14px; -} -@media (min-width: 768px) { - html { - font-size: 16px; - } -} - -.border-top { - border-top: 1px solid #e5e5e5; -} -.border-bottom { - border-bottom: 1px solid #e5e5e5; -} - -.box-shadow { - box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); -} - -button.accept-policy { - font-size: 1rem; - line-height: inherit; -} - -/* Sticky footer styles --------------------------------------------------- */ -html { - position: relative; - min-height: 100%; -} - -body { - /* Margin bottom by footer height */ - margin-bottom: 60px; -} -.footer { - position: absolute; - bottom: 0; - width: 100%; - white-space: nowrap; - line-height: 60px; /* Vertically center the text there */ -} - - - - -/* For Columns in Pages*/ -.column3 { - float: left; - width: 32%; - border: 1px solid #a39898; - padding: 8px; - margin: 5px; -} -.column2 { - float: left; - width: 49%; - - border: 1px solid #a39898; - padding: 8px; - margin: 5px; -} - -.column1 { - float: left; - width: 99%; - border: 1px solid #a39898; - padding: 8px; - margin: 5px; -} - -/* Clear floats after the columns */ -.row:after { - margin: auto; - width: 100%; - content: ""; - display: table; - clear: both; - align-content: center; - align-items: center; -} - - - -.button { - background-color: #A39898; /* Green */ - border: none; - color: white; - padding: 15px 28px; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; -} - -.assembler-out{ - -} - -.vbox_sap { - display: flex; - flex-direction: column; -} - -.hbox_sap { - display: flex; - flex-direction: row; -} - -.profile-pic { - max-width: 50%; -} diff --git a/SAP1EMU.WebApp/wwwroot/favicon.ico b/SAP1EMU.WebApp/wwwroot/favicon.ico deleted file mode 100644 index a3a79998..00000000 Binary files a/SAP1EMU.WebApp/wwwroot/favicon.ico and /dev/null differ diff --git a/SAP1EMU.WebApp/wwwroot/js/Views/EmulatorView.js b/SAP1EMU.WebApp/wwwroot/js/Views/EmulatorView.js deleted file mode 100644 index adfc5af3..00000000 --- a/SAP1EMU.WebApp/wwwroot/js/Views/EmulatorView.js +++ /dev/null @@ -1,22 +0,0 @@ -var asm_editor; -var ram_dump; - -window.onload = function () { - asm_editor = CodeMirror.fromTextArea(document.getElementById("asm_code"), { - lineNumbers: true, - matchBrackets: true, - mode: { name: "gas_sap1", architecture: "x86" }, - }); - - ram_dump = CodeMirror.fromTextArea(document.getElementById("ram_dump"), { - lineNumbers: true, - matchBrackets: true, - mode: { name: "gas_sap1", architecture: "x86" }, - readOnly: true, - firstLineNumber: 0, - lineNumberFormatter: function (line) { return "0x" + line.toString(16).toLocaleUpperCase();}, - }); - - // Init RAM Box - ram_dump.setValue("0000 0000\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); -} \ No newline at end of file diff --git a/SAP1EMU.WebApp/wwwroot/js/site.js b/SAP1EMU.WebApp/wwwroot/js/site.js deleted file mode 100644 index f097ffee..00000000 --- a/SAP1EMU.WebApp/wwwroot/js/site.js +++ /dev/null @@ -1,5 +0,0 @@ -// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification -// for details on configuring this project to bundle and minify static web assets. - -// Write your JavaScript code. - diff --git a/SAP1EMU.sln b/SAP1EMU.sln index dc0331fb..ba9bf44f 100644 --- a/SAP1EMU.sln +++ b/SAP1EMU.sln @@ -9,17 +9,23 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Lib.Test", "SAP1EMU EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Engine", "SAP1EMU.Engine\SAP1EMU.Engine.csproj", "{B1680C97-D8B2-480C-852D-FB82686D5CF5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Assembler-CLI", "SAP1EMU.Assembler-CLI\SAP1EMU.Assembler-CLI.csproj", "{99A4A7B4-B3B7-47D7-AF77-7DEACFEBDA5D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Assembler", "SAP1EMU.Assembler\SAP1EMU.Assembler.csproj", "{46053099-4CB0-487B-8BF9-121FF7874329}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Engine-CLI", "SAP1EMU.Engine-CLI\SAP1EMU.Engine-CLI.csproj", "{3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F62A82B5-7BC1-430B-8E3B-A76E27724A49}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Sandbox", "SAP1EMU.Sandbox\SAP1EMU.Sandbox.csproj", "{7EFCC568-5814-4C2A-AC93-972E5835729D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.GUI", "SAP1EMU.GUI\SAP1EMU.GUI.csproj", "{1BE7AD93-45FD-48F5-825D-7F0C2BE30CD8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Assembler", "SAP1EMU.Assembler\SAP1EMU.Assembler.csproj", "{46053099-4CB0-487B-8BF9-121FF7874329}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.CLI", "SAP1EMU.CLI\SAP1EMU.CLI.csproj", "{8E9D5708-9E82-42B7-9897-A2A8051CB884}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F62A82B5-7BC1-430B-8E3B-A76E27724A49}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Engine.Test", "SAP1EMU.Engine.Test\SAP1EMU.Engine.Test.csproj", "{03C6CA2F-E613-4A98-B0D8-99228E9E6782}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Assembler.Test", "SAP1EMU.Assembler.Test\SAP1EMU.Assembler.Test.csproj", "{F441C02C-415D-4B3A-B10E-06BF9C4994A1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.CLI.Test", "SAP1EMU.CLI.Test\SAP1EMU.CLI.Test.csproj", "{26CDD026-0BF5-4DD0-B1B2-6D45C2DD06FB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.Benchmarks", "SAP1EMU.Benchmarks\SAP1EMU.Benchmarks.csproj", "{3924116E-911F-44ED-982B-6E767CDFBFC6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAP1EMU.WebApp", "SAP1EMU.WebApp\SAP1EMU.WebApp.csproj", "{28B1CC5D-C440-43E3-A812-17B0C29FB41C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SAP1EMU.GUI.Test", "SAP1EMU.GUI.TEST\SAP1EMU.GUI.Test.csproj", "{6784F992-F1D8-4260-9E54-FBE35325EE50}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -39,26 +45,38 @@ Global {B1680C97-D8B2-480C-852D-FB82686D5CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU {B1680C97-D8B2-480C-852D-FB82686D5CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU {B1680C97-D8B2-480C-852D-FB82686D5CF5}.Release|Any CPU.Build.0 = Release|Any CPU - {99A4A7B4-B3B7-47D7-AF77-7DEACFEBDA5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {99A4A7B4-B3B7-47D7-AF77-7DEACFEBDA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99A4A7B4-B3B7-47D7-AF77-7DEACFEBDA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {99A4A7B4-B3B7-47D7-AF77-7DEACFEBDA5D}.Release|Any CPU.Build.0 = Release|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3DB615A3-ADC4-4EF8-96D2-BF64668C2BB9}.Release|Any CPU.Build.0 = Release|Any CPU - {7EFCC568-5814-4C2A-AC93-972E5835729D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7EFCC568-5814-4C2A-AC93-972E5835729D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7EFCC568-5814-4C2A-AC93-972E5835729D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7EFCC568-5814-4C2A-AC93-972E5835729D}.Release|Any CPU.Build.0 = Release|Any CPU {46053099-4CB0-487B-8BF9-121FF7874329}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {46053099-4CB0-487B-8BF9-121FF7874329}.Debug|Any CPU.Build.0 = Debug|Any CPU {46053099-4CB0-487B-8BF9-121FF7874329}.Release|Any CPU.ActiveCfg = Release|Any CPU {46053099-4CB0-487B-8BF9-121FF7874329}.Release|Any CPU.Build.0 = Release|Any CPU - {28B1CC5D-C440-43E3-A812-17B0C29FB41C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {28B1CC5D-C440-43E3-A812-17B0C29FB41C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28B1CC5D-C440-43E3-A812-17B0C29FB41C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28B1CC5D-C440-43E3-A812-17B0C29FB41C}.Release|Any CPU.Build.0 = Release|Any CPU + {1BE7AD93-45FD-48F5-825D-7F0C2BE30CD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1BE7AD93-45FD-48F5-825D-7F0C2BE30CD8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1BE7AD93-45FD-48F5-825D-7F0C2BE30CD8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1BE7AD93-45FD-48F5-825D-7F0C2BE30CD8}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9D5708-9E82-42B7-9897-A2A8051CB884}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9D5708-9E82-42B7-9897-A2A8051CB884}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9D5708-9E82-42B7-9897-A2A8051CB884}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9D5708-9E82-42B7-9897-A2A8051CB884}.Release|Any CPU.Build.0 = Release|Any CPU + {03C6CA2F-E613-4A98-B0D8-99228E9E6782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03C6CA2F-E613-4A98-B0D8-99228E9E6782}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03C6CA2F-E613-4A98-B0D8-99228E9E6782}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03C6CA2F-E613-4A98-B0D8-99228E9E6782}.Release|Any CPU.Build.0 = Release|Any CPU + {F441C02C-415D-4B3A-B10E-06BF9C4994A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F441C02C-415D-4B3A-B10E-06BF9C4994A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F441C02C-415D-4B3A-B10E-06BF9C4994A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F441C02C-415D-4B3A-B10E-06BF9C4994A1}.Release|Any CPU.Build.0 = Release|Any CPU + {26CDD026-0BF5-4DD0-B1B2-6D45C2DD06FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26CDD026-0BF5-4DD0-B1B2-6D45C2DD06FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26CDD026-0BF5-4DD0-B1B2-6D45C2DD06FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26CDD026-0BF5-4DD0-B1B2-6D45C2DD06FB}.Release|Any CPU.Build.0 = Release|Any CPU + {3924116E-911F-44ED-982B-6E767CDFBFC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3924116E-911F-44ED-982B-6E767CDFBFC6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3924116E-911F-44ED-982B-6E767CDFBFC6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3924116E-911F-44ED-982B-6E767CDFBFC6}.Release|Any CPU.Build.0 = Release|Any CPU + {6784F992-F1D8-4260-9E54-FBE35325EE50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6784F992-F1D8-4260-9E54-FBE35325EE50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6784F992-F1D8-4260-9E54-FBE35325EE50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6784F992-F1D8-4260-9E54-FBE35325EE50}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test_install/overflow_test_1.b b/test_install/overflow_test_1.b deleted file mode 100644 index d346c60b..00000000 --- a/test_install/overflow_test_1.b +++ /dev/null @@ -1,16 +0,0 @@ -00001111 -00011110 -11100000 -11110000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000010 -11111111 diff --git a/test_install/run_test.bat b/test_install/run_test.bat deleted file mode 100644 index f61630e8..00000000 --- a/test_install/run_test.bat +++ /dev/null @@ -1,2 +0,0 @@ -SAP1Emu.exe -s overflow_test_1.b -type a.out \ No newline at end of file diff --git a/test_install/test.bat b/test_install/test.bat deleted file mode 100644 index 1a84c323..00000000 --- a/test_install/test.bat +++ /dev/null @@ -1 +0,0 @@ -echo \ No newline at end of file diff --git a/test_install/test.sh b/test_install/test.sh deleted file mode 100644 index 040dd21c..00000000 --- a/test_install/test.sh +++ /dev/null @@ -1 +0,0 @@ -cat Hello \ No newline at end of file diff --git a/test_install/test_asm.s b/test_install/test_asm.s deleted file mode 100644 index 9493a688..00000000 --- a/test_install/test_asm.s +++ /dev/null @@ -1,9 +0,0 @@ -LDA 0xD -ADD 0xE -ADD 0xF -OUT 0x0 -HLT 0x0 -... -0x2 0x8 -0x0 0xF -0x0 0xD \ No newline at end of file diff --git a/test_install/test_bin.b b/test_install/test_bin.b deleted file mode 100644 index 01b89307..00000000 --- a/test_install/test_bin.b +++ /dev/null @@ -1,16 +0,0 @@ -00001111 -00011110 -11100000 -11110000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000010 -11111111 \ No newline at end of file