Minimal CISC

From Esolang
Jump to navigation Jump to search

The minimal CISC instruction set presented here is stack-based and composed entirely of zero-address instructions. There are only 8 instructions, so each can be coded as a 3-bit syllable. Assuming a 16 bit word, 5 instruction syllables can be packed in each word (the least significant syllable is the first). This writeup is a revision of a paper by the same name published in ACM Computer Architecture News, 16, 3 (June 1988), pages 56-63.

The instructions are:

NOP: No operation.
DUP: Duplicate the stack top. This is the only way to allocate stack space.
ONE: Shift the stack top left one bit, shifting one into the least significant bit.
ZERO: Shift the stack top left one bit, shifting zero into the least significant bit.
LOAD: Use the value on the stack top as a memory address; replace it with the contents of the referenced location.
POP: Store the value from the top of the stack in the memory location referenced by the second word on the stack; pop both.
SUB: Subtract the top value on the stack from the value below it, pop both and push the result.
JPOS: If the word below the stack top is positive, jump to the word pointed to by the stack top. In any case, pop both.