| 0x17 | DEO | Device output | b a: u8 -- | | | DEV[a] = b |
| 0x18 | ADD | Add | b a -- a + b | | | |
| 0x19 | SUB | Subtract | b a -- a - b | | | |
| 0x1A | MUL | Multiply | b a -- a * b | | | |
| 0x1B | DIV | Divide | b a -- a / b | | | |
| 0x1C | AND | And | b a -- a && b | | | |
| 0x1D | ORA | Or | b a -- a\|b | | | |
| 0x1E | EOR | Exclusive or (xor) | b a -- a^b | | | |
| 0x1F | SFT | Shift | b a -- b >> (a & 0x0f) << ((a & 0xf0) >> 4) | | | |
### Mode bits
Note that all these instructions are listed with `keep=0,return=0,short=0`.
The UXN documentation refers to `ADD` with `keep=1` as `ADDk`.
`ADD` with `short=1` is `ADD2`, and with `keep=1` would be `ADD2k`.
`POP` with `return=1` is `POPr`.
Conventionally these suffixes are formatted `%/2?k?r?/` as required.
#### Short mode
In When the `short` bit is set, the opcode will pop two 8bi quantities from the stack where it would only consume one in `byte` mode.
Each `b a` pair so popped is considered to be the unsigned 16bi quantity `a + b<<8`
For instance `ADDs` would be `a b c d –- (a<<8 + b) + (c<<8+d)`.
**Exceptions:**
- The load/store operations move two 8bi values not one. `STR` becomes `c b a -- MEM[DATA + a] = ` Relative address computation is unaffected.
- The jump opcodes become absolute rather than computed relative jumps.
#### Keep mode
When the `keep` bit is set, no values are popped from the stack.
For instance `ADD2k` would be `a b c d -- a b c d e f`.
#### Return mode
"return mode" flips the stacks.
If `STH` pops from data and pushes to return, `STHr` pops from return and pushes to data.
Likewise if `ADD` pops from data and pushes to data, `ADDr` would pop from data and push to data.
`JMP2` would load `b a` from the data stack and branch absolutely, `JMP2r` would do the same from the control stack.
`DUP2r` would `a b -- a b a b` the return stack.
The bytecode sequence `LIT 0x01 STH JSRr BRK` would load `0x1` to the data stack, pop and stash it to the return stack, perform a relative jump by `+1` while pushing `PC` to the data stack and halt.