Note: Addressing modes are: *: indirection allowed (interpret as a pointer) P: popped from/pushed to stack H: popped from/pushed to hstack R: register F: register offset (adds small immediate value to the value of the named register) S: small immediate (20 bits) O: small immediate + offset (offset is [index] << 20) I: immediate (1 word, following instruction) D: designated special-purpose register (Usually [jump] or [SV]) Instruction Arity Modes: words possible ; Can access arbitrary memory through pointer in push 2 P *[I,S,O,R,F] 1, 2 pop 2 *[R,F] P 1 peek 2 *[R,F] D 1 hpush 2 H *[I,S,O,R,F] 1, 2 hpop 2 *[R,F] H 1 hpeek 2 *[R,F] D 1 movesh 1 S,R 1 movehs 1 S,R 1 set 2 *[R,F,P,H] *[R,S,O,I,F,P,H] 1, 2 load_ua 2 *[R,S,O,I,F] S,R 1, 2 load_ua_se 2 *[R,S,O,I,F] S,R 1, 2 store_ua 2 *[R,S,O,I,F] S,R 1, 2 ptrdis 0 - 1 1 *[I,R,F] 1, 2 ptrbuild 0 - 1 1 *[R,F] 1 ; Serial devices have DMA; input 1 - 1 output 1 - 1 2 - *[I,S,O,R,F] 1, 2 ; Cannot access memory except for the stack: rot 2 S,R S,R 1 reverse 1 S,R 1 dup 1 D 1 imath 1 S,R 1 fmath 1 S,R 1 adjust 2 R S 1 rand 0 - 1 ; Technically abusing the immediate bits for opcode bits explode#n 1 S 1 collapse#n 1 S 1 and 0 - 1 or 0 - 1 xor 0 - 1 bool 0 - 1 not 0 - 1 cond 0 - 1 jmp 1 D,O 1 reljmp 1 D,O 1 transfer 0 - 1 return 0 - 1 systransfer 1 D,O 1 sysreturn 0 - 1 halt 0 - 1 trap 0 - 1 err 0 - 1 ; May have any addressing mode, but does nothing (never accesses memory) nop 0, 1 - * 1, 2 Instruction behaviors: Push/pop a stack [3] Load/write to RAM (indexed/direct) Load/write to RAM unaligned (indexed/direct) Read/write a register [16] Read/write a shadow register [9] Add offset to register [(16 + 9) ^ 2] Set LP Read/write jump Read/modify flags Sign-extend a result Call 'firmware' (mcpy, mset, rot, rev, save, restore) Modify contents of a stack Read/write to device [?] Poll device [?] Generate random data Perform a bit shift Perform a bitwise operation Perform a comparison Perform a boolean conversion Perform an arithmetic operation Perform a floating-point arithmetic operation Perform an INTERCAL operation Raise an interrupt Set timed alarm Set cycle alarm Read the clock Perform a system call Immediate data can be used for: Offset a register Offset a popped value Segment offset Phases: Increment cycle counter Condition Decode a: Read Register + (i ? index << 20 | Offset : SE(Offset)) b: Pop stack/hstack/cstack + Offset x2 Read Memory (Set LP?) Compute (Set flags) a: Write Register b: Push stack/hstack/cstack x2 Write Memory Increment IP