Argonaut Strategy Language

From BTG Wiki
Jump to navigation Jump to search

Argonaut Strategy Language (ASL) is the In-game scripting language used by Bionicle The Game and many other titles created by Argonaut. The language gets compiled into a proprietary Bytecode. It is currently not exactly known what ASL looked before compilation.

Virtual Machine

This is currently being investigated.

Opcodes

A collection of the currently known opcodes for the ASL Virtual Machine.

Instruction Structure

op |v1|v2|v3|

op |v1|v2|li|

Linker

The last 16-bit short in each logical function pointer indicates how many instructions are before the next function pointer.

This is how the linker skips over ASL instructions and translates each logical pointer into physical pointers.

Known Opcodes

Opcode Description
0x00 Add v3(lowest byte) to v2 and store the result in v1.
0x01 Subtract v3(lowest byte) from v2 and store the result in v1.
0x02 Multiply v3(lowest byte) by v2 and store the result in v1.
0x03 Divide v2 by v3(lowest byte) and store the result in v1.
0x04 Subtract v2 from v3(lowest byte) and store the result in v1.
0x05 Divide v3(lowest byte) by v2 and store the result in v1.
0x06 Bitwise AND v3(lowest byte) with v2 and store the result in v1.
0x07 Bitwise OR v3(lowest byte) with v2 and store the result in v1.
0x08 Bitwise XOR v3(lowest byte) with v2 and store the result in v1.
0x09 Logical OR v2 with v3(lowest byte). If true, set v1 to 1. If false set v1 to 0.
0x0A Move v3(lowest byte) into v1.
0x0B Float add v2 to v3(lowest byte) and store the result in v1.
0x0C Float subtract v3(lowest byte) from v2 and store the result in v1.
0x0D Float multiply v2 by v3 and store the result in v1.
0x0E Float divide v2 by v3 and store the result in v1.
0x0F Float subtract v2 from v3 and store the result in v1.
0x10 Float divide v3 by v2 and store the result in v1.
0x12 Shift bits of v2 left by v3 and store the result in v1.
0x13, 0x14 Shift bits of v2 right by v3 and store the result in v1.
0x20 Logical OR not v2 with not v3 (NAND). If true, set v1 to 0, else set v1 to 1.
0x23 Modulus v2 by v3 and store the result in v1.
0x24 Modulus v3 by v2 and store the result in v1.
0x25 Float (fmod) modulus v2 by v3 and store the result in v1.
0x26 Float modulus (fmod) v3 by v2 and store the result in v1.
0x28 Add v2 to the literal (lowest byte) and store the result in v1.
0x29 Subtract the literal (lowest byte) from v2 and store the result in v1.
0x2A Multiply v2 by the literal (lowest byte) and store the result in v1.
0x2B Divide v2 by the literal (lowest byte) and store the result in v1.
0x2C Subtract v2 from the literal and store the result in v1.
0x2D Divide the literal (lowest byte) by v2 and store the result in v1.
0x2E Bitwise AND v2 with the literal (lowest byte) and store the result in v1.
0x2F Bitwise OR v2 with the literal (lowest byte) and store the result in v1.
0x30 Bitwise XOR v2 with the literal (lowest byte) and store the result in v1.
0x31 Logical OR v2 with the literal (lowest byte). If true, set v1 to 1. If false set v1 to 0.
0x32 Set v1 to the literal in the instruction (lowest byte).
0x33 Multiply the literal (lowest byte) by 0.125, float add it to v2, and store the result in v1 as float.
0x34 Multiply the literal (lowest byte) by 0.125, float subtract it from v2, and store the result in v1 as float.
0x35 Multiply the literal (lowest byte) by 0.125, float multiply it by v2, and store the result in v1 as float.
0x36 Multiply the literal (lowest byte) by 0.125, float divide v2 by it, and store the result in v1 as float.
0x37 Multiply the literal (lowest byte) by 0.125, float subtract v2 from it, and store the result in v1 as float.
0x38 Multiply the literal (lowest byte) by 0.125, float divide it by v2, and store the result in v1 as float.
0x39 Multiply the literal (lowest byte) by 0.125 and store the result in v1 as a float.
0x3A Shift bits of v2 left by literal (lowest byte) and store the result in v1.
0x3B, 0x3C Shift bits of v2 right by literal (lowest byte) and store the result in v1.
0x42 (SPECIAL)
0x43 (SPECIAL)
0x48 Logical OR not v2 with not literal (lowest byte) (NAND). If true, set v1 to 0, else set v1 to 1.
0x50 Add v2 to the following 32-bit number and store the result in v1.
0x51 Subtract the following 32-bit number from v2 and store the result in v1.
0x52 Multiply v2 by the following 32-bit number and store the result in v1.
0x53 Divide v2 by the following 32-bit number and store the result in v1.
0x54 Subtract v2 from the following 32-bit number and store the result in v1.
0x55 Divide the following 32-bit number by v2 and store the result in v1.
0x56 Bitwise AND v2 with the following 32-bit number and store the result in v1.
0x57 Bitwise OR v2 with the following 32-bit number and store the result in v1.
0x58 Bitwise XOR v2 with the following 32-bit number and store the result in v1.
0x59 Logical OR v2 with the following 32-bit number. If true, set v1 to 1. Else set v1 to 0.
0x5A Set v1 to the following 32-bit number.
0x63 Shift the bits of the literal (lowest byte) left by v2 and store the result in v1.
0x64 Shift the bits of the literal (lowest byte) right by v2 and store the result in v1.
0x70 Logical OR not v2 with not the following 32-bit integer (NAND). If true, set v1 to 0. Else set v1 to 1.
0x73 Modulus v2 by the following 32-bit integer and store the result in v1.
0x74 Modulus the following 32-bit integer by v2 and store the result in v1.
0x78 Skip number of instructions indicated by lower word. Note this lower word is signed, so it can go backwards!
0x79 If v1, Skip number of instructions indicated by lower word. Note this lower word is signed, so it can go backwards!
0x7A If not v1, Skip number of instructions indicated by lower word. Note this lower word is signed, so it can go backwards!
0x80 Exe Function call. Get function pointer next to instruction and call it with v2 as an arg.
0x81 Exe Function call. Get function pointer next to instruction and call it with v1 and v2 as args.
0x85 Set v1 to 0.
0x86 Set v1 to 0. Set v2 to 0.
0x8B Increment v1 by 1.
0x8C Decrement v1 by 1.
0x8D Float increment v1 by 1.
0x8E Float decrement v1 by 1.
0x8F Set v1 to the boolean result of v3 equals (==) 0.
0x91 Set v1 to the float value of v3 (typecast?).
0x96 Set v1 to the boolean result of v3 equals (==) v2.
0x97 Set v1 to the boolean result of v2 not equals (!=) v3.
0x98 Set v1 to the boolean result of v2 greater than or equal to (>=) v3.
0x99 Set v1 to the boolean result of v2 less than or equal to (<=) v3.
0x9A Set v1 to the boolean result of v2 greater than (>) v3.
0x9B Set v1 to the boolean result of v2 less than (<) v3.
0x9C Set v1 to the boolean result of v2 equals (==) the literal (lowest byte).
0x9D Set v1 to the boolean result of v2 not equals (!=) the literal (lowest byte).
0x9E Set v1 to the boolean result of v2 greater than or equal to (>=) the literal (lowest byte).
0x9F Set v1 to the boolean result of v2 less than or equal to (<=) the literal (lowest byte).
0xA0 Set v1 to the boolean result of v2 greater than (>) the literal (lowest byte).
0xA1 Set v1 to the boolean result of v2 less than (<) the literal (lowest byte).
0xA2 Set v1 to the boolean result of the following 32-bit number equals (==) v2.
0xA3 Set v1 to the boolean result of v2 not equals (!=) the following 32-bit number.
0xA4 Set v1 to the boolean result of v2 greater than or equal to (>=) the following 32-bit number.
0xA5 Set v1 to the boolean result of v2 less than or equal to (<=) the following 32-bit number.
0xA6 Set v1 to the boolean result of v2 greater than (>) the following 32-bit number.
0xA7 Set v1 to the boolean result of v2 less than (<) the following 32-bit number.