Instructions
Misc Insturctions
nop - No Operation
Does not performs any operation, using a CPU cycle
unreachable - Unreachable Instruction
Reserved opcode for a invalid instruction code, can be used for marking the execution point as unreachable, generating an handleable exeption
invalid - Invalid Instruction
Reserved opcode for a invalid instruction code, can be used for debug, generating an unhandled exeption
Data Logistic
move - Move data between registers
{R1} -> {R2}
Moves register R1 value into register R2
load - Load data from memory
MEM[{X}] -> {R1}
Loads value from memory address X into register R1
store - Store data in memory
{R1} -> MEM[{X}]
Stores register R1 value into memory address X
push - Pushes data in stack
{R1} -> MEM[SPTR]
SPTR += sizeof({R1})
Stores register R1 value in the stack and increments the stach pointer
pop - Pops data from stack
MEM[SPTR] -> {R1}
SPTR -= sizeof({R1})
Loads last stack value into register R1 and decrement the stack pointer
Branching
call - Calls a function
IPTR -> MEM[SPTR]
SPT += {pointer_length}
goto({X})
save instruction pointer and jump into another function
ret - Returns from a function
goto(MEM[SPTR])
SPT -= {pointer_length}
Returns to instruction pointer saved in stack
cmp - Compare values
V1 - V2 -> flags(Negative, Zero, Overflow)
Compares two values and aply the results to the flags
jmp - Do jump
goto(X)
Jumps to the address X
jmp.e - Jump if equals
if (flags(Zero)) goto(X)
Jumps to the address X if flag zero is set
jmp.ne - Jump if not equals
if (!flags(Zero)) goto(X)
Jumps to the address X if flag zero is clear