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
+24 -5
View File
@@ -5,12 +5,31 @@ using System.Text;
namespace Core
{
// instruction set framework
public enum ComponentType
{
EQ_ADD,
EQ_SUB,
EQ_DIV,
EQ_MUL,
QZ_VAR
NVAR, // Sets a variable and its value
RVAR, // Removes a variable
SVAR, // Sets a variables value
LDA, // Loads a memory value into ram
STA, // 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, // Sets accumulator
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
JZE, // Jumps to a pointer in the program on zero flag
JMP, // Jumps to a pointer in the program
SFG, // Sets a flag to true
RFG, // Sets a flag to false
PRA, // Prints accumulator
PRX, // Prints X
PRY, // Prints Y
PRM, // Prints value of memory address
HLT // Halts execution
}
}
+11 -1
View File
@@ -34,6 +34,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" />
@@ -44,11 +47,18 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ComponentType.cs" />
<Compile Include="IEquationComponent.cs" />
<Compile Include="DebugDumper.cs" />
<Compile Include="Operations.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Registrate.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Doc.txt" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
+148
View File
@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
public class DebugDumper
{
public static void GenerateDumpFile(string asmCode, string outputPath)
{
string[] lines = asmCode.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
StringBuilder dump = new StringBuilder();
Dictionary<string, int> variables = new Dictionary<string, int>();
int accumulator = 0;
int x = 0;
int y = 0;
for (int i = 0; i < lines.Length; i++)
{
string line = lines[i].Trim();
if (string.IsNullOrEmpty(line) || line.StartsWith("::"))
{
dump.AppendLine($"[{i}] {line}");
continue;
}
string[] tokens = line.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
if (tokens.Length == 0) continue;
string command = tokens[0].ToUpper();
string comment = "";
int ResolveValue(string val)
{
if (variables.ContainsKey(val)) return variables[val];
if (int.TryParse(val, out int num)) return num;
return 0;
}
switch (command)
{
// Variables
case "NVAR":
string newVar = tokens[1];
int newVal = ResolveValue(tokens[2]);
variables[newVar] = newVal;
comment = $"Create '{newVar}' with value of '{newVal}'";
break;
case "SVAR":
string setVar = tokens[1];
int setVal = ResolveValue(tokens[2]);
variables[setVar] = setVal;
comment = $"Set variable '{setVar}' to '{setVal}'";
break;
case "RVAR":
variables.Remove(tokens[1]);
comment = $"Remove variable '{tokens[1]}'";
break;
// Memory / Registers
case "LDA":
comment = $"Load memory address {tokens[1]} into Accumulator";
break;
case "STA":
comment = $"Store the Accumulator ({accumulator}) into Memory address {tokens[1]}";
break;
case "LDX":
x = accumulator;
comment = $"Load Accumulator ({accumulator}) into X";
break;
case "LDY":
y = accumulator;
comment = $"Load Accumulator ({accumulator}) into Y";
break;
case "STX":
accumulator = x;
comment = $"Store X ({x}) into Accumulator";
break;
case "STY":
accumulator = y;
comment = $"Store Y ({y}) into Accumulator";
break;
case "SEA":
int seaVal = ResolveValue(tokens[1]);
accumulator = seaVal;
// If they passed a variable name, show both the name and the value
if (variables.ContainsKey(tokens[1]))
comment = $"Set Accumulator to '{tokens[1]}' ({seaVal})";
else
comment = $"Set Accumulator to {seaVal}";
break;
// Arithmetic
case "ADD":
accumulator = x + y;
comment = $"Add X ({x}) and Y ({y}) and store into the Accumulator ({accumulator})";
break;
case "SUB":
accumulator = x - y;
comment = $"Subtract Y ({y}) from X ({x}) and store into the Accumulator ({accumulator})";
break;
case "MUL":
accumulator = x * y;
comment = $"Multiply X ({x}) and Y ({y}) and store into the Accumulator ({accumulator})";
break;
case "DIV":
if (y != 0) accumulator = x / y;
comment = $"Divide X ({x}) by Y ({y}) and store into the Accumulator ({accumulator})";
break;
// Flow Control
case "JZE":
comment = $"Jump to line {tokens[1]} if Zero flag is true";
break;
case "JMP":
comment = $"Jump to line {tokens[1]}";
break;
case "SFG":
comment = $"Set flag '{tokens[1]}' to true";
break;
case "RFG":
comment = $"Set flag '{tokens[1]}' to false";
break;
// Debug
case "PRA":
comment = $"Print Accumulator ({accumulator})";
break;
case "PRX":
comment = $"Print X ({x})";
break;
case "PRY":
comment = $"Print Y ({y})";
break;
case "PRM":
comment = $"Print value of memory address {tokens[1]}";
break;
case "HLT":
comment = "Halt execution";
break;
default:
comment = "Unknown command";
break;
}
dump.AppendLine($"[{i}] {line,-20} :: {comment}");
}
File.WriteAllText(outputPath, dump.ToString());
}
}
+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
-15
View File
@@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Core
{
interface IEquationComponent
{
ComponentType Type { get; set; }
string Arg1 { get; set; }
string Arg2 { get; set; }
void Operate();
}
}
+183 -63
View File
@@ -2,99 +2,219 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SDL2;
namespace Core
{
public class Operations
{
public Dictionary<string, float> Variables = new Dictionary<string, float>();
public Operations(int pixBufSize) => WindowSize = pixBufSize;
public Dictionary<string, int> Variables = new Dictionary<string, int>();
public static int WindowSize;
public int Accumulator = 0;
public int StackX = 0;
public int StackY = 0;
public int[] Memory = new int[256];
public string Filename;
public int pointer = 0;
public int[] PixBufferR = new int[WindowSize];
public int[] PixBufferG = new int[WindowSize];
public int[] PixBufferB = new int[WindowSize];
private float ResolveValue(string value)
private int ResolveValue(string shite)
{
// Checks if the value contains any letters
if (!value.Any(char.IsLetter))
if (shite.Any(char.IsLetter))
{
float.TryParse(value, out float result);
return result;
switch (shite)
{
case "ACC":
return Accumulator;
case "RAX":
return StackX;
case "RAY":
return StackY;
}
Variables.TryGetValue(shite, out int a);
return a;
}
else
{
Variables.TryGetValue(value, out float result);
return result;
int.TryParse(shite, out int a);
return a;
}
}
public float ExecuteCommand(ComponentType type, string val1, string val2)
public void ExecuteCommand(ComponentType type, string[] args)
{
switch (type)
{
default: return 2;
case ComponentType.EQ_ADD:
float a = ResolveValue(val1);
float b = ResolveValue(val2);
return a + b;
case ComponentType.EQ_SUB:
float aS = ResolveValue(val1);
float bS = ResolveValue(val2);
return aS - bS;
case ComponentType.EQ_MUL:
float aM = ResolveValue(val1);
float bM = ResolveValue(val2);
return aM * bM;
case ComponentType.EQ_DIV:
float aD = ResolveValue(val1);
float bD = ResolveValue(val2);
return aD / bD;
default: return;
// Variables
case ComponentType.NVAR:
string name = args[1];
int value = ResolveValue(args[2]);
Variables.Add(name, value);
return;
case ComponentType.RVAR:
string rname = args[1];
Variables.Remove(rname);
return;
case ComponentType.SVAR:
string sname = args[1];
int svalue = ResolveValue(args[2]);
Variables[sname] = svalue;
return;
case ComponentType.QZ_VAR:
float val = 0.0f;
float.TryParse(val2, out val);
if (Variables.ContainsKey(val1))
{
Variables[val1] = val;
}
else
{
Variables.Add(val1, val);
}
return val;
// Memory/stack shite
case ComponentType.LDA:
Accumulator = Memory[ResolveValue(args[1])];
return;
case ComponentType.STA:
Memory[ResolveValue(args[1])] = Accumulator;
return;
case ComponentType.LDX:
StackX = Accumulator;
return;
case ComponentType.LDY:
StackY = Accumulator;
return;
case ComponentType.STX:
Accumulator = StackX;
return;
case ComponentType.STY:
Accumulator = StackY;
return;
case ComponentType.SEA:
Accumulator = ResolveValue(args[1]);
return;
// flow control
case ComponentType.JMP:
pointer = ResolveValue(args[1]) - 1;
return;
// math
case ComponentType.ADD:
Accumulator = StackX + StackY;
return;
case ComponentType.SUB:
Accumulator = StackX - StackY;
return;
case ComponentType.MUL:
Accumulator = StackX * StackY;
return;
case ComponentType.DIV:
Accumulator = StackX / StackY;
return;
// Debug commands
case ComponentType.PRA:
Console.WriteLine(Accumulator);
return;
case ComponentType.PRX:
Console.WriteLine(StackX);
return;
case ComponentType.PRY:
Console.WriteLine(StackY);
return;
case ComponentType.PRM:
int.TryParse(args[1], out int valB);
Console.WriteLine(Memory[valB]);
return;
case ComponentType.HLT:
while (true) { }
}
}
public float EquParserLoop(string equ)
public void EquParserLoop(string equ)
{
if (equ != "")
string[] lines = equ.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
while (pointer < lines.Length)
{
string[] tokens = equ.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
if (tokens.Length >= 3)
string[] tokens = lines[pointer].Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
string command = tokens[0];
if (tokens.Length == 0)
{
string command = tokens[0]; // "ADD" or "VAR"
string val1 = tokens[1]; // "X"
string val2 = tokens[2]; // "0" or "10"
pointer++;
continue;
}
switch (command)
{
default: return 0;
default: break;
case "::":
break;
// variables
case "NVAR":
ExecuteCommand(ComponentType.NVAR, tokens);
break;
case "RVAR":
ExecuteCommand(ComponentType.RVAR, tokens);
break;
case "SVAR":
ExecuteCommand(ComponentType.SVAR, tokens);
break;
// memory
case "LDA":
ExecuteCommand(ComponentType.LDA, tokens);
break;
case "STA":
ExecuteCommand(ComponentType.STA, tokens);
break;
case "LDX":
ExecuteCommand(ComponentType.LDX, tokens);
break;
case "LDY":
ExecuteCommand(ComponentType.LDY, tokens);
break;
case "STX":
ExecuteCommand(ComponentType.STX, tokens);
break;
case "STY":
ExecuteCommand(ComponentType.STY, tokens);
break;
case "SEA":
ExecuteCommand(ComponentType.SEA, tokens);
break;
// flow control
case "JMP":
ExecuteCommand(ComponentType.JMP, tokens);
break;
// math
case "ADD":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_ADD, val1, val2);
case "SUB":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_SUB, val1, val2);
case "MUL":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_MUL, val1, val2);
case "DIV":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_DIV, val1, val2);
case "VAR":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.QZ_VAR, val1, val2);
ExecuteCommand(ComponentType.ADD, tokens);
break;
// debug
case "PRA":
ExecuteCommand(ComponentType.PRA, tokens);
break;
case "PRX":
ExecuteCommand(ComponentType.PRX, tokens);
break;
case "PRY":
ExecuteCommand(ComponentType.PRY, tokens);
break;
case "PRM":
ExecuteCommand(ComponentType.PRM, tokens);
break;
case "HLT":
ExecuteCommand(ComponentType.HLT, tokens);
break;
}
}
else { return 0; }
pointer++;
}
else { return 0; }
}
}
}
+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.
+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.
+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.
@@ -1 +1 @@
3e45e6502454303d51fd05c670a9d135872dffc387ca9c06751f794b9bdd86b7
7e4ab6ec30c119e58bb28285aaa45d2b6248630033dfbcb03f8acc446e1d573c
@@ -4,3 +4,12 @@ C:\Users\Administrator\MathApp\Core\obj\Debug\Core.csproj.AssemblyReference.cach
C:\Users\Administrator\MathApp\Core\obj\Debug\Core.csproj.CoreCompileInputs.cache
C:\Users\Administrator\MathApp\Core\obj\Debug\Core.dll
C:\Users\Administrator\MathApp\Core\obj\Debug\Core.pdb
C:\Users\Madeline McWhorter\MathApp\Core\bin\Debug\Core.dll
C:\Users\Madeline McWhorter\MathApp\Core\bin\Debug\Core.pdb
C:\Users\Madeline McWhorter\MathApp\Core\obj\Debug\Core.csproj.AssemblyReference.cache
C:\Users\Madeline McWhorter\MathApp\Core\obj\Debug\Core.csproj.CoreCompileInputs.cache
C:\Users\Madeline McWhorter\MathApp\Core\obj\Debug\Core.dll
C:\Users\Madeline McWhorter\MathApp\Core\obj\Debug\Core.pdb
C:\Users\Madeline McWhorter\MathApp\Core\bin\Debug\Core.dll.config
C:\Users\Madeline McWhorter\MathApp\Core\bin\Debug\SDL2-CS.dll
C:\Users\Madeline McWhorter\MathApp\Core\obj\Debug\Core.csproj.Up2Date
View File
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")]
Binary file not shown.
@@ -0,0 +1 @@
dff978b31ee0f611c31473c94227ce5c3488cadf15419a0b16703dd84b7a2775
@@ -0,0 +1,9 @@
C:\Users\Madeline McWhorter\MathApp\Core\bin\Release\Core.dll.config
C:\Users\Madeline McWhorter\MathApp\Core\bin\Release\Core.dll
C:\Users\Madeline McWhorter\MathApp\Core\bin\Release\Core.pdb
C:\Users\Madeline McWhorter\MathApp\Core\bin\Release\SDL2-CS.dll
C:\Users\Madeline McWhorter\MathApp\Core\obj\Release\Core.csproj.AssemblyReference.cache
C:\Users\Madeline McWhorter\MathApp\Core\obj\Release\Core.csproj.CoreCompileInputs.cache
C:\Users\Madeline McWhorter\MathApp\Core\obj\Release\Core.csproj.Up2Date
C:\Users\Madeline McWhorter\MathApp\Core\obj\Release\Core.dll
C:\Users\Madeline McWhorter\MathApp\Core\obj\Release\Core.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>
+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
{
float ot;
ot = ops.EquParserLoop(ipt);
Console.WriteLine($"[ValueOutBuffer] Result: {ot.ToString()}");
if (File.Exists("main.asm"))
{
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>
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>
@@ -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.
Binary file not shown.
Binary file not shown.
Binary file not shown.