Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

UMC Instructions

Misc

MneumonicOperand 1Operand 2Description
movRegAnySets op1 = op2
castRegAnySets op1 = op2, casting
bcastInteger RegRegBit / Reinterpret cast
absNumericSigned NumericGets positive value
nopDoes nothing
dbgRegPrints the value and register for debugging

Arithmetic

MneumonicOperand 1Operand 2Operand 3Description
addNumeric RegNumericNumericop1 = op2 + op3
subNumeric RegNumericNumericop1 = op2 - op3
mulNumeric RegNumericNumericop1 = op2 * op3
divNumeric RegNumericNumericop1 = op2 / op3
modNumeric RegNumericNumericop1 = op2 mod op3

Jumps, Calls and Conditional Branches

MneumonicOperand 1Operand 2Description
jmpLabelUnconditional jump to the given label
jalLabelInstr RegJumps to the given label, setting the instruction register to the next instruction
bzLabelNumericJump to label if op2 is zero
bnzLabelNumericJump to label if op2 is not zero

Comparison Operations

Comparison operations take an unsigned destination register (minimum width 1), and sets the destination to 1 if true, otherwise sets to 0. Comparisons are only allowed between the same register sets.

MneumonicOperand 1Operand 2Operand 3Description
eqUnsigned RegNumericNumeric\(op2 = op3\)
gtUnsigned RegNumericNumeric\(op2 \gt op1\)
gteUnsigned RegNumericNumeric\(op2 \ge op3\)
ltUnsigned RegNumericNumeric\(op2 \lt op3\)
lteUnsigned RegNumericNumeric\(op2 \le op3\)

Bitwise Operations

All (signed and unsigned) integers are defined to be stored in twos-complement representation. The following bitwise operations work only between integer types.

MneumonicOperand 1Operand 2Operand 3Description
andInteger RegIntegerIntegerBitwise AND
orInteger RegIntegerIntegerBitwise OR
xorInteger RegIntegerIntegerBitwise XOR
notInteger RegIntegerIntegerBitwise NOT

Memory

Blocks of memory can be allocated with the alloc instruction.

MneumonicOperand 1Operand 2Description
allocAddress RegUnsignedAllocates a continguous block of memory X bytes long
freeAddress RegDe-allocates a block of memory
loadRegAddress RegLoads the given register from the address
storeAddress RegAnyStores a value into the address
msizeUnsigned RegSets op1 to the size of a memory address in bytes
isizeUnsigned RegSets op1 to the size of a instruction address in bytes