0% found this document useful (0 votes)
64 views5 pages

Digital Assignment - 1 Microprocessor and Interfacing

The document discusses the register organization of the 8086 microprocessor and the typical applications of each register. It describes the general purpose registers AX, BX, CX, and DX and their uses. It also explains the segment registers CS, DS, SS, and ES and how they are used to address different segments of memory. Finally, it outlines the pointer registers, index registers, conditional flags, and control flags of the 8086 and their functions.

Uploaded by

Yellow Moustache
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views5 pages

Digital Assignment - 1 Microprocessor and Interfacing

The document discusses the register organization of the 8086 microprocessor and the typical applications of each register. It describes the general purpose registers AX, BX, CX, and DX and their uses. It also explains the segment registers CS, DS, SS, and ES and how they are used to address different segments of memory. Finally, it outlines the pointer registers, index registers, conditional flags, and control flags of the 8086 and their functions.

Uploaded by

Yellow Moustache
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DIGITAL ASSIGNMENT -1

Microprocessor and Interfacing


18BCE2301

Devangshu Mazumder

Q 1. Explain the concept of segmented memory? What are its


advantages?

Segmentation is the process in which the main memory of the computer is divided into
different segments and each segment has its own base address. It is basically used to enhance
the speed of execution of the computer system, so that processor is able to fetch and execute
the data from the memory easily and fast.

Need for Segmentation –


The Bus Interface Unit (BIU) contains four 16 bit special purpose registers (mentioned
below) called as Segment Registers.

• Code segment register (CS): is used for addressing memory location in the code
segment of the memory, where the executable program is stored.
• Data segment register (DS): points to the data segment of the memory where the
data is stored.
• Extra Segment Register (ES): also refers to a segment in the memory which is
another data segment in the memory.
• Stack Segment Register (SS): is used for addressing stack segment of the memory.
The stack segment is that segment of memory which is used to store stack data.

Types Of Segmentation –

1. Overlapping Segment – A segment starts at a particular address and its maximum


size can go up to 64kilobytes. But if another segment starts along with this
64kilobytes location of the first segment, then the two are said to be Overlapping
Segment.
2. Non-Overlapped Segment – A segment starts at a particular address and its
maximum size can go up to 64kilobytes. But if another segment starts before this
64kilobytes location of the first segment, then the two segments are said to be Non-
Overlapped Segment.

Rules of Segmentation

Segmentation process follows some rules as follows:

• The starting address of a segment should be such that it can be evenly divided by 16.
• Minimum size of a segment can be 16 bytes and the maximum can be 64 kB.
The main advantages of segmentation memory are as follows:

• It provides a powerful memory management mechanism.

• Data related or stack related operations can be performed in different segments.


• Code related operation can be done in separate code segments.

• It allows to processes to easily share data.

• It allows to extend the address ability of the processor, i.e. segmentation allows the
use of 16 bit registers to give an addressing capability of 1 Megabytes. Without
segmentation, it would require 20 bit registers.

• It is possible to enhance the memory size of code data or stack segments beyond 64
KB by allotting more than one segment for each area.
Q2. Draw the register organization of 8086 and explain typical
applications of each register.
ACCUMULATOR
AX
AH Al BASE
BX BH BL
COUNT
CH CL
CX
DH DL DATA

DX
STACK POINTER
SP
BP BASE POINTER
SI SOURCE POINTER
DI
DESTINATION POINTER

IP INSTRUCTION POINTER

FLAGS(H) FLAGS(L) STATUS FLAG

CS CODE SEGMENT
DS DATA SEGMENT
SS
STACK SEGMENT
ES
EXTRA SEGMENT
The registers AX, BX, CX, and DX are the general 16-bit registers.

AX Register: Accumulator register consists of two 8-bit registers AL and AH, which
can be combined together and used as a 16- bit register AX. AL in this case contains the
low-order byte of the word, and AH contains the high-order byte. Accumulator can be
used for I/O operations, rotate and string manipulation.

BX Register: This register is mainly used as a base register. It holds the starting base
location of a memory region within a data segment. It is used as offset storage for
forming physical address in case of certain addressing mode.

CX Register: It is used as default counter or count register in case of string and loop
instructions.

DX Register: Data register can be used as a port number in I/O operations and implicit
operand or destination in case of few instructions. In integer 32-bit multiply and divide
instruction the DX register contains high-order word of the initial or resulting number.

Segment registers:
To complete 1Mbyte memory is divided into 16 logical segments. The complete
1Mbyte memory segmentation is as shown in fig 1.5. Each segment contains 64Kbyte of
memory. There are four segment registers.

Code segment (CS) is a 16-bit register containing address of 64 KB segment with


processor instructions. The processor uses CS segment for all accesses to instructions
referenced by instruction pointer (IP) register. CS register cannot be changed directly.
The CS register is automatically updated during far jump, far call and far return
instructions. It is used for addressing a memory location in the code segment of the
memory, where the executable program is stored.

Stack segment (SS) is a 16-bit register containing address of 64KB segment with
program stack. By default, the processor assumes that all data referenced by the stack
pointer (SP) and base pointer (BP) registers is located in the stack segment. SS register
can be changed directly using POP instruction. It is used for addressing stack segment of
memory. The stack segment is that segment of memory, which is used to store stack data.
Data segment (DS) is a 16-bit register containing address of 64KB segment with
program data. By default, the processor assumes that all data referenced by general
registers (AX, BX, CX, DX) and index register (SI, DI) is located in the data segment.
DS register can be changed directly using POP and LDS instructions. It points to the data
segment memory where the data is resided.

Extra segment (ES) is a 16-bit register containing address of 64KB segment, usually
with program data. By default, the processor assumes that the DI register references the ES
segment in string manipulation instructions. ES register can be changed directly using POP
and LES instructions. It also refers to segment which essentially is another data segment of
the memory. It also contains data.

Pointers and index registers.


The pointers contain within the particular segments. The pointers IP, BP, SP
usually contain offsets within the code, data and stack segments respectively
Stack Pointer (SP) is a 16-bit register pointing to program stack in stack segment.

Base Pointer (BP) is a 16-bit register pointing to data in stack segment. BP register is
usually used for based, based indexed or register indirect addressing.

Source Index (SI) is a 16-bit register. SI is used for indexed, based indexed and register
indirect addressing, as well as a source data addresses in string manipulation instructions.

Destination Index (DI) is a 16-bit register. DI is used for indexed, based indexed and
register indirect addressing, as well as a destination data address in string manipulation
instructions.

Conditional Flags
Conditional flags are as follows:

Carry Flag (CY): This flag indicates an overflow condition for unsigned integer
arithmetic. It is also used in multiple-precision arithmetic.

Auxiliary Flag (AC): If an operation performed in ALU generates a carry/barrow from


lower nibble (i.e. D0 – D3) to upper nibble (i.e. D4 – D7), the AC flag is set i.e. carry given
by D3 bit to D4 is AC flag. This is not a general-purpose flag, it is used internally by the
Processor to perform Binary to BCD conversion.

Parity Flag (PF): This flag is used to indicate the parity of result. If lower order 8-bits of
the result contains even number of 1’s, the Parity Flag is set and for odd number of 1’s,
the Parity flag is reset.

Zero Flag (ZF): It is set; if the result of arithmetic or logical operation is zero else it is
reset.

Sign Flag (SF): In sign magnitude format the sign of number is indicated by MSB bit. If
the result of operation is negative, sign flag is set.

Control Flags
Control flags are set or reset deliberately to control the operations of the execution unit.
Control flags are as follows:

Trap Flag (TF): It is used for single step control. It allows user to execute one
instruction of a program at a time for debugging. When trap flag is set, program can be
run in single step mode.

Interrupt Flag (IF): It is an interrupt enable/disable flag. If it is set, the maskable


interrupt of 8086 is enabled and if it is reset, the interrupt is disabled. It can be set by
executing instruction sit and can be cleared by executing CLI instruction.

Direction Flag (DF): It is used in string operation. If it is set, string bytes are accessed
from higher memory address to lower memory address. When it is reset, the string bytes are
accessed from lower memory address to higher memory address.

You might also like