Code | Info |
//[Comment] | Ignored |
:<tag_name> | Tag |
Stack |
PUSH <stack> <value> | Push value or top value from second stack to first stack |
POP <stack> | Pop value from first stack |
COPY <stack> <stack> | Push top value from second stack to first stack |
Instruction pointer and conditions |
JMP <tag_name> | Jump to label |
JZ <stack> <tag_name> | If Zero |
JNZ <stack> <tag_name> | If Non-Zero |
JN <stack> <tag_name> | If Negative |
IO |
READ <stack> | Read value and push it to stack |
READCHAR <stack> | Read character and push it to stack |
WRITE <value> | Write value |
WRITECHAR <value> | Write character |
Arithmetic |
ADD <stack> | Add the two top values ([1] + [0]) from stack, pop both, and push result |
SUB <stack> | Substract the two top values ([1] - [0]) from stack, pop both, and push result |
MUL <stack> | Multiply the two top values ([1] * [0]) from stack, pop both, and push result |
DIV <stack> | Divide the two top values ([1] / [0]) from stack, pop both, and push result |
MOD <stack> | Divide the two top values ([1] % [0]) from stack, pop both, and push remainder |
Call stack |
CALL <tag_name> | Push instruction direction to the call stack and jump to tag |
RET | Pop the call stack and jump to that direction (If stack is empty, finishes the program |