NOTES

-stack refers to the data stack unless otherwise specified

-the last 4 instructions act as a sequence of pops that leave the stack empty or a sequence of pushes that don't remove pre-existing stack contents

NOP no operation

HALT halts the cpu until an interrupt is recieved

LOAD pops an address from the stack and pushes the value at that address onto the stack

STORE pops 2 values from the stack and stores the first value at the address specified by the second value

CONST pushes a constant onto the stack

IADD pops 2 integer values and pushes their sum onto the stack

ISUB pops 2 integer values and pushes their difference onto the stack

IMUL pops 2 integer values and pushes their product onto the stack

IDIV pops 2 integer values and pushes their quotient onto the stack

IMOD pops 2 integer values and pushes the modulus onto the stack

RADD pops 2 floating point values and pushes their sum onto the stack

RSUB pops 2 floating point values and pushes their difference onto the stack

RMUL pops 2 floating point values and pushes their product onto the stack

RDIV pops 2 floating point values and pushes their quotient onto the stack

RMOD pops 2 floating point values and pushes the modulus onto the stack

RCMP pops 2 floating point values and pushes the comparison to the stack (-1 is less than, 0 is equal, 1 is greater than)

CHKNAN pops a floating point value and pushes a 1 if it's NaN otherwise it pushes 0 to the stack

I2R pops an integer value and pushes its floating point equivalent to the stack

R2I pops a floating point value and pushes it's integer equivalent to the stack

INT pushes the instruction pointer to the return stack and pops a value from the stack and calls the interrupt at the specified index in the interrupt vector table

JMP jumps to the location in memory specified by its operand

JEQ pops a value from the stack and jumps to the location in memory specified by its operand if the popped value is equal to 0

JNE pops a value from the stack and jumps to the location in memory specified by its operand if the popped value is not equal to 0

JLT pops a value from the stack and jumps to the location in memory specified by its operand if the popped value is less than to 0

JGT pops a value from the stack and jumps to the location in memory specified by its operand if the popped value is greater than to 0

JLE pops a value from the stack and jumps to the location in memory specified by its operand if the popped value is less than or equal to 0

JGE pops a value from the stack and jumps to the location in memory specified by its operand if the popped value is greater than or equal to 0

CALL pushes the instruction pointer onto the return stack and pops a value from the stack and calls the function at the address specified by that value

RETURN pops a value from the return stack and jumps to that location in memory

DROP pops a value from the stack and discards it

DUP pushes a copy of the value on the top of the stack onto the stack

OVER pushes a copy of the value under the top of the stack onto the top of the stack

SWAP swaps the top 2 values on the stack

DS2RS pops a value from the stack and pushes it to the return stack

RS2DS pops a value from the return stack and pushes it to the stack

DSSIZE pushes the size of the stack onto the stack

RSSIZE pushes the size of the return stack onto the stack

AND pops 2 values from the stack and pushes the result of a bitwise AND onto the stack

OR pops 2 values from the stack and pushes the result of a bitwise OR onto the stack

XOR pops 2 values from the stack and pushes the result of a bitwise XOR onto the stack

NOT pops a value from the stack and pushes the result of a ones complement negation onto the stack

NEG pops a value from the stack and pushes the result of a twos complement negation onto the stack

RNEG pops a floating point value from the stack and pushes the result of a floating point negation onto the stack

SHFTLFT pops 2 values from the stack and pushes the second value left shifted FIRST_VALUE number of time onto the stack

SHFTRGHT pops 2 values from the stack and pushes the second value right shifted FIRST_VALUE number of time onto the stack

SHFTRGHTC pops 2 values from the stack and pushes the second value right shifted FIRST_VALUE number of time onto the stack while preserving the most significant bit

LPI pushes the pending interrupt flag onto the stack

SPI pops a value from the stack and uses it as the pending interrupt flag

LIM pushes the interrupt mask onto the stack

SIM pops a value from the stack and uses it as the interrupt mask

SDS pops a value from the stack and stores the stack contents at that memory address

LDS pops a value from the stack and loads the stack contents at that memory address

SRS pops a value from the stack and stores the return stack at that memory address

LRS pops a value from the stack and loads the return stack at the memory address