3160712-MPI Study Material Updated
3160712-MPI Study Material Updated
S eme s ter -6
Study Material
Academic Year: 2023-2024
1. Introduction to Microprocessor
Definition:
• “The microprocessor is a multipurpose, clock driven, register based, digital-integrated
circuit which accepts binary data as input, processes it according to instructions stored in
its memory, and provides results as output.”
• “Microprocessor is a computer Central Processing Unit (CPU) on a single chip that
contains millions of transistors connected by wires.”
Introduction:
• A microprocessor is designed to perform arithmetic and logic operations that make use
of small number-holding areas called registers.
• Typical microprocessor operations include adding, subtracting, comparing two numbers,
and fetching numbers from one area to another.
2. Components of Microprocessor
• Microprocessor is capable of performing various computing functions and making
decisions to change the sequence of program execution.
• The microprocessor can be divided into three segments as shown in the figure,
Arithmetic/logic unit (ALU), register array, and control unit.
• These three segment is responsible for all processing done in a computer
Array
(ALU)
Control unit
• The control unit provides the necessary timing and control signals to all the operations
in the microcomputer.
• It controls and executes the flow of data between the microprocessor, memory and
peripherals.
• The control bus is bidirectional and assists the CPU in synchronizing control signals to
internal devices and external components.
• This signal permits the CPU to receive or transmit data from main memory.
2. PROM (Programmable Read Only Memory): The basic function is same as that of
masked ROM. but in PROM, we have fuse links. Depending upon the bit pattern, the
fuse can be burnt or kept intact. This job is performed by PROM programmer.
To do this, it useshigh current pulse between two lines. Because ofhigh current, the
fuse will getburnt; effectively making two lines open. Once a PROM is programmed
we cannot change connections, only a facility provided over masked ROM is, the user
can load his program in it. The disadvantage is a chance of re-growing of the fuse and
changes the programmed data because of aging.
3. EPROM (Erasable Programmable Read Only Memory): the EPROM is programmable
by the user. It uses MOS circuitry to store data. They store 1’s and 0’s in form of charge.
The information stored can be erased by exposing the memory to ultraviolet light
which erases the data stored in all memory locations. For ultraviolet light, a quartz
window is provided which is covered during normal operation. Upon erasing it can be
reprogrammed by using EPROM programmer. This type of memory is used in a project
developed andforexperiment use. The advantage is it canbe programmed erased and
reprogrammed. The disadvantage is all the data get erased even if you want to change
single data bit.
4. EEPROM: EEPROM stands for electrically erasable programmable read only memory.
This is similar to EPROM except that the erasing is done by electrical signals instead of
ultraviolet light. The main advantage is the memory location can be selectively erased
and reprogrammed. But the manufacturing process is complex and expensive so do
not commonly used.
The RAM is also called as read/write memory. The RAM is a volatile type of memory. It
allows the programmer to read or write data. If theuser wants tocheck theexecution ofany
program, user feeds the program in RAM memory and executes it. The result of execution is
then checked by either reading memory location contents or by register contents.
1. SRAM(Static RAM): SRAM consists of the flip-flop; using either transistor or MOS.
for each bit we require one flip-flop. Bit status will remain as it is; unless and until
you perform next write operation or power supply is switched off.
Advantages of SRAM:
• Fast memory (less access time)
• Refreshing circuit is not required.
Disadvantages of SRAM:
• Low package density
• Costly
2. DRAM (Dynamic RAM): In this type of memory a data is stored in form of charge in
capacitors. When data is 1, the capacitor will be charged and if data is 0, the
capacitor will not be charged. Because of capacitor leakage currents, the data will
notbeheldbythesecells.SotheDRAMsrequirerefreshingofmemorycells.Itisa
process in which same data is read and written after a fixed interval.
Advantages of DRAM:
Secondary Memory
• Magnetic Disk: The Magnetic Disk is Flat, circular platter with metallic coating that
is rotated beneath read/write heads. It isa Random access device; read/write head
can be moved to any location on the platter
• Hard Disk: Another form of auxiliary storage is a hard disk. A hard disk consists of
oneormorerigidmetalplatescoatedwithametaloxidematerialthatallowsdata
tobemagnetically recorded on the surface of the platters. Thehard disk platters
spin at 5 a high rate of speed, typically 5400 to 7200 revolutions per minute
(RPM).Storage capacities of hard disks for personal computers range from 10 GB
to 120 GB (one billion bytes are called a gigabyte).
• Optical Disks: Optical Mass Storage Devices Store bit values as variations in light
reflection. They have higher area density & longer data life than magnetic storage.
They are also standardized and relatively inexpensive. Their Uses: read-only
storage with low performance requirements, applications with high capacity
requirements & where portability in a standardized format is needed.
Types of Optical Disk
1. CD-ROM (read only)
2. CD-R: (record) to a CD
3. CD-RW: can write and erase CD to reuse it (re-writable)
4. DVD(Digital Video Disk)
Memory-Mapped I/O:-
• The MPU uses 16 address lines to identify an I/O device.
• This is similar to communicating with a memory location.
• Usethesamecontrol signals(MEMRorMEMW)andinstructionsasthoseofmemory.
• The MPU views these I/O devices as if they were memory locations.
• There are no special I/O instructions.
• It can identify 64k address shared between memory & I/O devices.
1. Write down main features of 8085 microprocessor.
• It is an 8 bit microprocessor.
• It is manufactured with N-MOS technology.
• It has 16-bit address bus and hence can address up to 216 = 65536 bytes (64KB) memory locations
through A0-A15
• The first 8 lines of address bus and 8 lines of data bus are multiplexed AD0 – AD7
• Data bus is a group of 8 lines D0 – D7
• It supports external interrupt request. .
• A 16 bit program counters (PC)
• A 16 bit stack pointer (SP)
• Six 8-bit general purpose register arranged in pairs: BC, DE, HL.
• It requires a signal +5V power supply and operates at 3.2 MHZ single phase clock.
• It is enclosed with 40 pins DIP (Dual in line package).
Register Unit:
MUX/DEMUX unit
• This unit is used to select a register out of all the available registers.
• This unit behaves as a MUX when data is going from the register to the internal data bus.
• It behaves as a DEMUX when data is coming to a register from the internal data bus of the
microprocessor.
• The register select will behave as the function selection lines of the MUX/DEMUX.
Instruction Register
• This register holds the machine code of the instruction.
• When microprocessor executes a program it reads the opcode from the memory, this opcode is stored in
the instruction register.
Accumulator
• The accumulator is an 8-bit register that is a part of ALU.
• This register is used to store 8-bit data and perform arithmetical and logical operations.
• The result of an operation is stored in the accumulator.
• It is also identified as register A.
Flags register
• Flag register includes five flip-flops, which are set or reset after an operation according to the data
conditions of the result in the accumulator and other registers.
• They are called zero (Z), carry (CY), sign (S), parity (P) and auxiliary carry (AC) flags; their bit positions in
the flag register are shown in fig.
• The microprocessor uses these flags to set and test data conditions.
Interrupt Control
• The interrupt control unit has 5 interrupt inputs TRAP,RST 7.5, RST 6.5, RST 5.5 & INTR and one
acknowledge signal INTA.
• It controls the interrupt activity of 8085 microprocessor.
Serial IO control
• 8085 serial IO control provides two lines, SOD and SID for serial communication.
• The serial output data (SOD) line is used to send data serially and serial input data line (SID) is used to
receive data serially.
• The flags are stored in the 8-bit register so that the programmer can examine these flags by accessing
the register through an instruction.
• These flags have critical importance in the decision-making process of the microprocessor.
• The conditions (set or reset) of the flags are tested through the software instructions.
• For instance, JC (jump on carry) is implemented to change the sequence of a program when CY flag is
set.
Z (Zero) Flag:
• This flag indicates whether the result of mathematical or logical operation is zero or not.
• If the result of the current operation is zero, then this flag will be set, otherwise reset.
CY (Carry) Flag:
• This flag indicates, whether, during an addition or subtraction operation, carry or borrow is generated or
not, if generated then this flag bit will be set.
1 0 0 0 1 1 0 0
0 0 1 0 1 0 1 1
1 0 1 1 0 1 1 1
Figure: Auxiliary Carry.
• As shown in the fig., a carry is generated from D3 bit position and propagates to the D4 position. This
carry is called auxiliarycarry.
S (Sign) Flag:
• Sign flag indicates whether the result of a mathematical operation is negative or positive.
• If the result is positive, then this flag will reset and if the result is negative this flag will be set.
• This bit, in fact, is a replica of the D7 bit.
P (Parity) Flag:
• Parity is the number of 1’s in a number.
• If the number of 1’s in a number is even then that number is known as even parity number.
• If the number of 1’s in a number is odd then that number is known as an odd parity number.
• This flag indicates whether the current result is of even parity (set) or of odd parity (reset).
4. Explain 8085 pin diagram.
7. Explain T-States
• T-States are defined as one subdivision of operation performed in one clock period.
• These sub divisions are internal states synchronized with system clock & each T-state is precisely equal
to one clock period.
Figure: T-States.
Registers
• 6 general purpose registers to store 8-bit data B, C, D, E, H & L.
• Can be combined as register pairs – BC, DE, and HL to perform 16-bit operations.
• Used to store or copy data using data copy instructions.
Accumulator
• 8 - bit register, identified as A
• Part of ALU
• Used to store 8-bit data to perform arithmetic & logical operations.
• Result of operation is stored in it.
Flag Register
• ALU has 5 Flag Register that set/reset after an operation according to data conditions of the result in
accumulator & other registers.
• Helpful in decision making process of Microprocessor
• Conditions are tested through software instructions
• For e.g.
• JC (Jump on Carry) is implemented to change the sequence of program when CY is set.
Program Counter
• 16-bit registers used to hold memory addresses.
• Size is 16-bits because memory addresses are of 16-bits.
• Microprocessor uses PC register to sequence the execution of instructions.
• Its function is to point to memory address from which next byte is to be fetched.
• When a byte is being fetched, PC is incremented by 1 to point to next memory location.
Stack Pointer
• Used as memory pointer
• Points to the memory location in R/W memory, called Stack.
• Beginning of stack is defined by loading a 16-bit address in the stack pointer.
Address Bus
• Group of 16 lines generally identified as A0 to A15.
• It is unidirectional i.e. bits flow from microprocessor to peripheral devices.
• 16 address lines are capable of addressing 65536 memory locations.
• So, 8085 has 64K memory locations.
Data Bus
• Group of 8 lines identified as D0 to D7.
• They are bidirectional i.e. data flow in both directions between microprocessor, memory & peripheral.
• 8 data lines enable microprocessor to manipulate data ranging from 00H to FFH (28=256 numbers).
• Largest number appear on data bus is 1111 1111 => (255)10.
• As Data bus is of 8-bit, 8085 is known as 8-bit Microprocessor.
Control Bus
• It comprises of various single lines that carry synchronization, timing & control signals.
• These signals are used to identify a device type with which MPU intends to communicate.
• The higher-order bus remains on the bus for three clock periods. However, the low-order address is lost
after the first clock period.
• This address need to be latched and used for identifying the memory address. If the bus AD7-AD0 is used
to identify the memory location (2005H), the address will change to 204FH after the first clock period.
• Figure shows a schematic that uses a latch and the ALE signal to demultiplex the bus.
• The bus AD7-AD0 is connected as the input to the latch.
• The ALE signal is connected to the Enable pin of the latch, and the output control signal of the latch is
grounded.
• Figure shows that the ALE goes high during T1. And during T1 address of lower-order address bus is store
into the latch.
12. Explain Memory Interfacing
• When we are executing any instruction, we need the microprocessor to access the memory for reading
instruction codes and the data stored in the memory.
• For this, both the memory and the microprocessor requires some signals to read/write to/from registers.
• The interfacing circuit therefore should be designed in such a way that it matches the memory signal
requirements with the signals of the microprocessor.
• Figure shows that four different control signals are generated by combining the signals RD (bar), WR
(bar), and IO/M (bar).
• The signal IO/M (bar) goes low for the memory operation. This signal is ANDed with RD (bar) and WR
(bar) signals b using the 74LS32 quadruple two-input OR gates, as shown in figure 4.5.
• The OR gates are functionally connected as negative NAND gates. When both input signals go low, the
output of the gates go low and generate MEMR (bar) and MEMW (bar) control signals.
• When the IO/M (bar) signal goes high, it indicates the peripheral I/O operation.
• Figure shows that this signal is complemented using the Hex inverter 74LS04 and ANDed with the RD
(bar) and WR (bar) signals to generate IOR (bar) and IOW (bar) control signals.
1. 8085 instruction set.
Sr. Instruction Description Example
DATA TRANSFER INSTRUCTIONS
1. MOV Rd, Rs This instruction copies the contents of the source MOV B, C
MOV M,Rs register into the destination register; the contents of MOV B, M
MOV Rs, M the source register are not altered. If one of the
operands is a memory location, its location is
specified by the contents of the HL registers.
2. MVIRd, data The 8-bit data is stored in the destination register or MVI B, 57H
MVI M, data memory. If the operand is a memory location, its MVI M, 57H
location is specified by the contents of the HL
registers.
3. LDA16-bit address The contentsof amemorylocation, specifiedby a 16- LDA 2034H
bit address in the operand, are copied to the
accumulator. The contents of the source are not
altered.
4. LDAX B/D Reg. pair The contents of the designated register pair point to LDAX B
a memory location. This instruction copies the
contents of that memory location into the
accumulator. The contents of either the register pair
or the memory location are not altered.
5. LXI Reg.-pair, 16-bit data The instruction loads 16-bit data in the register pair LXI H, 2034H
designated in the operand. LXI H, XYZ
6. LHLD 16-bit address The instruction copies the contents of the memory LHLD 2040H
location pointed out by the 16-bit address into
registerLandcopiesthecontentsofthenextmemory
location into register H. The contents of source
memory locations are not altered.
7. STA 16-bit address The contents of the accumulator are copied into the STA 4350H
memory location specified by the operand. This is a
3-byte instruction, the second byte specifies the low-
order address and the third byte specifies the high-
order address.
8. STAXReg. pair The contents of the accumulator are copied into the STAX B
memory location specified by the contents of the
operand (register pair). The contents of the
accumulator are not altered.
Sr. Instruction Description Example
9. SHLD 16-bit address The contents of register L are stored intothe memory SHLD 2470H
location specified by the 16-bit address in the
operand and the contents of H register are stored
into the next memory location by incrementing the
operand. The contents of registers HL are not altered.
This is a 3-byte instruction, the second byte specifies
the low-order address and thethird byte specifies the
high-order address.
10. XCHG The contents of register H are exchanged with the XCHG
contents of register D, and the contents of register L
are exchanged with the contents of register E.
11. SPHL The instruction loads the contents of the H and L SPHL
registers into the stack pointer register, the contents
of the H register provide the high-order address and
the contents of the L register provide the low-order
address. Thecontents of the H andLregisters are not
altered.
12. XTHL The contents of the Lregister are exchanged withthe XTHL
stack location pointed out by the contents of the
stack pointer register. The contents of the H register
are exchanged with the next stack location (SP+1);
however, the contents of the stack pointer register
are not altered.
13. PUSH Reg. pair The contents of the register pair designated in the PUSH B
operand are copied onto the stack in the following PUSH A
sequence. The stack pointer register is decremented
and the contents of the high order register (B, D, H,
A) are copied into that location. The stack pointer
registeris decrementedagainandthecontents ofthe
low-order register (C, E, L, flags) are copied to that
location.
14. POP Reg. pair The contents of the memory location pointed out by POP H
the stack pointer register are copied to the low-order POP A
register (C, E, L, status flags) of the operand. The stack
pointer is incremented by 1 and the contents of that
memory location are copied to the high-order
register (B, D, H, A) of the operand. The stack pointer
register is again incremented by 1.
15. OUT 8-bit port address The contents of the accumulator are copied into the OUT F8H
I/O port specified by the operand.
16. IN 8CH
IN 8-bit port address The contents of the input port designated in the
operand are read and loaded into the accumulator.
ARITHMETIC INSTRUCTIONS
Sr. Instruction Description Example
17. ADD R The contentsof the operand (register ormemory) are ADDB
ADD M added to the contents of the accumulator and the ADD M
result is stored in the accumulator. If the operand is a
memory location, its location is specified by the
contents of the HL registers. All flags are modified to
reflect the result of the
addition.
18. ADCR The contents of the operand (register or memory) ADCB
ADC M and the Carry flag are added to the contents of the ADCM
accumulator and the result is stored in the
accumulator. If the operand is a memory location, its
location is specified by the contents of the HL
registers. All flags are modified to reflect the result of
the addition.
19. ADI 8-bit data The 8-bit data (operand) is added to the contents of ADI 45H
the accumulator and the result is stored in the
accumulator. All flags are modified to reflect the
result of the addition.
20. ACI 8-bit data The8-bit data(operand) andtheCarryflagareadded ACI 45H
to the contents of the accumulator and the result is
stored in the accumulator. All flags are modified to
reflect the result of the addition.
21. DADReg. pair The 16-bit contents of the specified register pair are DAD H
added to the contents of the HL register and the sum
isstoredintheHLregister.Thecontentsofthesource
register pair are not altered. If the result is larger than
16 bits, the CY flag is set. No other flags are affected.
22. SUB R The contentsof theoperand (register ormemory) are SUBB
SUB M subtractedfromthecontents of theaccumulator, and SUB M
the result is stored in the accumulator. If the operand
is a memory location, its location is specified by the
contents of the HL registers. All flags are modified to
reflect the result of the subtraction.
23. SBB R The contents of the operand (register or memory) SBB B
SBB M and the Borrow flag are subtracted from the contents SBB M
of the accumulator and the result is placed in the
accumulator. If the operand is a memory location, its
location is specified by the contents of the HL
registers. All flags are modified to reflect the result of
the subtraction.
Sr. Instruction Description Example
24. SUI 8-bit data The 8-bit data (operand) is subtracted from the SUI 45H
contents of the accumulator and the result is stored
in the accumulator. All flags are modified to reflect
the result of the subtraction.
25. SBI 8-bit data The 8-bit data (operand) and the Borrow flag are SBI 45H
subtracted from the contents of the accumulator and
the result is stored in the accumulator. All flags are
modified to reflect the result of the subtraction.
26. INR R The contents of the designated register or memory INR B
INRM are incremented by 1 and the result is stored in the INR M
same place. If the operand is a memory location, its
location is specified by the contents of the HL
registers.
27. INXR The contents of the designated register pair are INX H
incremented by 1 and the result is stored in the same
place.
28. DCR R The contents of the designated register or memory DCR B
DCR M are decremented by 1 and the result is stored in the DCR M
same place. If the operand is a memory location, its
location is specified by the contents of the HL
registers.
29. DCXR The contents of the designated register pair are DCX H
decremented by 1 and the result is stored in the same
place.
30. DAA The contents of the accumulator are changed from a DAA
binary value to two 4-bit binary coded decimal (BCD)
digits. This is the only instruction that uses the
auxiliary flag to perform the binary to BCD
conversion, and the conversion procedure is
described below. S, Z, AC, P, CY flags are altered to
reflect the results of the operation.
40. CALL 16-bit address The program sequence is transferred to the memory CALL 2034H
location specified by the 16-bit address given in the CALL XYZ
operand. Before the transfer, the address of the next
instruction after CALL (the contents of the program
counter) is pushed onto the stack.
Return from The program sequence is transferred from the subroutine to the
subroutine calling program based on the specified flag of the PSW as
conditionally described below. The two bytes from the top of the stack are
copied into the program counter, and program execution begins
at the new address.
50. RC Return on Carry, Flag Status: CY=1 RC
51. RNC Return on no Carry, Flag Status: CY=0 RNC
52. RP Return on positive, Flag Status: S=0 RP
53. RM Return on minus, Flag Status: S=1 RM
54. RZ Return on zero, Flag Status: Z=1 RZ
55. RNZ Return on no zero, Flag Status: Z=0 RNZ
56. RPE Return on parity even, Flag Status: P=1 RPE
57. RPO Return on parity odd, Flag Status: P=0 RPO
58. PCHL The contents of registers H and L are copied into the PCHL
program counter. The contents of Hare placed asthe
high-order byte and the contents of L as the low-
order byte.
59. RST 0-7 The RST instruction is equivalent to a 1-byte call RST 3
instruction to one of eight memory locations
depending upon the number. The instructions are
generally used in conjunction with interrupts and
inserted using external hardware. However
these can be used as software instructions in a
program to transfer program execution to one of the
eight locations. The addresses are:
Instruction Restart Address
RST 0 0000H
RST 1 0008H
RST 2 0010H
RST 3 0018H
RST 4 0020H
RST 5 0028H
RST 6 0030H
RST 7 0038H
Sr. Instruction Description Example
The 8085 has four additional interrupts and these interrupts generate RST instructions internally
and thus do not require any external hardware.
60. TRAP It restart from address 0024H TRAP
61. RST 5.5 It restart from address 002CH RST 5.5
62. RST 6.5 It restart from address 0034H RST 6.5
63. RST 7.5 It restart from address 003CH RST 7.5
LOGICAL INSTRUCTIONS
64. CMP R The contentsof theoperand (register ormemory) are CMP B
CMP M comparedwiththe contents of the accumulator. Both CMP M
contentsarepreserved.Theresult ofthecomparison
is shown by setting the flags of the PSW as follows:
if (A) < (reg/mem): carry flag is set
if (A) = (reg/mem): zero flag is set
if (A) > (reg/mem): carry and zero flags are reset
65. CPI 8-bit data The second byte (8-bit data) is compared with the CPI 89H
contents of the accumulator. The values being
compared remain unchanged. The result of the
comparison is shown by setting the flags of the PSW
as follows:
if (A) < data: carry flag is set
if (A) = data: zero flag is set
if (A) > data: carry and zero flags are reset
66. ANA R Thecontentsof theaccumulator are logically ANDed ANA B
ANA M with the contents of the operand (register or ANA M
memory), and theresult is placed in the accumulator.
If the operand is a memory location, its address is
specified by the contents of HL registers. S, Z, P are
modified to reflect the result of the operation. CY is
reset. AC is set.
67. ANI 8-bit data The contentsof theaccumulator arelogically ANDed ANI 86H
with the 8-bit data (operand) and the result is placed
in the accumulator. S, Z, P are modified to reflect the
result of the operation. CY is reset. AC is set.
68. XRA R The contents of the accumulator are Exclusive ORed XRA B
XRAM with the contents of the operand (register or XRA M
memory), and the result is placed in the accumulator.
If the operand is a memory location, its address is
specified by the contents of HL registers. S, Z, P are
modified to reflect the result of the operation. CY and
AC are reset.
Sr. Instruction Description Example
69. XRI 8-bit data The contents of the accumulator are Exclusive ORed XRI 86H
with the 8-bit data (operand) and the result is placed
in the accumulator. S, Z, P are modified to reflect the
result of the operation. CY and AC are reset.
70. ORAR The contents of the accumulator are logically ORed ORA B
ORA M with the contents of the operand (register or ORA M
memory), andthe result is placed in the accumulator.
If the operand is a memory location, its address is
specified by the contents of HL registers. S, Z, P are
modified to reflectthe result of the operation. CY and
AC are reset.
71. ORI 8-bit data The contents of the accumulator are logically ORed ORI 86H
with the 8-bit data (operand) and the result is placed
in the accumulator. S, Z, P are modified to reflect the
result of the operation. CY and AC are reset.
72. RLC Each binary bit of the accumulator is rotated left by RLC
one position. Bit D7 is placed in the position of D0 as
well as in the Carry flag. CY is modified according to
bit D7. S, Z, P, AC are not affected.
73. RRC Each binary bit of the accumulator is rotated right by RRC
one position. Bit D0 is placed in the position of D7 as
well as in the Carry flag. CY is modified according to
bit D0. S, Z, P, AC are not affected.
74. RAL Each binary bit of the accumulator is rotated left by RAL
one position through the Carry flag. Bit D7 is placed
in the Carry flag, and the Carry flag is placed in the
least significant position D0. CY is modified according
to bit D7. S, Z, P, AC are not affected.
75. RAR Each binary bit of the accumulator is rotated right by RAR
one position through the Carry flag. Bit D0 is placed
in the Carry flag, and the Carry flag is placed in the
most significant position D7. CY is modified according
to bit D0. S, Z, P, AC are not affected.
76. CMA The contents of the accumulator are complemented. CMA
No flags areaffected.
77. CMC The Carry flag is complemented. No other flags are CMC
affected.
78. STC The Carry flag is set to 1. No other flags are affected. STC
CONTROL INSTRUCTIONS
79. NOP No operation is performed. The instruction is fetched NOP
and decoded. However no operation is executed.
Sr. Instruction Description Example
80. HLT The CPU finishes executing the current instruction HLT
and halts any further execution. An interrupt or reset
is necessary to exit from the halt state.
81. DI The interrupt enable flip-flop is reset and all the DI
interrupts except the TRAP are disabled. No flags are
affected.
82. EI The interrupt enable flip-flop is set and all interrupts EI
are enabled. No flags are affected. After a system
reset or the acknowledgement of an interrupt, the
interrupt enable flip-flop is reset, thus disabling the
interrupts. This instruction is necessary to re enable
the interrupts (exceptTRAP).
83. RIM This is a multipurpose instruction used to read the RIM
status of interrupts 7.5, 6.5, 5.5 and read serial data
input bit. The instruction loads eight bits in the
accumulator with the following interpretations.
D7 D6 D4 D3 D2 D1 D0
SID I7 I6 I5 IE 7.5 6.5 5.5
MVI C, FFH
MVI D, 29H
MVI E, 67H
HLT
MOV C, B
HLT
MOV A, B
HLT
4. write an ALP which directly store data 56H into memory location 2050H.
LXI H, 2050H
MVI M, 56H
HLT
MOV B, A
LDA 2051H
STA 2050H
MOV A, B
STA 2051H
HLT
MOV B, D
MOV C, E
MOV D, H
MOV E, L
HLT
MOV L, C
XCHG ; The contents of register H are exchanged with the contents of register D, and the
MOV B, H
MOV C, L
HLT
7. Write the set of 8085 assembly language instructions to store the contents of
B and C registers on the stack.
MVI B, 50H
MVI C, 60H
PUSH B
PUSH C
HLT
8. Write an ALP to delete (Make 00H) the data byte stored at memory
location from address stores in register DE.
MVI A, 00H
STAX D
HLT
9. Write an 8085 assembly language program to add two 8-bit numbers stored
in memory locations 2050h and 2051h. Storeresult in location 2052h.
LXI H 2050H
MOV A M
INX H
ADD M
INX H
MOV M A
HLT
10. Subtract 8 bit data stored at memory location 2050H from data stored at
memory location 2051H and store result at 2052H.
LXI H2050H
MOV A M
INX H
SUB M ; A = A - M
INX H
MOV M A
HLT
11. Write an 8085 assembly language program to add two 16-bit numbers
stored in memory.
LHLD 2050H
XCHG ; The contents of register H are exchanged with the contents of register D, and the
LHLD 2052H
MOV A E
ADD L
MOV L A
MOV A D
ADC H
MOV H A
SHLD 2054H ; Store Value of L Register at 2054 and value of H register at 2055.
HLT
MVI C 08H
MOV A D
BACK: RAR; Rotate Accumulator Rightthroughcarryflag.
JNC SKIP
INR B
JNZ BACK
HLT
ORA C
ANA E
MOV D A
HLT
14. Write an 8085 assembly language program to add two decimal numbers
using DAA instruction.
LXI H 2050H
MOV A M
INX H
MOV B M
MVI C 00H
ADD B
JNC SKIP
INR C
MOV M A
INX H
MOV M C
HLT
15. Write an 8085 assembly language programtofind the minimum from two
8-bit numbers.
LDA 2050H
MOV B A
LDA 2051H
CMP B
JNC SMALL
STA 2052H
HLT
SMALL: MOV A B
STA 2052H
HLT
16. Write an 8085 program to copy block of five numbers starting from
location 2001h to locations starting from 3001h.
LXI D 3100H
MVI C 05H
LXI H 2100
LOOP: MOVAM
STAX D
INX D
INX H
DCR C
JNZ LOOP
1. Draw and explain the block diagram of the programmable peripheral
interface (8255A).
Ans.
WR (WRITE) This is an active low signal that enables Write operation. When signal
is low MPU writes data into selected I/O port or control register
RESET This is an active high signal, used to reset the device. That means clear
control registers
Ports A, B, and C
• The 8255 contains three 8-bit ports (A, B, and C).
• All can be configured to a wide variety of functional characteristics by the system
software but each has its own special features or "personality" to further enhance the
power and flexibility of the 8255.
• Port A One 8-bit data output latch/buffer and one 8-bit data input latch.
• Both "pull-up" and "pull-down" bus-hold devices are present on Port A.
• Port B One 8-bit data input/output latch/buffer and one 8-bit data input buffer.
• Port C One 8-bit data output latch/buffer and one 8-bitdata input buffer (no latch for
input). This port can be divided into two 4-bit ports under the mode control.
• Each 4-bit port contains a 4-bit latch and it can be used for the control signal output
and status signal inputs in conjunction with ports A and B.
2. Explain 8255A I/O Operating Modes
Ans. 8255A has three different I/O operating modes:
1. Mode0
2. Mode1
3. Mode2
Mode 0
• Simple I/O for port A,B and C
• In this mode, Port A and B is used as two 8-bit ports and Port C as two 4-bit ports.
• Each portcan be programmed in either inputmode oroutputmode where outputs
are latched and inputs are not latched.
• Ports do not have handshake or interrupt capability.
INTR(Interrupt Request)
This is an output signal that may be used to interrupt the MPU. This signal is generated
if STB, IBF and INTE (internal flip-flop) are all at logic 1. It will get reset by the falling
edge of RD
INTE(Interrupt Enable)
• This signal is an internal flip-flop, used to enable or disable the generation of INTR
signal.
• The interrupt enable signal is neither an input nor an output; it is an internal bit
programmed via the PC4 (port A) or PC2 (port B) bits.
Mode 2
• In this mode, Port A can be configured as the bidirectional port and Port B either in
Mode 0 or Mode 1.
• Port A uses five signals from Port C as handshake signals for data transfer.
• The remaining three signals from Port C can be used either as simple I/O or as
handshake for port B.
• Accessed to write a control word when A0 and A1 are at logic1, the register is not
accessible for a read operation.
• Bit D7 of the control register either specifies the I/O function or the bit Set/Reset
function, as classified in figure 1.
• If bit D7=0, bits D6-D0 determine I/O function in various mode, as shown in figure 4.
• If bit D7=0 port C operates in the bit Set/Reset (BSR) mode.
• The BSR control word does not affect the function of port A and B.
Read/Write Logic
• It is typical R/W logic.
• WhenaddresslineA0isatlogic0,thecontrollerisselectedtowriteacommandword
or read status.
• The Chip Select logic and A0 determine the port address of controller.
Control Logic
• It has two pins: INT as output and INTA as input.
• The INT is connected to INTR pin of MPU
NON-VECTORED INTERRUPT
• In non-vectored interrupts the interrupted device should give the address of the
interrupt service routine (ISR).
• The INTR is a non-vectored interrupt.
• Hence when a device interrupts through INTR, it has to supply the address of ISR
after receiving interrupt acknowledge signal.
Interrupt Maskable Vectored
INTR Yes No
RST 5.5 Yes Yes
RST 6.5 Yes Yes
RST 7.5 Yes Yes
TRAP No Yes
Explain vectored interrupts of the 8085 microprocessor
The vector addresses of 8085 interrupts are given below:
Software Interrupt
• The software interrupts of 8085 are RST 0, RST 1, RST 2, RST 3, RST 4, RST 5, RST 6
and RST 7.
• The software interrupts cannot be masked and they cannot be disabled.
Hardware Interrupt
• The vectored hardware interrupts of 8085 are TRAP, RST 7.5, RST 6.5, RST 5.5.
• An external device, initiates the hardware interrupts of 8O85 by placing an appropriate
signal at the interrupt pin of the processor.
• The processor keeps on checking the interrupt pins at the second T -state of last
machine cycle of every instruction.
• If the processor finds a valid interrupt signal and if the interrupt is unmasked and
enabled, then the processor accepts the interrupt.
• The acceptance of the interrupt is acknowledged by sending an INTA signal to the
interrupted device.
• The processor saves the content of PC (program Counter) in stack and then loads the
vector address of the interrupt in PC. (If the interrupt is non-vectored, then the
interrupting devicehas to supplytheaddress of ISRwhen it receives INTA signal).
• It starts executing ISR in this address.
• At the end of ISR, a return instruction, RET will be placed.
• When the processor executesthe RET instruction, it POP the content of top ofstack
to PC.
• Thus the processor control returns to main program after servicing interrupt.
7. Explain Interfacing Seven-Segment LEDs as an Output
Ans. • Interface the 8085 Microprocessor System with seven segment display through its
programmable I/O port 8255.
• Seven segment displays is often used in the digital electronic equipment todisplay
information regarding certain process.
• I/O devices (orperipherals) such as LEDsand keyboards are essential components of
the microprocessor-based or microcontroller-based systems.
• Seven-segment LEDs Often used todisplay BCD numbers (1 through 9) and a few
alphabets.
• A group of eight LEDs physically mounted in the shape of the number eight plus a
decimal point.
• Each LED is called a segment and labeled as ‘a’ through ‘g’.
Segment Register
Types of Segment registers are as follows:-
1. Code Segment (CS): The CS register is used for addressing a memory location in the Code Segment
of the memory, where the executable program is stored.
2. Data Segment (DS): The DS contains most data used by program. Data are accessed in the Data
Segment by an offset address or the content of other register that holds the offset address.
3. Stack Segment (SS): SS defined the area of memory used for the stack.
4. Extra Segment (ES): ESis additionaldata segment that isusedby someof the stringto hold the
destination data
Pointer Registers
The pointers IP, BP, SP usually contain offsets within the code, data and stack segments respectively.
1. Stack Pointer (SP): SP is a 16-bit register pointing to program stack in stack segment.
2. Base Pointer (BP): 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.
3. Instruction Pointer (IP): IP is a 16-bit register pointing to next instruction to be executed.
Index registers
The Index Registers are as follows:-
1. Source Index (SI): SI is a 16-bit register used for indexed, based indexed and register indirect
addressing, as well as a source data addresses in string manipulation instructions.
2. Destination Index (DI): DI is a 16-bit register. DI is used for indexed, based indexed and register
indirect addressing, as well as a destination data addresses in string manipulation instructions.
Flag Registers
The 16-bit flag register of 8086 contains 9 active flags (six conditional & 3 control flags), other 7 flags
are undefined.
• Status Flags: It indicates certain condition that arises during the execution. They are controlled
by the processor.
• Control Flags: It controls certain operations of the processor. They are deliberately set/ reset by
the user.
Control Flags
Control flags are set or reset deliberately to control the operations of the execution unit.
1. 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.
2. Interrupt Flag (IF):
- It is an interrupt enable/disable flag.
- If it is set, the mask ableinterrupt of 8086 is enabled and if it is reset, theinterrupt is disabled.
- It can be set by executing instruction sit and can be cleared by executing CLI instruction.
3. Direction Flag (DF):
- It is used in string operation.
- If it is set, string bytesare accessed from highermemory address to lower memory address.
- Whenit is reset, the string bytes are accessed from lower memory address to higher memory
address.
80386
1. Explain the Page Table and Page Directory Entry with paging mechanism in
an 80386 microprocessor.
Page Directory
• The page directory contains the location of up to 1024 page translation tables, which are
each four bytes long.
• Each page translation table translates a logical address into a physical address.
• The page directory is stored in the memory and accessed by the page descriptor address
register (CR3).
• Control register CR3 holds the base address of the page directory, which starts at any 4K-
byte boundary in the memory system.
• Each entry in the page directory translates the leftmost 10 bits of the memory address.
This 10-bit portion of the linear address is used to locate different page tables for different
page table entries.
Page Table
• The page table contains 1024 physical page addresses, accessed to translate a linear
address into a physical address.
Page Table Entry
• The page table entries contain the starting address of the page and the statistical information
about the page.
• Total Entries are 1024
• Each page table entry is of 4byte
• D-bit: Dirty bit is undefined for page table directory entries by the 80386 microprocessor and
is provided for use by the operating system.
• A-bit: Accessed bit issettoalogic 1 whenever the microprocessor accesses thepage directory
entry.
• R/W and Read/write and user/supervisor are both used in the protection scheme. Both bits
combine to develop paging priority level protection for level 3, the lowest user level.
U/ R/W Access Level3
S
0 0 None
0 1 None
1 0 Read-Only
1 1 Write-Only
• A page frame is a 4K-byte unit of contiguous addresses of physical memory. Pages begin on
byte boundaries and are fixed in size.
• A linear address refers indirectly to a physical address by specifying a page table, a page within
that table, and an offset within that page.
• The below figure of page translation shows, how processor converts the DIR, PAGE, and
OFFSET fields of a linear address into the physical address by consulting two levels of page
tables.
• The addressing mechanism uses the DIR field as anindex into a page directory, uses the PAGE
field as an index into the page table determined by the page directory, and uses the OFFSET
field to address a byte within the page determined by the page table.
• In the second phase of address transformation, the 80386 transforms a linear address into a
physical address.
• This phase of address transformation implements the basic features needed forpage-oriented
virtual-memory systems and page-level protection.
• Page translation is in effect only when the PG bit of CR0 is set.
• Each task assigned a privilege level, which indicates the priority or privilege of that task.
• It can only change by transferring the control, using gate descriptors, to a new segment.
• A task executing at level 0, the most privileged level, can access all the data segment defined
in GDT and LDT of the task.
• Ataskexecutingat level3,theleastprivileged level,willhavethemostlimitedaccesstodata
and other descriptors.
• The use of rings allows for system software to restrict tasks from accessing data.
• In most environments, the operating system and some device drivers run in ring 0 and
applications run in ring 3.
3. Features of 80386
• The 80386 microprocessor is an enhanced version of the 80286 microprocessor
• Memory-management unit is enhanced to provide memory paging.
• The 80386 also includes 32-bit extended registers and a 32-bit address and data bus.These
extended registers include EAX, EBX, ECX, EDX, EBP, ESP, EDI, ESI, EIP and EFLAGS.
• The 80386 has a physical memory size of 4GBytes that can be addressed as a virtual memory
with up to 64TBytes.
• The 80386 is operated in the pipelined mode, it sends the address of the next instruction or
memory data to the memory system prior to completing the execution of the current
instruction
• This allows the memory system to begin fetching the next instruction or data before the
current is completed. This increases access time.
• The instruction set of the 80386 is enhanced to include instructions that address the 32-bit
extended register set.
• The 80386 memory manager is similar to the 80286, except the physical addresses generated
by the MMU are 32 bits wide instead of 24-bits.
• The concept of paging is introduced in 80386
• 80386 support three operating modes:
1. Real Mode (default)
2. Protected Virtual Address Mode (PVAM)
3. Virtual Mode
• The memory management section of 80386 supports virtual memory, paging and four levels
of protection.
• The 80386 includes special hardware for task switching.
• The Bus Interface Unit connects the 80386 with memory and I/O. Based on internal requests
for fetching instructions and transferring data from the code pre-fetch unit, the 80386
generates the address, data and control signals for the current bus cycles.
• The code pre-fetch unitpre-fetches instructions when the businterface unit is notexecuting
the bus cycles. It then stores them in a 16-byte instruction queue for decoding by the
instruction decode unit.
• The instruction decode unit translates instructions from the pre-fetch queue into micro-codes.
The decoded instructions are then stored in an instruction queue (FIFO) for processing by the
execution unit.
• The execution unit processes the instructions from the instruction queue. It contains a control
unit, a data unit and a protection test unit.
• The control unit contains microcode and parallel hardware for fast multiply, divide and
effective address calculation. The unit includes a 32-bit ALU, 8 general purpose registers and a
64-bit barrel shifter for performing multiple bit shifts in one clock. The data unit carries out
data operations requested by the control unit.
• The protection test unit checks for segmentation violations under the control of microcode.
• Thesegmentation unit calculates andtranslates the logical address into linear addresses at the
request of the execution unit.
• ackaged in a 168 pin, pin grid array package instead of the 132 pin PGA used for the
80386.
• Operates on 25MHz, 33 MHz, 50 MHz, 60 MHz, 66 MHz or 100MHz.
• It consists of parity generator/checker unit in order to implement parity detection and
generation for memory reads and writes.
• Supports burst memory reads and writes to implement fast cache fills.
• Three mode of operation: real, protected and virtual 8086 mode.
• The 80486 microprocessor is a highly integrated device, containing well over 1.2 million
transistors.
New feature found in the 80486 are as follows:
7. BIST (built-in self-test) that tests the microprocessor
8. 8KB Code and data cache
9. On-chip FPU(Floating Point Unit)
Pentium Architecture
The term ''Pentium processor'' refers to a family of microprocessors that share a common
architecture and instruction set. The first Pentium processors were introduced in 1993. It runs at a
clock frequency of either 60 or 66 MHz and has 3.1 million transistors. Some of the features of
Pentium architecture are
• Complex Instruction Set Computer(CISC) architecture with Reduced Instruction Set Computer
(RISC) performance.
• 64-Bit Bus
• Upward code compatibility.
• Pentiumprocessoruses Superscalararchitecture and hencecanissue multipleinstructions per
cycle.
• Multiple Instruction Issue (MII) capability.
• Pentium processor executes instructions in five stages. This staging, or pipelining, allows the
processor to overlap multiple instructions so that it takes less time to execute two instructions
in a row.