MISC
MISC is an esoteric programming language devised by Safalra (Stephen Morley) in September 2003. It consists of a specific implementation of the OISC concept. MISC is Turing Complete.
Etymology
MISC stands for 'Minimal Instruction Set Computing' or 'Minimal Instruction Set Computer'. MISC is RISC taken to the extreme, with only one instruction - 'subtract and branch if negative'. Despite this, MISC can perform any calculation computable by a normal RISC (Reduced Instruction Set Computing) or CISC (Complex Instruction Set Computing) machine. MISC is sometimes called OISC (presumably standing for the semantically dubious 'One Instruction Set Computing').
The MISC-n
The n in MISC-n is a number, greater than one, referring to the number of bits in a memory word. If every instruction must be able to jump directly to every other instruction, this also determines how much memory the MISC-n can possess:
- MISC-2 - with only one byte of memory, enough for one instruction, this minimal MISC is practically useless
- MISC-16 - with a maximum 128 KB of addressable memory, the MISC-16 can serve well as a simple graphical calculator or embedded system, and each memory word can store a unicode character
- MISC-32 - with a maximum 16 GB of addressable memory, the MISC-32 can serve as a desktop computer
- MISC-64 - with a maximum of over 134,000,000 TB of addressable memory, the MISC-64 is up for practically any task
If it is not the case that every instruction must be able to jump directly to every other instruction, then these limits can be ignored.
Instruction format
Each instruction takes four words of memory, and is of the following form:
- Word 0 - The relative destination address of the subtraction.
- Word 1 - The first source, which may be a relative address or a number depending on Word 3.
- Word 2 - The second source, which may be a relative address or a number depending on Word 3.
- Word 3 - The relative jump in number of instructions. As the number of instructions is a quarter the number of memory words, the top two bits are free to be used for other purposes. The top bit is 0 if Word 1 is an address, or 1 if it is a number. The next bit is 0 if Word 2 is an address, or 1 if it is a number.
So that the same code can be used at any point in memory, all address are relative. Relative memory addresses number the first word of the current instruction 0, and each successive word is numbered 1 greater. Relative instruction addresses number the current instruction 0, and each successive instruction (starting four words later in memory) is numbered 1 greater.
Some notes
- Execution starts at the first word of memory.
- If an instruction does not branch, execution continues at the next instruction.
- In line with the relative addressing model, the memory is regarded as circular.
- If an instruction modifies its own third word, this only effects subsequent branches from that instruction and not the current branch.
- In any implementation of MISC, input and output would occur at specific addresses in memory. As a result a master program should inform each input/output subroutine of its relative address.
- Indirect addressing can be accomplished by one instruction overwriting the addresses in a subsequent instruction. For example, before calling a subroutine a program could overwrite the return address of the subroutine in order to return control to the program.
See also
External resources
- MISC (at Safalra's Website) (from the Wayback Machine; retrieved on 3 December 2008)
- MISC Architecture Specification (from the Wayback Machine; retrieved on 3 January 2010)
- BF Interpreter in MISC (from the Wayback Machine; retrieved on 3 January 2010)