rewrite, its now a vm for a shitty subset of assembly
This commit is contained in:
Binary file not shown.
@@ -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.
@@ -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.
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
:: variables
|
||||
NVAR
|
||||
Reference in New Issue
Block a user