⚠️ This page is a Work in Progress
Exas have 4 accessible registers:
| REG | Description |
|---|---|
| X | General-purpose storage, stores a number or keyword |
| T | Also a general-purpose register, however TEST writes to this register, and TJMP and FJMP also read from this register |
| F | Refers to an exa's held file. Reading from or writing to F advances the "file cursor" by one. Writing to F will overwrite a value unless the cursor is at the end of the file |
| M | Used for communication (locally or globally) between Exas. Reading and writing to this register will cause the Exa to wait for another Exa to either write or read the M register too |
Hardware registers starting with # can also be accessed when an Exa is in the same node
| INST | Syntax | Description |
|---|---|---|
| NOOP | NOOP | A no-op |
| NOTE | NOTE [...] | A comment line, ; also works |
| COPY | COPY {REG/NUM} {REG} | Writes value of {REG/NUM} to {REG} |
| ADDI | ADDI {REG/NUM} {REG/NUM} {REG} | Adds the first {REG/NUM} to the second and writes it to {REG} |
| SUBI | SUBI {REG/NUM} {REG/NUM} {REG} | Subtracts the first {REG/NUM} from the second and writes it to {REG} |
| MULI | MULI {REG/NUM} {REG/NUM} {REG} | Multiplies the first {REG/NUM} by the second and writes it to {REG} |
| DIVI | DIVI {REG/NUM} {REG/NUM} {REG} | Divides the first {REG/NUM} by the second and writes it (rounded) to {REG} |
| MODI | MODI {REG/NUM} {REG/NUM} {REG} | Divides the first {REG/NUM} by the second and writes the remainder to {REG} |
| RAND | RAND {REG/NUM} {REG/NUM} {REG} | Generates random number between the first {REG/NUM} and the second and writes to {REG} |
| SWIZ | SWIZ {REG/NUM} {REG/NUM} {REG} | Takes first {REG/NUM} and uses second as a mask to generate a "Swizzled" value (more details below), writes to {REG} |
| TEST | TEST {REG/NUM} {=/>/<} {REG/NUM} | Compares the two input values and writes to register T (1 if true, 0 if false) |
| – | TEST MRD | Checks if Exa could read from another Exa without waiting, and writes to register T |
| – | TEST EOF | Checks if file cursor is at the end of the held file, and writes to register T |
| MARK | MARK {LABEL} | Sets a label (pseudo-instruction) |
| JUMP | JUMP {LABEL} | Jumps to {LABEL} |
| TJMP | TJMP {LABEL} | If T != 0, jumps to {LABEL} |
| FJMP | FJMP {LABEL} | If T == 0, jumps to {LABEL} |
| REPL | REPL {LABEL} | Creates a copy of this Exa (including location and registers, but not file), starting execution from {LABEL} |
| HALT | HALT | Terminates Exa and drops held file |
| KILL | KILL | Terminates other Exa, random but prioritises own Exas |
| LINK | LINK {REG/NUM} | Moves through link with ID of {REG/NUM} |
| HOST | HOST {REG} | Copies hostname to {REG} |
| MODE | MODE | Toggles M register between global and local |
| VOID | VOID M | Discards value from M |
| MAKE | MAKE | Creates and grabs a new file |
| GRAB | GRAB {REG/NUM} | Grabs file with ID of {REG/NUM} |
| FILE | FILE {REG} | Copies held file ID into {REG} |
| SEEK | SEEK {REG/NUM} | Moves file cursor by {REG/NUM}, clamped between start and end of file (-9999 and 9999 will reliably get you to the start and end of a file) |
| VOID | VOID F | Removes value in F where file cursor is pointing |
| DROP | DROP | Drops held file |
| WIPE | WIPE | Deletes held file |
Macros are shorthand for writing repeating statements starting with @REPL N (N being the number of loops) and ending @END, within a macro, @{X,Y} can be used, X being the first value used, and Y being the amount added to X on each loop, so @{0,3} would be 0 on loop 1, 3 on the seconds, 6 on the third and so on. These can be used in label names too, which can be combined with testing and jumping to certain labels.
NOTE: Macros are not actual loops and can result in more instructions than a "real" loop
The mask digits represent a reversed index (from 1) of the input number (so 4321 will return the input number), and 0 will always give a 0. A negative mask will produce a negative number (or positive if input is negative).
| IN | MASK | OUT |
|---|---|---|
| 6789 | 4321 | 6789 |
| 6789 | 1234 | 9876 |
| 6789 | 3333 | 7777 |
| 6789 | 1211 | 9899 |
| 6789 | -4321 | -6789 |
| -6789 | -4321 | 6789 |
| 6789 | 2000 | 8000 |
| 6789 | 0001 | 0009 |
When writing to highway signs, it takes 3 values to write a character to a highway sign:
TOP TIP: when looping through a message, you can get row by dividing x by row length, and column by modulo-ing by row length.