The Control Flags Can Be Set/reset by The Programmer
The Control Flags Can Be Set/reset by The Programmer
ALDOURI
The status flags are set/reset depending on the results of some arithmetic or
(TF=0 Normal operation TF=1 Single Step operation)
9
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
Memory Organization
8086/8088µP, via its 20-bit address bus, can address 220 = 1,048,576 bytes
or (1 Mbyte) of memory locations. Thus the memory space of 8086µP is
1,048,576 bytes or 524,288 words. The memory map of 8086µP as shown,
where the whole memory space starting from 00000H to FFFFFH.
The 8086µP operate in the Real mode memory addressing. Real mode
operation allows the microprocessor to address only the first 1 Mbyte of
memory. Even though the 8086 has a 1 Mbyte address space, not all this
memory is active at one time. Actually, the 1 Mbytes of memory are partitioned
into 64 Kbyte (65,536) segments. The 8086µP allows four memory segments.
The figure shows these memory segments.
8
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
The logical address, also known as the effective address or offset address
Logical address, segment address and physical address are explained as follows:
For example if (DS)=2000H and the Logical address is 1234H then the physical
address is: PA = (2000)*10 + 1234H = 20000H + 1234H = 21234H
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
Destination(D) Source(S)
Operation ,
reg. / mem. reg. / mem.
An instruction consists of an op-code and operands. The operand may reside in
the accumulator, or in a general purpose register or in a memory location.
Examples:
MOV AX , BX ; copy the content of BX to AX.
ADD AL , 12H ; add 12H to AL and store the result in AL.
An addressing mode is a method of specifying an operand. The following are
the different addressing modes of 8086µP:
1. Register Addressing Mode: The operands both are registers (8-bit or 16-
bit). Some examples are:
MOV AX , BX
ADD AL , BH
2. Immediate Addressing Mode: The source can be either 8-bit or 16-bit
number and the destination is a register . Some examples are:
MOV AL , 83H
ADD BX , 1284H
3. Memory Addressing Mode: One of the operands is a memory location. The
different memory addressing modes are:
a) Direct Addressing Mode: The effective address of the specified memory
location is given directly between [ ] brackets, for example: (DS)=1000H
MOV AL , [3000H]
Note: The default
{ } { } segment register is DS
SI
{ } { } { }
{ } { } { }
For example if (BX) = 2000H , (DI) = 0030H and (DS) = 1000H then the
instruction MOV CX , [BX + DI] load the register CX with 1040H form
memory locations 12030H and 12031H.
PA = 10000 + [2000H + 0030H] = 12030H
0030H
{ } { } { } { }
BP
SS
(SS) x 10H
The table below shows the operand that stores the effective address and the
default segment register used to form the physical address
Note:
1. CS : IP together determine the address of the first instruction to execute.
In this way the first instruction in CS being execution, if the first
instruction is two byte long, the processor increment IP by 2 to indicate
the next instruction.
2. Segment override prefix means that we can use any segment register to
form the physical address as follows:
MOV AX , ES : [2000H]
ADD SS : [BX+SI] , DX
AND CS : [BP] , AL