SM3B: A Small 3-Bit Instruction Set

2^3 = 8 instructions

Symbol Description
0 Resets X if previous instruction not 0 or 1. Leftshifts X.
1 Resets X if previous instruction not 0 or 1. Leftshifts X and adds 1.
+ Adds X to C (accumulator) and copies the result into X
- Subtracts X from C (accumulator) and copies the result into X
$ Swaps the values of X and Y (general purpose)
# Swaps the values of X and M (selected memory cell)
@ Swaps the values of X and A (memory pointer)
? Swaps the values of A (memory pointer) and I (instruction pointer) if X is not equal to zero

Example Programs

Name Program
Default Infinite Loop: 1+$@0+#1@1?Memory gets filled with numbers sequentially
Countdown User Input: 1-@#+Countdown Loop: 101@1-? Countdown value in C
Multiplication User Input: 1-@#$0@$#0+@#$1@$#+-$Multiplication Loop: 0+-@#+#$+$0+-1@#+1-#10101@0+?Result in Y

About the Simulator