Microprocessor After Mid
Microprocessor After Mid
MOV AX, BX instruction transfers the word contents of the source register (BX) into the destination register (AX).
A MOV instruction always copies the source data into the destination.
Effective Address (EA) represents the offset address of the data within a segment.
Data Addressing Mode are as follows
1.Register Addressing Mode
2. Register relative Addressing Mode
3. Register Indirect Addressing Mode
4.RIP relative Addressing Mode
5. Immediate Addressing Mode
6. Direct Data Addressing Mode
7. Index Addressing Mode
8. Index relative Addressing Mode
9. Scaled Index Addressing Mode
10.Base Addressing Mode
11. Base relative Addressing Mode
12. Base plus Index Addressing Mode
13. Base relative plus Index Addressing Mode
Register Addressing Mode:
In this addressing mode, the data present in register is moved or manipulated and the result is stored in
the register. The microprocessor contains the following 8-bit registers used with register addressing: AX,
BX, CX, DX, SP, BP, SI, and DI.
Examples: MOV AL, BL; copies content of BL to AL and ADC BX, DX; adds the content of BX, carry
flag and DX and store result in BX
Note: Never mix an 8-bit register with a 16-bit register, an 8-bit register with a 32-bit register, or a l6-bit
register with a 32-bit register because this is not allowed by the microprocessor, and this will result in an
error when assembled. For example, MOV AX, AL instruction is not allowed because the registers are
of different sizes
None of the MOV instructions affect the flag bits. The flag bits are normally modified by arithmetic or
logic instructions. The code segment register is not changed by a MOV instruction because the address
of the next instruction is found by both IP/EIP and CS. If only CS were changed, the address of the next
instruction would be unpredictable. Therefore, changing the CS register with a MOV instruction is
not allowed.
Example: Let initially CX = 1234H and BX = 76AFH.
MOV BX, CX; This instruction moves (copies) 1234H from register CX into register BX. This overwrites the old
content (76AFH) of register BX, but the contents of CX remain unchanged. The contents of the destination register
or destination memory location change for all instructions except the CMP and TEST instructions. Note that this
instruction does not affect the leftmost 16 bits of register EBX.
The displacement is a number added/subtracted to the register within the [ ]. A displacement also can be an
offset address appended to the front of the [], as in MOV AL, DATA [DI].
In the 8086–80286 microprocessors, the value of the displacement is limited to a 16-bit signed number
with a value ranging between +32,767 (7FFFH) and –32,768 (8000H) whereas in the 80386 and above,
a 32-bit displacement is allowed with a value ranging between +2,147,483,647 (7FFFFFFFH) and -
2,147,483,648 (80000000H).
Examples of register relative addressing
MOV ARRAY[EBX],EAX 32 bits Copies EAX into the data segment memory
location addressed by ARRAY plus EBX
Register Indirect Addressing: In this addressing mode, a byte or word is transferred
between a register and a memory location addressed by an index or base register. The
index and base registers are BP, BX, DI, and SI.
The [ ] symbols denote indirect addressing in assembly language.
Example: If register BX contains 1000H and the MOV AX, [BX] instruction
executes, the word contents of data segment offset address 1000H are copied into
register AX.
data segment is used by default with register indirect addressing or any other
addressing mode that uses BX, DI, or SI to address memory. The stack segment is
used by default if the BP register addresses memory.
Examples of register indirect addressing