SoaS VM

From Doomguy0505

Jump to: navigation, search

Contents

About

SoaS VM is a virtual machine made in C++. It has a built-in assembly language (see below).

Opcodes

This is how it works (You cannot directly write first gen assembly). It attempts to use minimal opcodes.

OPCODE FLAGS [DATA1, DATA2, ...]

0
Common Alias: CMEM
Description: Creates a memory space in the stack
ARGS: None
1
Common Alias: FMEM
Description: Frees memory from the stack
ARGS: flag data
Flags
1 - Use variable instead of constant
2
Common Alias: AMEM
Description: Allocate memory for use
ARGS: flag data
Flags
1 - Use variable instead of constant
3
Common Alias: SMEM_I
Description: Set floating-point memory
ARGS: flag var source
Flags
1 - Use variable instead of constant for var
2 - Use variable instead of constant for source
4
Common Alias: SMEM_S
Description: Set string memory
ARGS: flag var source
Flags
1 - Use variable instead of constant for var
2 - Use variable instead of constant for source
4 - Source is another variable or else it is taken from the string table
5
Common Alias: CTBL
Description: Creates memory space in string table
ARGS: None
6
Common Alias: STBL
Description: Set memory in string table, only command that takes constant strings
ARGS: flag index "data"
Flags
1 - Use variable instead of constant for index
2 - Source is another variable or else it is taken from the string table
4 - Use variable instead of constant for data
7
Common Alias: ECHO
Description: Prints data on the screen
ARGS: flag data
Flags
1 - Use variable instead of constant for data index
2 - Print variable data
4 - Print string table data
8 - Print the data
8
Common Alias: MATH
Description: Does a mathematical operation
ARGS: flag store var1 var2
Flags
1 - Use variable instead of constant for store
2 - Use variable instead of constant for var1
4 - Use variable instead of constant for var2
8 - store = var1 + var2
16 - store = var1 - var2
32 - store = var1 * var2
64 - store = var1 / var2
128 - store = var1 Xor var2 (XOR)
256 - store = var1 ^ var2 (POWER OF)
512 - store = var1 % var2 (MODULUS/REMAINDER)
9
Common Alias: BOOL
Description: Does a boolean expression
ARGS: flag store var1 var2
Flags
1 - Use variable instead of constant for store
2 - Use variable instead of constant for var1
4 - Use variable instead of constant for var2
8 - store = var1 | var2 (OR)
16 - store = var1 & var2 (AND)
32 - store = var1 != var2
64 - store = var1 == var2
128 - store = var1 > var2
256 - store = var1 < var2
512 - store = var1 >= var2
1024 - store = var1 <= var2
10
Common Alias: CONCAT
Description: Joins var1 with var2
ARGS: flag store var1 var2
Flags
1 - Use variable instead of constant for store
2 - Use variable instead of constant for var1
4 - Use variable instead of constant for var2
8 - Use variable string instead of string table for var1
16 - Use variable string instead of string table for var2
11
Common Alias: STRBOOL
Description: Do string logic
ARGS: flag store var1 var2
Flags
1 - Use variable instead of constant for store
2 - Use variable instead of constant for var1
4 - Use variable instead of constant for var2
8 - Use variable string instead of string table for var1
16 - Use variable string instead of string table for var2
32 - store = var1 == var2
64 - store = var1 != var2
128 - store = var1 > var2, but combining it with 512 will make it >=
256 - store = var1 < var2, but combining it with 512 will make it <=
12
Common Alias: IF
Description: Do an if statement, it will skip or goto the line if the expression is false, depending on what flags are used
ARGS: flag expression linecount
Flags
1 - Use variable instead of constant for expression
2 - Skip instead of goto
4 - Use variable instead of constant for linecount
13
Common Alias: LINE
Description: Prints a new line on the screen
ARGS: None
14
Common Alias: GOTO
Description: Skips/Gotos a line depending on what flags are used
ARGS: flag linecount
Flags
1 - Use variable instead of constant for linecount
2 - Skip instead of goto
15
Common Alias: CIN
Description: Allows the user to type in the console, which is written to variable var
ARGS: flag var
Flags
1 - Use variable instead of constant for var
16
Common Alias: SUBSTR
Description: Gets a part of a string, if length is -1, then it will read to the end of the string
ARGS: flag store string start length
1 - Use variable instead of constant for store
2 - Use variable instead of constant for string
4 - Use variable instead of constant for start
8 - Use variable instead of constant for length
32
Common Alias:

Assembly Language

The assembly language, called SoASM, is used to create applications in SoaS VM.

Here is a hello world program:

#!/bin/soasvm

# Use human readable aliases
INCLUDE common.sas

# Create a spot in the string table
CTBL RAW

# Set string 0 to "Hello, world!"
STBL 0 0 "Hello, world!"

# Echo string 0
ECHO 4 0

Here is the optimized version

5 0

6 0 0 "Hello, world!"

7 4 0

BASIC

There is also a translated programming language called SoaS BASIC. It makes programming much easier in SoaS.

SoaS BASIC Commands

ASM

  • Valid Commands: ASM
  • Description: Directly insert assembly code
  • Usage: ASM asmcode

Example:

ASM INCLUDE common.sas
ASM CTBL RAW
ASM STBL 0 0 "Hello, world!"
ASM ECHO 4 0

DIM

  • Valid Commands: DIM, VAR
  • Description: Declares a variable
  • Usage: DIM VARNAME [, VARNAME2, VARNAME3, ...]

Example:

DIM BOBSCAPE, RUNESCAPE

ARRAY

  • Valid Commands: ARRAY, DIM-ARRAY
  • Description: Declares an array
  • Usage: ARRAY ARRNAME [, ARRNAME2, ARRNAME3, ...]

Example

ARRAY JO_MAMA, JO_PAPA

MODIFY-ARRAY

  • Valid Commands: MODIFY-ARRAY
  • Description: Modifies an array element
  • Usage: MODIFY-ARRAY array-name subscript data

Example


Personal tools

sl
דומיין בעברית  דומיין  דומין  תוכנה לניהול  קשרי לקוחות  CRM, ניהול קשרי לקוחות  דומין בעברית  פורומים  ספרדית  גיבוי