[][src]Module reustmann::instruction

Instruction Set Summary

These are the opcodes of the Reustmann instruction set, shown with their single-character mnemonics and long mnemonics.

System and stack

;       NOP     No-operation
R       RESET   Reset
H       HALT    Halt program execution
I       IN      Input from stdin
O       OUT     Output to stdout
p       POP     Pop the stack
D       DUP     Duplicate the top of the stack
C       PUSHPC  Push the current PC
c       POPPC   Pop the stack and set PC
Y       POPSP   Pop the stack and set SP
G       SPTGT   Set the SP to the next TARGET
P       PUSHNZ  Push the NZ flag
S       SWAP    Swap the top two stacked words

Math and logic

0       PUSH0   Push a zero onto the stack
+       ADD     Add the top two stacked words
-       SUB     Subract the top two stacked words
.       INC     Increment the top of the stack
,       DEC     Decrement the top of the stack
*       MUL     Multiply the top two stacked words
/       DIV     Divide the top two stacked words
^       XOR     Bitwise exclusive OR
&       AND     Bitwise logical AND
|       OR      Bitwise logical OR
(       SHL     Logical shift left the top stacked word
)       SHR     Logical shift right the top stacked word
~       NOT     Bitwise invert the top stacked word

Conditionals

Z       BZ      Branch on zero
z       BNZ     Branch on not-zero
=       BEQ     Branch on equal
>       BGT     Branch on greater than
{       BLT     Branch on less than
}       BGE     Branch on greater or equal

Unconditionals

L       LOOP    Loop until the following ENDL
]       ENDL    End of LOOP
B       BRAN    Branch to next TARGET opcode
b       BRAP    Branch to previous TARGET opcode
T       TARGET  Branch target for BRAN, BRAP
1       SKIP1   Skip over the next instruction
2       SKIP2   Skip over the next two instructions
3       SKIP3   Skip over the next three instructions
4       SKIP4   Skip over the next four instructions
5       SKIP5   Skip over the next five instructions
6       SKIP6   Skip over the next six instructions
7       SKIP7   Skip over the next seven instructions
8       SKIP8   Skip over the next eight instructions
9       SKIP9   Skip over the next nine instructions

Re-exports

pub use self::op_codes::OpCode;
pub use self::mnemonics::Mnemonic;
pub use self::long_mnemonics::LongMnemonic;

Modules

long_mnemonics
mnemonics
op_codes

Enums

Instruction

These are the opcodes of the Reustmann instruction set, shown with their single-character mnemonics and long mnemonics.

Functions

is_valid_mnemonic

Check if a op_code is a direct command or will be interpreted as NOP

is_valid_op_code

Check if a op_code is a direct command or will be interpreted as NOP