CSE-3103: Microprocessor and Microcontroller
Dept. of Computer Science and Engineering
University of Dhaka
Prof. Sazzad M.S. Imran, PhD
Dept. of Electrical and Electronic Engineering
[Link]
Registers of 8086
Status Registers
Flag register or Program Status Word (PSW)
16-bit register.
7 bits remain unused,
9 are used.
9 flags
6 condition flags + 3 control flags.
control flags = TF, IF, DF.
condition flags = OF, SF, ZF, AF, PF, CF.
CF = 1
addition = carry out of MSB position,
subtraction = borrow is needed out of
MSB position.
Registers of 8086
Status Registers
PF = 1
lower 8-bits of result = even number of 1’s.
AF = 1
addition = carry out of bit 3,
subtraction = borrow required from
bit 4 into bit 3.
ZF = 1
arithmetic or logical operation = zero.
SF = 1
MSB of result of operation is 1.
used for unsigned numbers.
Registers of 8086
Status Registers
OF = 1
result is too large = doesn’t fit in destination.
used for signed arithmetic operation.
Control Flags
set/reset by programmer.
TF = 1
processor operates in single stepping mode.
interrupt is recognized, TF flag is cleared.
CPU runs ISS (interrupt service subroutine).
IRET
CPU returns to main program from ISS,
TF flag status is restored.
Registers of 8086
Control Flags
TF = set/reset
push flag register on stack,
change TF as desired,
pop flag register from stack.
IF = 1
maskable interrupt INTR is enabled.
interrupt is recognized, IF flag is cleared.
IRET in ISS
returns to main program,
IF flag status is restored.
STI = IF set instruction,
CLI = IF clear instruction.
8086 is reset IF is cleared.
Registers of 8086
Control Flags
DF
used in string operations.
STD = DF set instruction,
CLD = DF clear instruction.
DF = 1
DI and SI are automatically decremented,
access string from highest memory location
down to lowest memory location.
Registers of 8086
Pointers and Index Group of Registers:
SP and BP = pointer registers.
SI and DI = index registers.
All 4 16-bit registers.
store offset addresses of memory locations.
SI = 2000H,
MOV AH, [SI]
AH FFH
[SI+1:SI] = ABFFH
SI, DI in string instructions
SI source index register,
source address = DS×10 + SI
DI destination index register,
destination address = ES×10 + DI
Registers of 8086
Pointers and Index Group of Registers:
SP stack pointer.
contains offset address or stack top address.
stack address = [SS]×10 + [SP]
BP base pointer.
used to access data area in stack segment.
stack address = [SS]×10 + [BP]
IP instruction pointer.
contains offset address of next instruction to be fetched.
cannot be programmed by programmer.
SI, DI, BP
also used as general purpose registers.