Encoding Overview
Instructions can range from 1 to 7 bytes, depending on operand size and count. Instructions do not require or enforce a particular memory alignment, thus allowing the tightest possible packing of code in memory.
The instruction format appears as follows:
PC + 0 7 8 9 C D F 10
+--------+-+----+---+--------+--------+-+----+---+--------+--------+
|OPCODE |T|MOD |DSP| DEST OPERAND |T|MOD |DSP| SOURCE OPERAND |
+--------+-+----+---+--------+--------+-+----+---+--------+--------+
DEST AMOD SRC AMOD
NOTE: Not all instructions will use every part of the above diagram. For example, a byte-sized operand will consume one byte instead of two, and some instructions may use zero or one operand.
Opcodes
Opcode (Decimal) | Instruction |
---|---|
001 | COPY |
002 | CPSZ |
003 | ADD |
004 | SUB |
005 | MUL |
006 | DIV |
007 | SHL |
008 | SHR |
009 | OR |
010 | NOT |
011 | AND |
012 | XOR |
013 | EQV |
014 | CMP |
015 | CMPSZ |
020 | BRANCH |
021 | BEQ |
022 | BNE |
023 | BZ |
025 | BLT |
026 | BGT |
027 | SCALL |
028 | LCALL |
029 | ICALL |
030 | SRET |
031 | LRET |
032 | IRET |
033 | PUSH |
034 | POP |
040 | IN |
041 | OUT |
254 | NOP |
255 | HLT |