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 * * * | -- a |
| 03 POP * * * | a -- |
+--------------+-------------------------+
| 04 LDB * * * | addr -- (addr) |
| 05 LDW * * * | addr -- (addr) |
| 06 STB * * * | a8 addr -- |
| 07 STW * * * | a16 addr -- |
+--------------+-------------------------+
| 08 INC * * * | a -- a++ |
| 09 DEC * * * | a -- a-- |
| 0A SHL * * * | a b8 -- a<<b8 |
| 0B SHR * * * | a b8 -- a>>b8 |
+--------------+-------------------------+
| 0C ADD * * * | a b -- a+b |
| 0D SUB * * * | a b -- a-b |
| 0E MUL * * * | a b -- a*b |
| 0F DIV * * * | a b -- a%b a/b |
+--------------+-------------------------+
| 10 EQU * * * | a b -- a==b |
| 11 NEQ * * * | a b -- a!=b |
| 12 GTH * * * | a b -- a>b |
| 13 LTH * * * | a b -- a<b |
+--------------+-------------------------+
| 14 NOT * * * | a -- ~a |
| 15 AND * * * | a b -- a&b |
| 16 IOR * * * | a b -- a|b |
| 17 XOR * * * | a b -- a^b |
+--------------+-------------------------+
| 18 DUP * * * | a -- a a |
| 19 SWP * * * | a b -- b a |
| 1A OVR - - * | a b -- a b a |
| 1B ROT - - * | a b c -- b c a |
+--------------+-------------------------+
| 1C JMP ^ ^ * | addr -- |
| 1D JCN ^ ^ * | a8 addr -- |
| 1E JSR ^ ^ * | addr -- |
| 1F RTS - - - | -- |
+--------------+-------------------------+
Legend:
^: exclusive mode (x xor y)
*: inclusive mode
-: mode not supported
a, b: byte or word value depending on w
0: byte or word set to zero depending on w
a8, b8: byte value
a16: word value
addr: direct page/absolute address depending on w
(addr): value at address
pc: program counter