revisiting EXAPUNKS part 0.5: instruction overview

hi! felt like punking and might as well blow through the tutorial as well as take this as an opportunity to give an overview of the basic mechanics of the game. i don't know if just linking the pdf to the manual is technically illegal cause you do only access it with a download of the game, so instead im just going to briefly type the legal commands and what they do, to serve as a key going forward.

also: this will definitely assume some basic understanding of how assembly code is structured, its not too in-depth but you can just comment for a more "real" explanation (or maybe ill write that in a future post, who knows).

this was going to be "quick walkthrough of what the EXAs do and then i get started" but i realized theres a lot more to explaining how they work than i remembered, so this is just an overview of all of the documentation for the EXAs and what they can do. enjoy!

EXA INFO

important knowledge:

EXAs have only 4 memory registers (basically variable slots), and only two of them are actually usable: X, T, F, and M

the X register is a completely normal register, you can write stuff to it, read stuff from it, no complexities

the T register is a true/false register, and can be written and read from as normal, but whenever you test some logical expression (say, X = 2), it will write 1 to T if it is true, and 0 to T if it is false. additionally, some commands read from the T register as a true/false register, where 0 equates to false and anything else equates to true

the F register is used for file input/output, and always points to the "cursor" in the held file. Reading from or writing to the F register will read from/write to the current location and move the cursor forward, and the SEEK command can move the cursor forward or backwards by a specified amount

the M register is weird but also very useful. whenever you write to the M register, the EXA will essentially wait until some other EXA reads from the M register, at which point the data will transfer from the first EXA's M register into the second EXA's M register (but the M register cannot store data, and the second EXA must immediately use or store that value elsewhere

EXA INSTRUCTIONS

basic syntax:

R - register

N - number (-9999 - 9999)

L - label

MANIPULATING VALUES

COPY R/N R - move the value in the first operand into the second operand

ADDI R/N R/N R - add the values in the first and second operands, and store them in the third parameter. SUBI (subtraction), MULI (multiplication), DIVI (division), MODI (modulo), and SWIZ (swizzle) all use the same syntax

math quirks:

DIVI - division: like normal division, except always strips off the decimal point, leaving an integer. Also known as integer division. 

example: 7 / 4 = 1, not 1.75

MODI - modulo: This function essentially gives you the stripped-off part of integer division, the "remainder" as it was called when first learning division. 

example: 7 % 4 = 3, because 7 / 4 is 1 remainder 3

SWIZ - swizzle: This one is not a real mathematical function, but it is fun (actually its a thing for vector math but likeeee). Essentially, it rearranges the order of the first operand in accordance with the second operand, which should never have a number greater than 4 in it (because 4 digit numbers are the max). Use this table as a reference, it doesn't come up much but i will explain it more when it does


BRANCHING

MARK L - Creates a label at this point in the program

JUMP L - Jumps to the specified label

TJMP L - Jumps to the specified label if the T register does not contain a 0 (read: if true, JUMP L)

FJMP L - Jumps to the specified label if the T register does contain a 0 (read: if false, JUMP L)

TESTING VALUES

TEST R/N = R/N Compares the first operand to the second operand, and stores the result in T. Can also be used with > or < symbols. Also, useful table with edge cases that come up occasionally.

LIFECYCLE

REPL L - Makes a copy of this EXA, starting from the specified label

HALT - Terminates the program

KILL - Terminates another EXA in the same location, chooses randomly if there are multiple options

MOVEMENT

LINK R/N - Attempts to move to a location using the value in the operand (this will make more sense when you see how the puzzles work)

HOST R - Stores the current location in the specified register

COMMUNICATION

MODE - Toggles the M register between local and global mode (dont worry about this, ill explain it if it comes up)

VOID M - Reads and discards a value from the M register

TEST MRD - Tests if there is a value available in an M register somewhere, and writes the output to the T register

FILE MANIPULATION

MAKE - Creates and picks up a new file

GRAB R/N - Attempts to grab a file with the specified ID

FILE R - Copies the ID of the held file into the specified register

SEEK R/N - Moves the F register by the amount in the operand, positive or negative. If it reaches the start or end of the file, stops there (stops 1 space past the last element)

VOID F - Erases the value at the F register

DROP - Drops the currently held file

WIPE - Deletes the currently held file

TEST EOF - Tests if the F register is at the end of the file, and writes the output to the T register

MISCELLANEOUS

NOTE - Used to specify comments, anything following this on the same line will be ignored

NOOP - Waits for 1 cycle

RAND R/N R/N R - Generates a random number between the first and second operands and stores it in the third operand

@REP N // @END - Used as 2 separate lines, upon running any lines of code between @REP and @END will be copied N times

@(N, M) - Used only within @REP blocks, when ran it starts at the value in N and increased by M on subsequent copies

Example:

@REP 4    COPY 3 F

COPY 3 F --> COPY 3 F

@END     COPY 3 F

       COPY 3 F

@REP 3         ADDI X 1 X

ADDI X @{1, 2} X -->  COPY X F

COPY X F        ADDI X 3 X

@END          COPY X F

            ADDI X 5 X

            COPY X F

this was sooo much longer than i expected it to be, i guess the EXAs arent that primitive, but still, that is (unless i missed one) every single operation that can be performed on these guys. part 1 (lol) coming soon!

also theres definitely a better way to do this but im just gonna always link the previous post at the bottom, so here

Comments

  1. oh this is really fucking cool

    ReplyDelete
    Replies
    1. i don't need another game i don't need another game i don't need another game

      Delete
  2. u must know the basics of assembly u say ... ears perk up

    ReplyDelete

Post a Comment

Popular posts from this blog

revisiting EXAPUNKS: part 2: oh god this is still the tutorial