TISC

From Esolang
Jump to navigation Jump to search

TISC (i.e. Two Instruction Set Computer) is a computer architecture invented by User:A that provides 2 instructions (but only one should appear in a practical source code). This tries to build a Von-Neumann architectured computer that is as simple as possible. (Yes, it contains all of the 5 units: input device, output device, control unit, arithematic unit, and memory unit.)

Syntax

As the overview says, it only provides two instructions:

  • INC xx (opcode 1)

This flips the bytecode on address xx. Addresses are represented as 7 bits, and the opcode will be represented as 1 bit. (Special notes: the address starts at 0! The addresses count as one address; when this is triggered as an address, it increments the address instead with overflow mapping to 0.)

  • JMP xx (opcode 0)

This sets the control flow to the address xx. (Please note that the source code is in the memory.) Jumping to an undefined address halts the program. Branching to an address results in branching to the previous opcode.

If any other opcode appears in the source code instead of INC, the execution will run inside an infinite loop, eventually breaking the computer...

Note that all addresses are inputted at the start of the program(as intgers; -1 does not set the address to anything, and no input results in nothing. This takes input as bytes.) In every step of the execution, all addresses will be outputted (which seems a bit annoying). No output will occur when the execution halts.

Examples

Looping in order to increment the address on 13 two times

INC 13
INC 9
INC 1

Truth-machine

This takes integer input to the first byte. When the input is 0, it branches to 0 and halts. When the input is 1, it loops forever.

JMP 0