Skip to main content

Instructions


Misc Insturctions

nop - No Operation

Does not performs any operation, using a CPU cycle

invalid - Invalid Instruction

Reserved instruction for a invalid instruction code, used for debug


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

je - Jump if equals

if (flags(Zero)) goto(X)

Jumps to the address X if flag zero is set

jne - Jump if not equals

if (!flags(Zero)) goto(X)

Jumps to the address X if flag zero is clear

jgr - Jump if greater

jlr - Jump if lesser

jge - Jump if greater or equals

jle - Jump if lesser or equals


Logic

add - Add registers

sub - Subtract registers

mul - Multiply registers

div - Divide registers

rem - Get registers division reminder

neg - Negate

and - Bitwise AND

or - Bitwise OR

nor - Bitwise NOR

xor - Bitwise XOR

nand - Bitwise NAND

xnor - Bitwise XNOR

not - Bitwise NOT

shl - Bitwise shift left

shr - Bitwise shift right

convup - Convert registers up

convdw - Convert registers down