A personal project via which I aim to learn a bit about assembly by programming an interpretive implementation of select opcode mnemonics.
-
✔
MOV x, y
Move the contents of registery
into registerx
(x = y
) -
✔
INC x
Increment registerx
by one (x++
) -
✔
DEC x
Decrement registerx
by one (x--
) -
✔
ADD x, y
Add the contents of registery
tox
(x += y
) -
✔
SUB x, y
Subtract the contents of registery
fromx
(x -= y
) -
✔
MUL x, y
Multiply the contents of registerx
andy
, store result inx
(x *= y
) -
✔
DIV x, y
Integer divide the contents of registerx
byy
, store result inx
(x /= y
) -
✔
JNZ x, y
Jumpy
instructions if registerx
is Not Zero -
✔
;
Comment, ignored by the interpreter
-
✘
label:
Define a position within the code reachable by thelabel
identifier -
✘
call lbl
Procedure call to the subroutine identified by the labellbl
-
✘
ret
Return to the instruction that called the current subroutine -
✘
CMP x, y
Compare the contents of registersx
andy
(result used by other instructions) -
✘
JNE lbl
Jump to the labellbl
if the values of the previousCMP
were Not Equal -
✘
JE lbl
Jump to the labellbl
if the values of the previousCMP
were Equal -
✘
JGE lbl
Jump to the labellbl
if registerx
was Greater than or Equal toy
in the previousCMP
-
✘
JG lbl
Jump to the labellbl
if registerx
was Greater thany
in the previousCMP
-
✘
JLE lbl
Jump to the labellbl
if registerx
was Lesser than or Equal toy
in the previousCMP
-
✘
JL lbl
Jump to the labellbl
if registerx
was Lesser thany
in the previousCMP
Reference: Intel 80x86 ASM Opcodes