wo3, we get two extra instructions for a total of four. OISCs can be Turing complete, so four instructions should be enough to give us some brunt. At this point, some amount of math is probably a good idea. Instruction three, then, is
ADD, which does what you think it does. Since we’re capable of entering negatives, we can pretty much get to any number we want at this point, albeit terribly inefficiently.
Branching would be very convenient at this point as well, so a simple
SKIPZERO instruction gets the no. 4 position; it pops a value from the stack and if that value is zero, it skips until past the next instruction. All odd (input) words are skipped until an even (instruction) word is encountered, at which point that is skipped and the next word is interpreted.
Skip if zero is a standard simple conditional branch, but I’ll likely change this to
skip if (skip register), so a user can theoretically set the branch condition via a register (with a command certain to be available in
wo3 allows us to write a two-byte truth machine. A truth machine is a miniature programming exercise to demonstrate io, conditionals, and branching. Given an input of 0 or 1, it either prints
0 and exits, or infinitely prints
1, respectively. It’s worth pointing out now that the default value of the primary stack in
wo is MNum, but upon invocation a use will be able to set the initial stack to whatever they’d like — a primitive form of input. We can fit three words (two complete) in a
wo3 byte, so
000 (Print Stack),
001 (Input ‘0’), and
010 (GOTO) fill up a byte and a half, and since we’ll never print it, we can pad the last four bits with input –
1111 will work. The stack will grow with every loop, but it will act as a truth machine as far as a user is concerned; it prints the stack, if the top of the stack is not zero it
GOTOs word zero.
0001100010101111: two bytes,
‰ŕ in Cork1.
Current Instruction Set:
- 0, 0, PRNTPST:
- Print the contents of the primary stack (PST)
- 1, 1, GOTO:
- Pop top of stack, go to corresponding word
- MNum: Go to word indicated by storage register R2 (more on this later)
- Nonexistent word exits
- 2, 10, ADD:
- Pop two values off of the stack, push their sum
- 3, 11, SKIPZERO:
- Pop one value off of the stack, if == 0, skip all words through next instruction
- Unsure of the best encoding to use to represent the data. Single-byte encodings with few non-printing characters are ideal. Cork, to my knowledge, has only the soft hyphen and zero-width space. ↩︎