# ESOPUNK/Commands

## Commands

Against all rules and regulations, I'm using man-style formatting:

• Bold: Type exactly as shown
• Italic: Replace with appropriate argument.
Command Usage Equivalent (C)
Manipulation
`COPY SRC DEST` Copy the value from SRC [RI] to DEST [R] `DEST = SRC;`
`ADDI A B DEST` Take the sum of A [RI] and B [RI], and place it in DEST [R] `DEST = A + B;`
`SUBI A B DEST` Take the difference of A [RI] and B [RI], and place it in DEST [R] `DEST = A - B;`
`MULI A B DEST` Take the product of A [RI] and B [RI], and place it in DEST [R] `DEST = A * B;`
`DIVI A B DEST` Take the ratio of A [RI] and B [RI], and place it in DEST [R] `DEST = A / B;`
`MODI A B DEST` Take the mod of A [RI] and B [RI], and place it in DEST [R] `DEST = A % B;`
`SWIZ A B DEST` Swizzle A [RI] and B [RI], and place it in DEST [R]
Branching
`MARK LABEL` Mark the line with LABEL [L]. `LABEL:`
`JUMP LABEL` Unconditionally jump to LABEL. `goto LABEL;`
`TJMP LABEL` If the T register is truthy, jump to LABEL. Otherwise, noop. `if(T){goto LABEL;}`
`FJMP LABEL` If the T register is falsy, jump to LABEL. Otherwise, noop. `if(!T){goto LABEL;}`
Testing
`TEST A = B` Test if A [RI] and B [RI] are equal. Set the T register to 1 or 0 based on the result. `T=(A==B?1:0);`
`TEST A > B` Test if A [RI] is greater than B [RI]. Set the T register to 1 or 0 based on the result. `T=(A>B?1:0);`
`TEST A < B` Test if A [RI] is less than B [RI]. Set the T register to 1 or 0 based on the result. `T=(A<B?1:0);`
Lifecycle
`REPL LABEL` Create a copy of this EXA and jump to LABEL [L] in the copy. `if(fork()==0){goto LABEL;}`
`HALT` Terminate this EXA. `exit(0);`
`KILL` Kill a random EXA.
Communication
`MODE` Toggle the M register between local and global mode.
`VOID M` Read and discard a value from the M register.
`TEST MRD` If the M register is readable without blocking, set the T register to 1, else 0.