Skip to content

OASM ‐ Origin Transpiled Assembly

Mistium edited this page May 15, 2024 · 2 revisions

This version is exclusive to originOS and the OASM extension (found here), and allows for high level usage of fast scratch code, through the use of oasm transpiling.

All places you would normally put a variable can now be replaced with any static data you want without needing to define new variables manually for every small change in static data you make.

variables

varname = data - set the variable at the var int

varname += data - set var1 to var1 + var2

varname -= data - set var1 to var1 - var2

varname *= data - set var1 to var1 * var2

varname /= data - set var1 to var1 / var2

varname %= data - set var1 to var1 % var2

math.sqrt var - set var to the square root of itself

math.sin var - set var to the sine of itself

math.cos var - set var to the cosine of itself

math.tan var - set var to the tangent of itself

strings

strings.length var var2 - finds the length of the data in var1 and sets var2 to the result

strings.letter var1 var2 out_var - finds the letter at the var in var1 of var2 and sets out_var to the result

var = 2
string = hello!
strings.letter var string out
print out

The above code would return "e"

strings.join var1 var2 out_var - joins var1 and var2 and sets out_var to the result

jumps

:name - creates a label that can be jumped to

jump label - always jump to a line no matter what

if var1 > var2 label if the data in the var at var1 is greater than the data in the var at var2, jump to line

if var1 < var2 label if the data in the var at var1 is less than the data in the var at var2, jump to line

if var1 = var2 label if the data in the var at var1 is equal to the data in the var at var2, jump to line

if var1 !> var2 label if the data in the var at var1 is not greater than the data in the var at var2, jump to line (equivalent to less than or equal)

if var1 !< var2 label if the data in the var at var1 is not less than the data in the var at var2, jump to line (equivalent to greater than or equal)

rendering

pen.down - places the pen on the canvas

pen.up - lifts the pen from the canvas

pen.clearall - clears the canvas

pen.color var1 - sets the pen colour to a variable var (supports hex codes)

pen.size var1 - sets the pen size to a variable var

pen.setx var1 - makes the pen go to a x position at a variable var

pen.sety var1 - makes the pen go to a y position at a variable var

pen.goto var1 var2 - set position (makes the pen go to a x,y position)

input

mouse.position var1 var2 - puts the mousex and mousey into var1 and var2 respectively

mouse.click var1 - puts whether the mouse left button is down into var 1 (value of 1 if mouse down, value of 0 if mouse up)

data.line var1 - puts the current line number into the variable you pass it

now.timer var1 - puts the time since originOS was booted into the variable you selected

now.timestamp var1 - puts the current timestamp into the variable you selected

input.keypress key_a var1 - puts whether the a key is pressed into var1 (value of 1 if key pressed, value of 0 if key not pressed)
^^ this works with any key

output

print var/data - print the data in a variable to console

originOS Wiki

Wiki Views: :views


OSL | OTS | ICN | OASM

Clone this wiki locally