integration_instructions

Assembly Instructions


Assembly language serves as the bridge between high-level programming languages and the raw power of machine code. It's a low-level programming language, that uses a set of symbolic instructions that are translated directly into the machine code specific to a computer architecture. Each instruction in the assembly language corresponds to a single machine instruction, giving the programmer granular control over the system's operations.

assembly instructions or mnemonics

Assembly instructions are the fundamental building blocks of programs written in assembly language. Each instruction corresponds to a specific operation that the computer's central processing unit (CPU) can perform.

Assembly mnemonics are the shortcodes used to represent different assembly language instructions. These codes are mnemonic in nature, meaning that they are designed to be easy to remember and understand.

Data Movement Instructions

Data movement instructions are used to transfer data between registers or between memory and registers.

MOV
This instruction is used to move data from one register to another or from memory to a register. The syntax of the MOV instruction is

MOV destination, source

For example, MOV AX, BX moves the contents of the BX register to the AX register.
XCHG
This instruction is used to exchange the contents of two registers. The syntax of the XCHG instruction is

XCHG destination, source

For example, XCHG AX, BX exchanges the contents of the AX and BX registers.

Arithmetic Instructions

Arithmetic instructions are used to perform mathematical operations such as addition, subtraction, multiplication, and division.

ADD
This instruction is used to add two operands and store the result in the destination operand. The syntax of the ADD instruction is

 ADD destination, source

For example, ADD AX, BX adds the contents of the BX register to the AX register.
SUB
This instruction is used to subtract one operand from another and store the result in the destination operand. The syntax of the SUB instruction is

SUB destination, source

For example, SUB AX, BX subtracts the contents of the BX register from the AX register.
MUL
This instruction is used to perform unsigned multiplication of two operands and store the result in the AX register. The syntax of the MUL instruction is

MUL source

For example, MUL BX multiplies the contents of the BX register with the contents of the AX register and stores the result in the AX register.
DIV
This instruction is used to perform unsigned division of two operands and store the quotient in the AX register and the remainder in the DX register. The syntax of the DIV instruction is

DIV source

For example, DIV BX divides the contents of the AX register by the contents of the BX register and stores the quotient in the AX register and the remainder in the DX register.

Logical Instructions

Logical instructions are used to perform logical operations such as AND, OR, XOR, and NOT.

AND
This instruction is used to perform the logical AND operation on two operands and store the result in the destination operand. The syntax of the AND instruction is

AND destination, source

For example, AND AX, BX performs the logical AND operation on the contents of the AX and BX registers and stores the result in the AX register.
OR
This instruction is used to perform the logical OR operation on two operands and store the result in the destination operand. The syntax of the OR instruction is

OR destination, source

For example, OR AX, BX performs the logical OR operation on the contents of the AX and BX registers and stores the result in the AX register.
XOR
This instruction is used to perform the logical XOR operation on two operands and store the result in the destination operand. The syntax of the XOR instruction is

XOR destination, source

For example, XOR AX, BX performs the logical XOR operation on the contents of the AX and BX registers and stores the result in the AX register.
NOT
This instruction is used to perform the logical NOT operation on the operand and store the result in the destination operand. The syntax of the NOT instruction is

NOT destination

For example, NOT AX performs the logical NOT operation on the contents of the AX register and stores the result in the AX register.

Control Transfer Instructions

Control transfer instructions are used to change the flow of program execution.

JMP
This instruction is used to transfer control to a new location in the program. The syntax of the JMP instruction is

JMP destination

For example, JMP label transfers control to the label specified in the program.
JZ/JNZ
These instructions are used to perform a conditional jump based on the zero flag in the flags register. JZ jumps if the zero flag is set, while JNZ jumps if the zero flag is not set. The syntax of the JZ/JNZ instructions is

JZ/JNZ destination

For example, JZ label jumps to the label specified in the program if the zero flag is set.
JC/JNC
These instructions are used to perform a conditional jump based on the carry flag in the flags register. JC jumps if the carry flag is set, while JNC jumps if the carry flag is not set. The syntax of the JC/JNC instructions is

JC/JNC destination

For example, JC label jumps to the label specified in the program if the carry flag is set.
CALL
This instruction is used to call a subroutine or function. The syntax of the CALL instruction is

CALL destination

For example, CALL subroutine calls the subroutine specified in the program.
RET
This instruction is used to return from a subroutine or function. The syntax of the RET instruction is

RET

For example, RET returns control to the instruction following the CALL instruction that called the subroutine.

String Instructions

String instructions are used to manipulate strings of characters in memory.

MOVS
This instruction is used to move a byte or a word from the source to the destination and update the pointers. The syntax of the MOVS instruction is

MOVS destination, source

For example, MOVS AL, [SI] moves the byte pointed to by the SI register to the AL register and updates the SI register.
LODS
This instruction is used to load a byte or a word from the source and store it in the destination register, and update the pointer. The syntax of the LODS instruction is

LODS destination, source

For example, LODS AL, [SI] loads the byte pointed to by the SI register into the AL register and updates the SI register.
STOS
This instruction is used to store a byte or a word from the source in the destination and update the pointer. The syntax of the STOS instruction is

STOS destination, source

For example, STOS [DI], AL stores the contents of the AL register into the memory location pointed to by the DI register and updates the DI register.
Loading...

Search