User:Maharba/Hypercube
Hypercube is a RISC by Abraham Karplus with five basic instructions (one of which takes an argument). Its memory is an unbounded pointer, an unbounded dimension index, and an infinite-dimensional hypercube. Each vertex of the hypercube is a cell capable of holding one bit. The pointer, dimension index, and all cells of the hypercube start at 0.
- Home. Set the dimension index to zero.
- Up. Increment the dimension index.
- Slide. Slide the pointer along the edge given by the dimension index.
- Toggle. Toggle the cell indexed by the pointer.
- Jump. In the code, conditionally jump relative to the current location. The number of commands to jump is given as a number (negative for a backwards jump). It will only jump if the cell indexed by the pointer is true. Note that since the instruction following the jumped-to instruction is executed, a jump of zero is a NOP rather than an infinite loop.
To understand how pointer movement works, interpret the pointer as a bit array and the dimension index as the address of a bit (with 0 the least significant bit.) Sliding the pointer is then equivalent to negating the pointer bit given by the dimension index.
Assembly Language
In Hypercube assembly language, the primitive commands are written with the first letter of their name: H U S T J. The jump command is followed by a string of decimal digits, optionally preceded by a minus sign.
The assembly language also provides a macro syntax that allows constructs such as C-like conditionals and loops. However, I have not yet completed the design of the macro system.