rewrite, its now a vm for a shitty subset of assembly

This commit is contained in:
2026-09-09 00:45:52 -05:00
parent d261a49213
commit a71d73e19d
76 changed files with 703 additions and 99 deletions
+4
View File
@@ -37,6 +37,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="SDL2-CS, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ppy.SDL2-CS.1.0.82\lib\netstandard2.0\SDL2-CS.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -51,6 +54,7 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj">
+19 -9
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Core;
@@ -10,19 +11,28 @@ namespace MathApp
{
static void Main(string[] args)
{
Operations ops = new Operations();
Console.WriteLine("[MathLogger] System started!");
while (true)
string contents;
if (args.Length > 0)
{
Console.WriteLine("[Input] Enter an equation, using the QuikMath format: ");
string ipt = Console.ReadLine();
if (ipt != "")
contents = File.ReadAllText(args[1]);
DebugDumper.GenerateDumpFile(contents, args[1] + "dump");
}
else
{
if (File.Exists("main.asm"))
{
float ot;
ot = ops.EquParserLoop(ipt);
Console.WriteLine($"[ValueOutBuffer] Result: {ot.ToString()}");
contents = File.ReadAllText("main.asm");
DebugDumper.GenerateDumpFile(contents, "main.asmdump");
}
else
{
contents = "";
}
}
Operations ops = new Operations(409600);
Console.WriteLine("[ASM] System started!");
ops.EquParserLoop(contents);
}
}
}
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<dllmap dll="SDL2" os="windows" target="SDL2.dll"/>
<dllmap dll="SDL2" os="osx" target="libSDL2.dylib"/>
<dllmap dll="SDL2" os="linux" target="libSDL2-2.0.so.0"/>
</configuration>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+25
View File
@@ -0,0 +1,25 @@
[0] :: variables
[1] NVAR var1, 12 :: Create 'var1' with value of '12'
[2] NVAR var2, 10 :: Create 'var2' with value of '10'
[3] NVAR outcome, 0 :: Create 'outcome' with value of '0'
[4] JMP 8 :: Jump to line 8
[5]
[6]
[7] :: setup
[8] SEA var1 :: Set Accumulator to 'var1' (12)
[9] LDX :: Load Accumulator (12) into X
[10] SEA var2 :: Set Accumulator to 'var2' (10)
[11] LDY :: Load Accumulator (10) into Y
[12] ADD :: Add X (12) and Y (10) and store into the Accumulator (22)
[13] SVAR outcome, ACC :: Set variable 'outcome' to '0'
[14] SEA outcome :: Set Accumulator to 'outcome' (0)
[15] STA 4 :: Store the Accumulator (0) into Memory address 4
[16] PRM 4 :: Print value of memory address 4
[17] JMP 21 :: Jump to line 21
[18]
[19]
[20] :: end
[21] RVAR var1 :: Remove variable 'var1'
[22] RVAR var2 :: Remove variable 'var2'
[23] RVAR outcome :: Remove variable 'outcome'
[24] HLT :: Halt execution
+25
View File
@@ -0,0 +1,25 @@
:: variables
NVAR var1, 12
NVAR var2, 10
NVAR outcome, 0
JMP 8
:: setup
SEA var1
LDX
SEA var2
LDY
ADD
SVAR outcome, ACC
SEA outcome
STA 4
PRM 4
JMP 21
:: end
RVAR var1
RVAR var2
RVAR outcome
HLT
+25
View File
@@ -0,0 +1,25 @@
[0] :: variables
[1] NVAR var1, 12 :: Create 'var1' with value of '12'
[2] NVAR var2, 10 :: Create 'var2' with value of '10'
[3] NVAR outcome, 0 :: Create 'outcome' with value of '0'
[4] JMP 8 :: Jump to line 8
[5]
[6]
[7] :: setup
[8] SEA var1 :: Set Accumulator to 'var1' (12)
[9] LDX :: Load Accumulator (12) into X
[10] SEA var2 :: Set Accumulator to 'var2' (10)
[11] LDY :: Load Accumulator (10) into Y
[12] ADD :: Add X (12) and Y (10) and store into the Accumulator (22)
[13] SVAR outcome, ACC :: Set variable 'outcome' to '0'
[14] SEA outcome :: Set Accumulator to 'outcome' (0)
[15] STA 4 :: Store the Accumulator (0) into Memory address 4
[16] PRM 4 :: Print value of memory address 4
[17] JMP 21 :: Jump to line 21
[18]
[19]
[20] :: end
[21] RVAR var1 :: Remove variable 'var1'
[22] RVAR var2 :: Remove variable 'var2'
[23] RVAR outcome :: Remove variable 'outcome'
[24] HLT :: Halt execution
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<dllmap dll="SDL2" os="windows" target="SDL2.dll"/>
<dllmap dll="SDL2" os="osx" target="libSDL2.dylib"/>
<dllmap dll="SDL2" os="linux" target="libSDL2-2.0.so.0"/>
</configuration>
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
Binary file not shown.
Binary file not shown.
+38
View File
@@ -0,0 +1,38 @@
:: Registers
Accumulator (A-Register)
X, Y registers
Memory (8kb)
:: Flags
Z; Zero
:: Helpers
NVAR <name>, <value>; Sets new a variable and its value
RVAR <name>; Removes a variable
SVAR <name>, <newval>; Sets a variables value
:: Commands (Memory)
LDA <address>; Loads a memory value into ram
STA <address>; Seeks to a memory value into the accumulator
LDX; Loads accumulator into X
LDY; Loads accumulator into Y
STX; Stores X into accumulator
STY; Stores Y into accumulator
SEA <value>; Sets accumulator
:: Commands (Arithmetic)
ADD; Adds X + Y then stores in Accumulator
SUB; Subtracts X - Y then stores in Accumulator
MUL; Multiplies X * Y then stores in Accumulator
DIV; Divides X / Y then stores in Accumulator
:: Commands (flow control)
JZE <pointer>; Jumps to a pointer in the program on zero flag
JMP <pointer>; Jumps to a pointer in the program
SFG <flag>; Sets a flag to true
RFG <flag; Sets a flag to false
:: Commands (Debug)
PRA; Prints accumulator
PRX; Prints X
PRY; Prints Y
PRM <address>; Prints value of memory address
+25
View File
@@ -0,0 +1,25 @@
:: variables
NVAR var1, 12
NVAR var2, 10
NVAR outcome, 0
JMP 8
:: setup
SEA var1
LDX
SEA var2
LDY
ADD
SVAR outcome, ACC
SEA outcome
STA 4
PRM 4
JMP 21
:: end
RVAR var1
RVAR var2
RVAR outcome
HLT
+25
View File
@@ -0,0 +1,25 @@
[0] :: variables
[1] NVAR var1, 12 :: Create 'var1' with value of '12'
[2] NVAR var2, 10 :: Create 'var2' with value of '10'
[3] NVAR outcome, 0 :: Create 'outcome' with value of '0'
[4] JMP 8 :: Jump to line 8
[5]
[6]
[7] :: setup
[8] SEA var1 :: Set Accumulator to 'var1' (12)
[9] LDX :: Load Accumulator (12) into X
[10] SEA var2 :: Set Accumulator to 'var2' (10)
[11] LDY :: Load Accumulator (10) into Y
[12] ADD :: Add X (12) and Y (10) and store into the Accumulator (22)
[13] SVAR outcome, ACC :: Set variable 'outcome' to '0'
[14] SEA outcome :: Set Accumulator to 'outcome' (0)
[15] STA 4 :: Store the Accumulator (0) into Memory address 4
[16] PRM 4 :: Print value of memory address 4
[17] JMP 21 :: Jump to line 21
[18]
[19]
[20] :: end
[21] RVAR var1 :: Remove variable 'var1'
[22] RVAR var2 :: Remove variable 'var2'
[23] RVAR outcome :: Remove variable 'outcome'
[24] HLT :: Halt execution
+2
View File
@@ -0,0 +1,2 @@
:: variables
NVAR
@@ -1 +1 @@
1228403c1cd362b89850b9015f815de0e7abf92f5255368036881f393c4b8087
6e19822cf9df8a3348f7b52adfa331baa8ea4458cbec56a5f3fa3f63bc1a6672
@@ -8,3 +8,15 @@ C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.CoreCompileI
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.Up2Date
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.exe
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.pdb
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Debug\MathLib.exe.config
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Debug\MathLib.exe
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Debug\MathLib.pdb
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Debug\Core.dll
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Debug\Core.pdb
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.AssemblyReference.cache
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.CoreCompileInputs.cache
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.Up2Date
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Debug\MathLib.exe
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Debug\MathLib.pdb
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Debug\SDL2-CS.dll
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Debug\Core.dll.config
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
@@ -0,0 +1 @@
a24e99afbd0184c9d42463bdac684c104fe14a1a663327ec61411ec480f74cbd
@@ -0,0 +1,12 @@
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Release\MathLib.exe.config
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Release\MathLib.exe
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Release\MathLib.pdb
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Release\Core.dll
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Release\SDL2-CS.dll
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Release\Core.pdb
C:\Users\Madeline McWhorter\MathApp\MathLib\bin\Release\Core.dll.config
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Release\MathLib.csproj.AssemblyReference.cache
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Release\MathLib.csproj.CoreCompileInputs.cache
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Release\MathLib.csproj.Up2Date
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Release\MathLib.exe
C:\Users\Madeline McWhorter\MathApp\MathLib\obj\x86\Release\MathLib.pdb
Binary file not shown.
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ppy.SDL2-CS" version="1.0.82" targetFramework="net48" />
</packages>