Instructions
instructionsxyw supports 32 different instructions, each supporting from zero to three modes. All instructions are encoded in a single-byte opcode.
The following table provides a quick summary of all xyw instructions; their corresponding opcodes, the supported modes, and signature.
+------- x y w +------ signature --------+
| 00 HLT - - - | -> |
| 01 NOP - - - | -> |
| 02 PSH * * * | -> n |
| 03 POP * * * | n -> |
+--------------+-------------------------+
| 04 LDB * * * | p -> b |
| 05 LDW * * * | p -> w |
| 06 STB * * * | b p -> |
| 07 STW * * * | w p -> |
+--------------+-------------------------+
| 08 INC * * * | n -> n++ |
| 09 DEC * * * | n -> n-- |
| 0A SHL * * * | n b -> n<<b |
| 0B SHR * * * | n b -> n>>b |
+--------------+-------------------------+
| 0C ADD * * * | n1 n2 -> n1+n2 |
| 0D SUB * * * | n1 n2 -> n1-n2 |
| 0E MUL * * * | n1 n2 -> n1*n2 |
| 0F DIV * * * | n1 n2 -> n1%n2 n1/n2 |
+--------------+-------------------------+
| 10 EQU * * * | n1 n2 -> n1==n2 |
| 11 NEQ * * * | n1 n2 -> n1!=n2 |
| 12 GTH * * * | n1 n2 -> n1>n2 |
| 13 LTH * * * | n1 n2 -> n1<n2 |
+--------------+-------------------------+
| 14 NOT * * * | n -> ~n |
| 15 AND * * * | n1 n2 -> n1&n2 |
| 16 IOR * * * | n1 n2 -> n1|n2 |
| 17 XOR * * * | n1 n2 -> n1^n2 |
+--------------+-------------------------+
| 18 DUP * * * | n -> n n |
| 19 SWP * * * | n1 n2 -> n2 n1 |
| 1A OVR - - * | n1 n2 -> n1 n2 n1 |
| 1B ROT - - * | n1 n2 n3 -> n2 n3 n1 |
+--------------+-------------------------+
| 1C JMP ^ ^ * | p -> |
| 1D JCN ^ ^ * | b p -> |
| 1E JSR ^ ^ * | p -> |
| 1F RTS - - - | -> |
+--------------+-------------------------+
Legend:
^: exclusive mode (x xor y)
*: inclusive mode
-: mode not supported
-> See notation for more information