MinISCule

From Esolang
Jump to navigation Jump to search

MinISCule is an esoteric programming language created by Jeffry Johnston in 2006, with the goal of having a very small interpreter for a Turing-complete language. The interpreter is in MS-DOS COM binary format and is 36 bytes in size. It was written using DEBUG, so the source listing is made from a program disassembly.

The language is an OISC variant, with instruction pointer (IP) and memory pointer (MP). Instructions take the form aaaavvjjjj, where `a' is address, `v' is value, and `j' is jump. Programs are read from stdin, and are separated from their input by a single CR character (0D hex/13 dec).

To maintain an ASCII input source, input characters are decreased by 78. This means that the space character represents the value -46, the uppercase N = 0, and tilde (~)= +48. Use of characters outside this range is accepted, but discouraged.

An instruction is processed as follows:

  1. MP += address (LSB then MSB)
  2. If value == 0 then perform an MS-DOS system call:
    1. Sets registers: AX = address, DL = byte at MP
    2. Executes the INT 21h system call (exit: AX = 00xx, read stdin: AX = 01xx, write stdout: AX = 02xx. See Ralf Brown's Interrupt List for more)
  3. byte at MP += value (or AL return value from a system call)
  4. IP += 5
  5. If byte at MP != 0 then IP += jump (LSB then MSB)

Note that IP is interpreted using byte offsets, not in terms of 5-byte instructions, so to skip an instruction, use jump = 5, not jump = 1. Setting jump = 0 results in execution always being passed to the next instruction.

Examples

  • Simply exit
NNNNN
  • Print the character `A' and exit
NPONNNNMIMNN~NNNN_NNNLONNNNMNNNPNNNNNNNN

See also

External resources