ZipTied

From Esolang
Jump to navigation Jump to search

ZipTied is a low-level, address-based esolang created on September 25th, 2024 by ZackBuildit. It is a single threaded, 16 instruction language, intended to be able to compute any common and well-defined computational task in minimum single-thread time complexity, while doing so as inefficiently and confusingly as possible. The name ZipTied is a triple entendre: "zip", because the majority of the execution time of a program is spent 'unzipping' itself into another, significantly simpler program, "tied" due to being tied with the majority of other systems for minimum time complexity, and "ziptie", for its extremely constraining program formats making what would be simple tasks instead extremely difficult.

Memory in ZipTied is composed of an assumed infinite address space, unbounded in both positive and negative. For example, unlike Subleq, in ZipTied, an instruction referencing an address -1 does not result in alternate behavior. Each address contains two units of data: its flag, and its value. Values are unbounded signed integers (little-endian), and flags are 4 bit words. In addition to its address space, ZipTied also includes 4 different registers, designed by X, Y, ptr, and Time. X and Y are both accumulators, ptr is an instruction pointer, and time is simply a counter. All four registers are unbounded signed integers, though in the case of Time, the sign is irrelevant.

Each address is also an instruction. When used as an instruction, the value at the address is referred to as its argument, with its flag specifying its behavior. the name "loc" refers to the data located at address equal to the given instruction's argument. REGARDLESS of instruction (including if instruction effects ptr), ptr and Time are both always incremented after performing the action. Both ptr and Time are initialized as 0 on start.

There are 16 unique instructions in ZipTied, each specified by a unique flag code. They are listed here as follows:

Flag codes / Instructions:
Flag code Name Behavior
0000 halts if X == 0, halt program. Else, set X to argument
0001 bnors set X to NOR(X,loc)
0010 shift set X to X << (val of loc), where negative value of loc result in X>>abs(val of loc)
0011 diffs set X to X-loc
0100 check if X > 0, set ptr to ptr+arg. Else, do nothing
0101 jumps set Y to ptr. Then, set ptr to arg-1 (note: due to ptr increment, this results in executing the instruction at address = arg)
0110 swaps swap value of loc with value in X
0111 aflag invert first bit of flag of loc. If this bit becomes 0, set X to -X
1000 stdio if arg > 0, write arg as an extended-ASCII string to the terminal (ending the write upon first null char), else, if arg < 0, set X to the n'th most recent input string (where n is arg), else, write X as extended-ASCII string to the terminal (again, stopping at first null char)
1001 store first, swap the value of X with the value of Y. Then, swap the value of Y with arg (not loc)
1010 count set value of loc to value of Time, and set X to value of ptr
1011 bflag invert second bit of flag of loc. If this bit becomes 0, set X to -X
1100 write set value of loc to X, set flag of loc to 0000. Then, set X to 0
1101 cflag invert third bit of flag of loc. If this bit becomes 0, set X to -X
1110 dflag invert fourth bit of flag of loc. If this bit becomes 0, set X to -X
1111 cases set ptr to ptr + value of loc