6- EU 8088

advertisement
INTEL 8086/8088 ARCHITECTURE
 Tells
the BIU from where to fetch the
instructions or data, decodes instructions and
executes instructions
 It contains:
 Control
Circuit
 Instruction Decoder
 Arithmetic Logic Unit (ALU)
 Registers



Flag Registers
GPRs
Pointers and Index Registers
 The
control circuit in the EU directs the
internal operations
A
decoder in the EU translates the
instructions fetched from memory into a
series of actions which the EU performs
 ALU is 16-bit. It can add, subtract, AND, OR,
XOR, increment, decrement, complement
and shift binary numbers
 GPRs:
 The
registers AX, BX, CX and DX are the general
purpose 16-bit registers
 AX is used as 16-bit accumulator, with the lower
8-bits of AX designated as AL and higher 8-bits as
AH
 AL can be used as an 8-bit accumulator for 8-bit
operations
 The register BX is used as offset storage for
forming physical addresses in case of certain
addressing modes
 GPRs:


The register CX is used as a default counter in
case of string and loop instructions
DX is a GPR known as Data Register which may be
used as an implicit operand or destination in case
of a few instructions
 Pointer

and Index Registers:
The pointers contain offset within the particular
segments
Pointer
 The
and Index Registers:
pointers IP, BP and SP usually contain offsets
within the code, data and stack segments
respectively
 The index registers are used as GPRs as well as
for offset storage in case of indexed, based
indexed and relative based indexed addressing
modes
 SI is generally used to store the offset of source
data in data segment while DI is used to store the
offset of destination in data or extra segment
 The index registers are particularly useful for
string manipulations
 Flag


Registers:
The 8086/8088 flag register contents indicate the
result of computations in the ALU
It also contains some flag bits to control the CPU
operations


Condition Code Flags or Status Flags
Machine Control Flags
 Condition



Flags:
The condition flag register is the lower byte of
the 16-bit flag register along with the overflow
flag
The condition flag is identical to 8085 flag
register, with an additional overflow flag, which
is not present in 8085
This part of the flag register of 8086/8088
reflects the results of the operations performed
by ALU
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
X
X
X
X
OF
DF
IF
TF
SF
ZF
X
AF
X
PF
X
CF
16-bit Flag Register
 Carry
Flag (CF):
 Whenever
after an operation, a carry or borrow
is generated, the CF becomes 1
MOV AH, 80h
MOV BH, F0h
ADD AH,BH
 Since the addition of 80 and FO will be 170h, so a
carry will be generated and hence the CF=1
 Parity
 It
Flag (PF):
will contain the Parity of the lower 8-bit of the
destination after an instruction execution
 It will be 1, if the total number of 1s in the
destination is even, otherwise 0
MOV CH, F0h
MOV AH, 80h
SUB CH, AH
 Since the subtraction of 80 from F0 will be 70
(0111 0000), so the PF = 0
 Auxiliary
 It
Flag (AF):
will become 1, if upon an operation there is a
carry from bit 3 (i.e. 4th bit) to the next higher
bit
 This flag cannot be accessed directly by the user,
but the processor uses it for few instructions
MOV AL, F8h
MOV BL, 88h
ADD AL, BL
 Since the addition of F8 and 88 will generate a
carry from bit 3 to bit 4, hence AF = 1
 Zero
 If
Flag (ZF):
upon an operation, the destination becomes
zero, this flag is set to 1
MOV CL, F0h
MOV BL, F0h
SUB CL, AL
 Since subtracting F0 from F0 will be zero, so ZF =
1
 Sign
Flag (SF):
 This
flag will show the sign of the destination
 It is 0 for positive and 1 for negative
MOV AL, 20h
MOV BL, 28h
ADD AL, BL
 Since the result of this addition is a positive
number so SF = 0
 Overflow
 This
Flag (OF):
flag is set, whenever there is an overflow/
underflow in the destination
 It means that the result of a signed operation
produced cannot be stored in the destination,
i.e. result is beyond the value which can be
stored
 If we are operating on two n-bit numbers, an
overflow condition is when there is a carry/
borrow from MSB and no carry/ borrow from
NMSB (next MSB) or vice versa
 Overflow
Flag (OF):
MOV AL, B5h; AL = -75d
MOV BL, C9h; BL = -55d
ADD AL, BL
 Addition of -75 and -55 is equal to -130, but in an
8-bit register, the max negative value, which can
be stored is -128, so OF = 1
 Control

Flags:
These flags are user-defined to change the
control of program



Direction Flag (DF)
Interrupt Flag (IF)
Trap Flag (TF)
 Direction


Flag(DF):
It is used for string instructions
If 0, strings are processed from lowest address
towards higher address, whereas for 1, it is
otherwise
 Interrupt

Flag (IF):
If 1, maskable interrupts are to be served by the
processor when they come, otherwise not
 Trap

Flag (TF):
If 1, a software interrupt instruction will be
executed after each instruction
Download