Instruction Set - JacobMisirian/EphedraVM GitHub Wiki
Ephedra Instructions are 64-bit fixed length. Each Instruction has an 8-bit opcode, two 16-bit operands, and a 32-bit immediate. Here is a visual representation of an Instruction:
8 - bits | 16 - bits | 16 - bits | 32 - bits |
---|---|---|---|
Opcode | Operand One | Operand Two | Immediate |
Here is a table of Instructions:
Syntax | C - Code | Description |
---|---|---|
dec <Rx> |
rx--; |
Decrements the value of the register. |
dec <Rx>, <int> |
rx -= i; |
Subtracts the given integer from the value of the register. |
inc <Rx> |
rx++; |
Increments the value of the register. |
inc <Rx>, <int> |
rx += i; |
Adds the given integer to the value of the register. |
jmp <lbl> |
goto lbl; |
Jumps to the given label. |
jmp <int> |
void *ptr = (void *)i; goto *ptr; |
Jumps to the given memory address. |
lddw <Rx>, <Ry> |
rx = (uint16_t *)ry; |
Loads a DWORD from the memory location in Ry to Rx. |
lddwi <Rx>, <int> |
rx = (uint16_t *)i; |
Loads a DWORD from the specified memory address. |
ldw <Rx>, <Ry> |
rx = (uint8_t *)ry; |
Loads a WORD from the memory location in Ry to Rx. |
ldwi <Rx>, <int> |
rx = (uint8_t *)i; |
Loads a WORD from the specified memory address. |
mov <Rx>, <Ry> |
rx = ry; |
Moves the value from Ry to Rx. |
stdw <Rx>, <Ry> |
*p = rx; p[0] = ry; |
Stores the WORD from Ry into the memory location at Rx. |
stdwi <int>, <Rx> |
*p = i; p[0] = rx; |
Stores the WORD from Rx into the specified memory address. |