====== ASIA-16 ====== ASIA-16 is an [[projects:archevo:ISA]], and a successor to [[projects:archevo:ASIA]]. Each instruction has 16 bits, while ASIA only has 11. Of the five extra bits, four are a new register reference and one is an extra bit of opcode. As there are now three registers, each register reference is four bits and each register holds eight bits, two registers can be put together into a constant, and also have room for a register. This added flexibility leads to some new, more powerful concepts: * Three-register operations. In ASIA, the only way to add two numbers was to overwrite one of them with the answer. (For example, A = A+B). Now, both registers A and B can be preserved. * Working with constants. We can load constants, and also increment and decrement by the constant. * Compare-and-jump. ASIA-16 does away with booleans. All comparisons are done inside of the jump. This saves register space and cycles. * Compare-and-execute. Cell operations have options for inlining comparisons. For example, in ASIA, RNE would take at least three cycles. Now, it takes one. An instruction looks like this: OOOOAAAABBBBCCCC O - Opcode A - Register A B - Register B C - Register C or, like this: OOOOxxxxxxxxCCCC O - Opcode x - Constant C - Register C Of the possible 65335 instructions, 20738 are unique. ^ GB ^ OpCode ^ Mnemonic ^ Description ^ # Unique Instructions ^ | 0 | 0000 | INC C | Increment C. C = C + 1 | 7 | | 0 | 0001 | DEC C | Decrement C. C = C - 1 | 7 | | 0 | 0010 | ICC x C | Increment C by x. C = C + x | 1792 | | 0 | 0011 | DCC x C | Decrement C by x. C = C - x | 1792 | | 0 | 0100 | ADD A B C | Add. C = A + B | 1792 | | 0 | 0101 | SUB A B C | Subtract. C = A - B | 1792 | | 0 | 0110 | MUL A B C | Multiply. C = A*B | 1792 | | 0 | 0111 | DIV A B C | Divide (Round down). C = A/B| 1792 | | 0 | 1000 | AND A B C | And. C = A and B | 1792 | | 0 | 1001 | OR A B C | Or. C = A or B | 1792 | | 0 | 1010 | INV A C | Invert. C = not A | 112 | | 0 | 1011 | XOR A B C | Exclusive Or. C = B xor A | 1792 | | 0 | 1100 | SRL A C | Shift C Right. C = A >> 1 | 112 | | 0 | 1101 | SLL A C | Shift C Left. C = A << 1 | 112 | | 0 | 1110 | MOV A C | Move A to C. C = A | 112 | | 0 | 1111 | LOD x C | Loads a value. C = x | 1792 | | 1 | 0000 | REP | Reproduce. | 1 | | 1 | 0001 | ATK | Attack. | 1 | | 1 | 0010 | MOV | Move. | 1 | | 1 | 0011 | JMP | Jump. | 1 | | 1 | 0100 | JLT A B | Jump if A < B. | 256 | | 1 | 0101 | JGT A B | Jump if A > B. | 256 | | 1 | 0110 | JET A B | Jump if A == B. | 256 | | 1 | 0111 | JNE A B | Jump if A != B. | 256 | | 1 | 1000 | RET A B | Reproduce if A == B. | 256 | | 1 | 1001 | RNE A B | Reproduce if A != B. | 256 | | 1 | 1010 | AET A B | Attack if A == B. | 256 | | 1 | 1011 | ANE A B | Attack if A != B. | 256 | | 1 | 1100 | MET A B | Move if A == B. | 256 | | 1 | 1101 | MNE A B | Move if A != B. | 256 | | 1 | 1110 | NPA | NOP A. | 1 | | 1 | 1111 | NPB | NOP B. | 1 |