Flags are special indicators used by the processor to signal the outcome of operations, these are stored in a special register called the flags register. Some common flags include:

Zero Flag (ZF) – 1 if the result of an operation is zero; otherwise, it’s 0.

Sign Flag (SF) – 1 if the result is negative; otherwise, it’s 0.

Overflow Flag (OF) – 1 if an arithmetic overflow occurs, meaning the result is too large to fit the destination operand.

Carry Flag (CF) – 1 if there’s a carry-out (for addition) or borrow (for subtraction) from the most significant bit.

Parity Flag (PF) – 1 if the number of set bits in the result is even; otherwise, it’s 0.

Auxiliary Carry Flag (AF) – Used for binary-coded decimal (BCD) arithmetic; it’s set when there’s a carry-out from the lower nibble (4 bits).

Memory addressing in assembly language is a method by which instructions refer to data stored in memory.

Immediate Addressing – The operand is a constant value directly specified in the instruction.

E.g. MOV EAX, 1234h ; Move the immediate value 1234h into EAX

Direct Addressing – The operand specifies the memory address directly

E.g. MOV EAX, [1234h] ; Move the value at memory address 1234h into EAX

Register Addressing – The operand is a register, and the data is in the register.

E.g. MOC EAX, EBX ; Move the value in register EBX into EAX

Register Indirect Addressing – The operand is a register containing the address of the data.

E.g. MOV EBX, 1234h

MOV EAX, [EBX] ; Move the value at the address in EBX into EAX

Based Addressing – Combines a base register with an offset to form the effective address.

E.g. MOV EBX, 100h

MOV EAX, [EBX + 10h] ; Move the value at the address (BX + 10h) into EAX

Indexed Addressing – Use an index register to modify the address.

E.g. MOV ESI, 10h

MOV EAX, [ESI] ; Move the value at the address in ESI into EAX

Base-Indexed Addressing – Combines both a base register and an index register to form the address.

E.g. MOV EBX, 100h

MOV ESI, 20h

MOV EAX, [EBX + ESI] ; Move the value at the address (EBX + ESI) into EAX

Based-Indexed with Displacement – Combines a base register, an index register, and a displacement to form the address.

MOV EBX, 1000h

MOV ESI, 20h

MOV EAX, [EBX + ESI + 10h] ; Move the value at the address (EBX + ESI + 10h) into EAX

LEAVE A REPLY

Please enter your comment!
Please enter your name here