8085 Microprocessor Notes
8085 Microprocessor Notes
net/publication/329609411
CITATIONS READS
0 2,723
1 author:
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Dr. Moorthi Madhavan on 13 December 2018.
Part A
1. What is Microprocessor?
It is a program controlled semiconductor device (IC), which fetches, decodes and executes
instructions.
2. What are the basic units of a microprocessor?
The basic units or blocks of a microprocessor are ALU, an array of registers and control unit.
The software developed using 1's and 0's are called machine language, programs. The
software developed using mnemonics are called assembly language programs.
6. What is the drawback in machine language and assembly language, programs?
The machine language and assembly language programs are machine dependent. The
programs developed using these languages for a particular machine cannot be directly run on
another machine.
7. Define bit, byte and word.
A digit of the binary number or code is called bit. Also, the bit is the fundamental storage
unit of computer memory. The 8-bit (8-digit) binary number or code is called byte and 16-bit
binary number or code is called word. (Some microprocessor manufactures refer the basic data
size operated by the processor as word).
8. What is a bus?
Bus is a group of conducting lines that carries data, address and control signals.
1
Dr. M.Moorthi Professor/ECE
2
Dr. M.Moorthi Professor/ECE
3
Dr. M.Moorthi Professor/ECE
1. Executing El instruction.
2. System or processor reset.
4
Dr. M.Moorthi Professor/ECE
34. How clock signals are generated in 8085 and what is the frequency of the internal
clock?
The 8085 has the clock generation circuit on the chip but an external quartz crystal or L C
circuit or RC circuit should be connected at the pins XI and X2. The maximum internal clock
frequency of 8085A is 3.03 MHz
35. What happens to the 8085 processor when it is resetted?
When the 8085 processor is resetted it executes the first instruction at the OOOOH
location. The 8085 resets (clears) instruction register, interrupt mask bits and other registers.
36. What are the operations performed by ALU of 8085?
The operations performed by ALU of 8085 are Addition, Subtraction, Logical AND, OR,
Exclusive OR, Compare Complement, Increment, Decrement and Left I Right shift
37. What is a flag?
Flag is a flip flop used to store the information about the status of the processor and the
status of the instruction executed most recently.
38. List the flags of 8085
There are five flags in 8085. They are sign flag, zero flag, Auxiliary carry flag, and parity
flag and carry flag.
39. What is the Hardware interrupts of 8085?
The hardware interrupts in 8085 are TRAP, RST 7.5, RST 6.5 and RST 5,5.
40. Which interrupt has highest priority in 8085? What is the priority of other interrupts?
The TRAP has the highest priority, followed by RST 7.5, RST 6.5, RST 5.5 and INTR.
41. What is ALE?
The ALE (Address Latch Enable) is a signal used to demultiplex the address and data
lines, using an external latch. It is used to enable the external latch.
42. Explain the function of IO/M in 8085.
The IO/M is used to differentiate memory access and I/O access. For IN and OUT
instruction it is high. For memory reference instructions it is low.
43. Where is the READY signal used?
READY is an input signal to the processor, used by the memory or I/O devices to get extra
time for data transfer or to introduce wait states in the bus cycles.
44. What are HOLD and HLDA and how it is used?
Hold and hold acknowledge signals are used for the Direct Memory Access (DMA) type
of data transfer. The DMA controller place a high on HOLD pins in order to take control of the
system bus. The HOLD request is acknowledged by the 8085 by driving all its tristated pins to
5
Dr. M.Moorthi Professor/ECE
6
Dr. M.Moorthi Professor/ECE
The sign flag is set because D7=1. This does not mean it is a negative number, even if the
sign flag is set. The sign flag indicates only that D7=1. the eight bits in the accumulator could be
a bit pattern, or a positive number larger that 12710, or the 2’s complement of a number.
50. List the components of microprocessor (single board microcomputer) based system.
The microprocessor based system consist of microprocessor as CPU, semiconductor
memories like EPROM and RAM, input device, output device and interfacing devices
51. Define machine cycle.
Machine cycle is defined as the time required to complete one operation of accessing
memory, input / output or acknowledging an external request. This cycle may consist of 3 to 6 T-
states.
52. Define T-state.
T-state is defined as one subdivision of the operation performed in 1 clock period. These
subdivisions are internal states synchronized with the system clock, and each T-state is precisely
to 1 clock period.
53. What is instruction cycle?
The sequence of operations that a processor has to carry out while executing the
instruction is called instruction cycle. Each instruction cycle of a processor consists of a number
of machine cycles.
54. What does memory-mapping mean?
The memory mapping is the process of interfacing memories to microprocessor and
allocating addresses to each memory locations.
55. What is the need for timing diagram?
The timing diagram provides information regarding the status of various signals, when a
machine cycle is executed. The knowledge of timing diagram is essential for system designer to
select matched peripheral devices like memories, latches, ports etc, to form a microprocessor
system.
7
Dr. M.Moorthi Professor/ECE
Part B
1. Explain briefly about bus structure of 8085
The microprocessor unit performs primarily four operations:
i) Memory Read: Reads data (or instructions) from memory
ii) Memory Write: Writes data (or instructions) into memory
iii) I/O read: Accepts data from input devices
iv) I/O Write: Sends data to output devices
All these operations are part of the communication process between the MPU and the peripheral
devices (including memory). To communicate with a peripheral (or the memory location), the
MPU needs he following steps:
Step 1: Identify the peripheral or the memory location (with its address)
Step 2: transfer binary information (data and instructions)
Step 3: Provide timing or synchronization signals.
The 8085 MPU performs these functions using three set of communication lines called buses: the
address bus, data bus and control bus.
ADDRESS BUS
The address bus is a group of 16 lines generally identified as A0 to A15. the address bus is
unidirectional: bits flow in one direction – from the MPU to peripheral devices. The MPU
uses the address bus to perform the first function: identifying a peripheral or a memory
location. In a computer system, each peripheral or memory location is identified by a binary
number called an address and the address bus is used to carry a 16-bit address. This is similar
to postal address of a house.
DATA BUS
8
Dr. M.Moorthi Professor/ECE
The data bus is a group of eight lines used for data flow. These lines are bidirectional - data
flow in both directions between the MPU and memory and peripheral devices. The MPU
uses the data bus to perform the second function: transferring binary information. The eight
data lines enable the MPU to manipulate 8- bit data ranging from 00 to FF.
CONTROL BUS
The control bus is comprised of various signal lines that carry synchronization signals. The
MPU uses such lines to perform the third function: provide timing signals.
The control signals are not group of lines like address or data buses, but individual lines that
provide pulse to indicate an MPU operation. The MPU generates specific control signals for
every operation (such as memory read or I/O write) it performs. These signals are used to
identify a device type with which the MPU intends to communicate.
2. Explain the features of 8085 in detail.
The features of 8085 include:
1. It is an 8-bit microprocessor i.e. it can accept, process or provide 8-bit data
simultaneously.
2. It operates on a single +5V power supply connected at Vcc
3. It operates on clock cycle with 50% duly cycle.
4. It has on chip clock generator this internal clock generator requires tuned circuit like LC,
RC or crystal. The internal clock generator divides oscillation frequency by 2 and
generates clock signal, which can be used for synchronizing external devices.
5. It can operate with 3 MHz clock frequency.
6. It has 16 address buses, hence it can access 216 64 bytes of memory.
7. It provides 8 bit I/o address to acce4ss (28) 256 I / o ports.
8. In 8085, the lower 8-bit address bus (A0-A7) and data bus (D0-D7) are multiplexed to
reduce number of external pins. But due to this, external hardware is required to separate
address lines and data lines.
9. It supports 74 instructions with following addressing modes. (a) Immediate, (b) Register,
(c) Direct (d) Indirect (e) Implied.
10. The Arithmetic logic unit of 8085 performs a) 8 bit binary addition with or without carry.
(b) 16 bit binary addition (c) 2 digit BCD addition (d) 8-bit binary subtraction with or
without borrow (e) 8-bit logical AND, OR, EX-OR, complement (NOT) and bit shift
operations.
11. It has 8-bit accumulator, flag register, instruction, register, six 8-bit general purpose.
Registers (B, C, D, E, H and C) and five 16-bit registers (SP and PC)
12. It provides five hardware interrupts: TRAP, RST 7.5. RST 6.5, RST 5.5 and INTR.
13. It has serial I/O control which allows serial communication.
14. It provides control signals (IO /M, RD, WR) to control bus cycles.
15. The external hardware (another microprocessor or equivalent master) can detect which
machine cycle microprocessor is executing using status signals (IO/M, S 0, S1) This
9
Dr. M.Moorthi Professor/ECE
feature is useful when more than one processors are using common system resources
(memory & I/O devices).
16. It has mechanism by which it is possible to increase its interrupt handling capacity.
17. The 8085 has an ability to share system bus with direct memory access controller. This
feature allows to transfer large amount of data from I/O device to memory or from
memory to I/O device with high speeds.
3. Draw and explain the architecture of 8085 microprocessorMAY06
ARCHITECTURE OF 8085
It consists of various functions blocks as listed below:
1) Registers
2) Arithmetic and logic unit
3) Instruction decoder and machine cycle encoder
4) Address Buffer
5) Address / Data Buffer
6) Incrementer / Decremented address batch
7) Serial I/O control
8) Timing and control circuitry
ALU
10
Dr. M.Moorthi Professor/ECE
11
Dr. M.Moorthi Professor/ECE
b) Flag Register :
It is an 8-bit register, in which five of the bits carry significant information in the form of flags :
5 (sign flag) Z (Zero flag), AC (Auxillary carry flag)m P (Parity flag) and CY (carry flag).
D7 D6 D5 D4 D3 D2 D1 D0
S Z AC P CY
12
Dr. M.Moorthi Professor/ECE
The 8085 executes seven different types of machine cycles. It gives the information about which
machine cycle is currently executing in the encoded form on the S0, S1 and IO/M lines. The task
is done by machine cycle encoder.
Address buffer
This is an 8-bit unidirectional buffer. It is used to drive external high order address (A15-A8). It is
also used to tri-state the high order address bus under certain conditions such as reset, hold, halt
and when address lines are not in use.
Address / Data buffer
This is an 8-bit bidirectional buffer. It is used to drive multiplexed address/data bus i.e. low order
address bus (A7-A0) and data bus (D7-D0). It is also used to tri-state the multiplexed address/data
bus under certain conditions such as reset, hold, halt and when bus is not in use.
Incrementer/Decrementer address latch
This 16-bit register is used to increment or decrement the contents of program counter or stack
pointer as a part of execution of instructions related to them.
Interrupt Control
The processor fetches, decodes and executes the instructions in a sequence. Sometimes it is
necessary to have the processor automatically execute one of a collection of special routines
whenever special condition exists within a program or the microcomputer system. After the
execution of special routine, the program control must be transferred to the program which
processor was executing before the occurrence of the special condition. The occurrence of this
special condition is referred as interrupt. The interrupt control block has five interrupt inputs
RST 5.5, RST 6.5, RST 7.5, TRAP and INTR and one acknowledge signal INTA.
Serial I/O Control
In situations like, data transmission over long distance and communication with cassette tapes or
CRT terminal, it is necessary to transmit data bit by bit to reduce the cost of cabling. In serial
communication one bit is transferred at a time over a single line. The 8085’s serial I/O control
provides two lines, SID and SOD for serial communication. The Serial Output Data (SOD) line
is used to send data serially and Serial Input Data (SID) line is used to receive data serially.
13
Dr. M.Moorthi Professor/ECE
14
Dr. M.Moorthi Professor/ECE
15
Dr. M.Moorthi Professor/ECE
RST 5.5
TRAP(input) This is a non maskable interrupt and has the highest priority
HOLD(input) This signal indicates that a peripheral such as a DMA controller is requesting
the use of the address and data buses.
HLDA Hold Acknowledge: This signal acknowledges the HOLD request.
16
Dr. M.Moorthi Professor/ECE
READY This signal is used to delay the microprocessor Read or Write cycles until a
slow-responding peripheral is ready to send or accept data. When this signal
goes low, the microprocessor waits for an integral number of clock cycles until
it goes high.
RESET, HOLD and READY are additional interrupts. They accept the externally
initiated signals as inputs. To respond to the HOLD request, it has one signal called HLDA.
RESET IN: When the signal on this pin goes low, the program counter is set to zero, the
buses are tri-stated, and the microprocessor is reset.
RESET OUT: This signal indicates that the microprocessor is being reset. The signal can be
used to reset other devices.
The microprocessor has 2 pins specially designed for software –controlled serial I/O. one is
called SOD (Serial Output Data) and the other is called SID (Serial Input Data). Data transfer
is controlled through 2 instructions: SIM and RIM. The instruction SIM is necessary to output
data serially from the SOD line. Similarly instruction RIM is used to input serial data through
the SID line.
The SID and SOD lines in the 8085 eliminate the need for an input port and an output
port in the software-controlled serial I/O. Essentially, the SID is a 1-bit port and SOD is a 1-
bit output port.
5. Explain the various addressing modes of 8085 microprocessor with example NOV04
ADDRESSING MODES:
The different ways that a microprocessor can access data are referred to as addressing modes.
The 8085 has 5 addressing modes. These are:
17
Dr. M.Moorthi Professor/ECE
2. Register addressing mode: The register addressing mode specifies the source operand,
destination operand or both to be contained in an 8085 registers. This results in faster execution,
since it is not necessary to access memory locations for operands.
3. Direct addressing mode: The direct addressing mode specifies the 16- bit
address of the operand within the instruction itself. The second and third bytes of instruction
contain this 16 bit address.
Example: LDA 2000H ; loads the 8bit contents of memory location 2000H into the
accumulator
SHLD 3000H ; Stores the HL register pair into two consecutive memory locations.
Lower contents of L register into memory location 3000H and higher
contents of H register into memory location 3001H.
4. Indirect addressing mode: In indirect addressing mode, the memory address where the
operand located is specified by the contents of a register pair.
Example: LDAX B ; loads the accumulator with the contents of memory location
pointed by BC register pair.
MOV M, A ; Stores the contents of accumulator into the memory location pointed by
HL register pair
5. Implied addressing mode: In implied addressing mode, Opcode specifies the address
of the operands.
6. Explain how the instruction word size are classified in 8085 microprocessorMAY05
INSTRUCTION WORD SIZE:
The 8085 instruction set is classified into the following three groups according to word size:
1. One-word or 1-byte instructions
2. Two-word or 2-byte instructions
3. Three-word or 3-byte instructions
In the 8085, “byte” and “word” are synonymous because it is an 8-bit microprocessor.
18
Dr. M.Moorthi Professor/ECE
ONE-BYTE INSTRUCTIONS
A 1-byte instruction includes the opcode and the operand in the same byte. For example:
Copy the contents of the accumulator MOV C,A 0100 1111 4FH
in register C.
TWO-BYTE INSTRUCTIONS
In a 2-byte instruction, the first byte specifies the operation code and the second byte specifies
the operand. For example:
Task Opcode Operand Binary Code Hex code
THREE-BYTE INSTRUCTIONS
In a 3-byte instruction, the first byte specifies the opcode and the following two bytes specify the
16-bit address. Note that the second byte is the low-order address and the third byte is the high-
order address. For example:
19
Dr. M.Moorthi Professor/ECE
3. logical operations
4. Branching operations and
5. Machine control operations.
An instruction is a command to the microprocessor to perform a given task on specified data.
Each instruction has two parts: one is the task to be performed, called the operation code
(opcode), and the second is the data to be operated on, called the operand (or data) can be
specified in various ways. It may include 8-bit (or 16-bit) data, an internal register, a memory
location, or an 8-bit (or 16-bit) address.
1.DATA TRANSFER (COPY) OPERATIONS
This group of instructions copies data from a location called a source to another location called
destination, without modifying the contents of the source. The various types of data transfer are
listed below together with examples of each type:
Types Examples
Between registers Copy the contents of register B into
Register D.
Specific data byte to Load register B with the data byte
a register or a memory
location
Between a memory location From the memory location 2000H to and a register
register B.
Between an I/O device From an input keyboard to the
and the accumulator. accumulator.
INSTRUCTIONS
The data transfer instructions copy data from a source into a destination without modifying the
contents of the source. The previous contents of the destination are replaced by the contents of
the source.
Opcode Operand Description
MOV Rd,Rs Move
This is a 1-byte instruction
Copies data from source register Rs to destination
register Rd
MVI R, 8-bit Move Immediate
This is a 2- byte instruction
Loads the 8 bits of the second byte into the register
specified.
OUT 8-bit port address Output to port
This is a 2- byte instruction
Sends the contents of the accumulator (A) to the
output port specified in the second byte
20
Dr. M.Moorthi Professor/ECE
2.ARITHMETIC OPERATIONS
These instructions perform arithmetic operations such as addition, subtraction, increment and
decrement.
Addition — Any 8-bit number, or the contents of a register, or the contents of a memory
location can be added to the contents of the accumulator and the result is stored in the
accumulator. No two other 8-bit registers can be added directly. The instruction DAD is
an exception.
Subtraction — Any 8-bit number, or the contents of a register, or the contents of a
memory location can be subtracted from the contents of the accumulator and the result is
stored in the accumulator. The subtraction is performed in 2’s complement and the
results, if negative, are expressed in 2’s complement. No two other 8-bit registers can be
subtracted directly.
Increment / Decrement — The 8-bit contents of a register or a memory location can be
incremented or decremented by one. Similarly, the 16- bit contents of a register pair can
be incremented or decremented by 1. These increment and decrement operation differ
from the addition and subtraction in an important way; i.e., they can be performed in one
of the registers pr in a memory location.
These arithmetic instructions (except INR and DCR)
1. Assume implicitly that the accumulator is one of the operands.
2. Modify all the flags according to the data conditions of the result.
3. place the result in the accumulator
4. Do not affect the contents of the operand register.
The instructions INR and DCR
1. Affect the contents of the specified register.
2. Affect all flags except the CY flag.
21
Dr. M.Moorthi Professor/ECE
2. reset (clear) the CY flag. The instruction CMA is an exception; it does not affect any flags.
3. modify the Z, P, and S flags according to the data conditions of the result.
4. place the result in the accumulator.
5. do not affect the contents of the operand register.
Opcode Operand Description
ANA R Logical AND with accumulator
This is a 1-byte instruction
Logically ANDs the contents of the register R with
the contents of the accumulator
8085: CY is reset and AC is set
ANI 8-bit AND Immediate with accumulator
This is a 2-byte instruction
Logically ANDs the second byte with the contents
of the accumulator
8085: CY is reset and AC is set
ORA R Logically OR with Accumulator
This is a 1-byte instruction
Logically ORs the contents of the register R with
the contents of the accumulator
Jump — Conditional jumps are an important aspect of the decision making process in
programming. These instructions test for a certain condition and alter the program
sequence when the condition is met. In addition, the instruction set includes an
instruction called unconditional jump.
Call, Return, and Restart — These instructions change the sequence of a program
either by calling a subroutine or returning from a subroutine. The conditional Call and
Return instructions can also test condition flags.
INSTRUCTIONS
The branch instructions are classified in three categories:
1.Jump instructions
2. Call and Return instructions
3.Restart instructions
Jump instructions are classified into two categories: Unconditional Jump and Conditional Jump.
UNCONDITIONAL JUMP
The 8085 instruction set includes one unconditional Jump instruction. The unconditional jump
instruction enables the programmer to set up continuous loops.
24
Dr. M.Moorthi Professor/ECE
following instructions transfer the program sequence to the memory location specified under the
given conditions:
Opcode Operand Description
JC 16-bit Jump on Carry (if result generates carry and CY = 1)
JNC 16-bit Jump on No Carry (CY = 0)
JZ 16-bit Jump on Zero (if result is Zero and Z = 1)
JNZ 16-bit Jump on No Zero (Z = 0)
JP 16-bit Jump on Plus (if D7 = 0 and S = 0)
JM 16-bit Jump on Minus (if D7 = 1 and S =1)
JPE 16-bit Jump on Even Parity (P = 1)
JPO 16-bit Jump on odd Parity (P = 0)
25
Dr. M.Moorthi Professor/ECE
Vectored Interrupt: When interrupt signal is activated, the internal control circuit of the
microprocessor produces a CALL to a predetermined memory location. This memory
location, where the subroutine starts is referred to as vector location and such interrupts are
called vectored interrupts.
TRAP, RST 7.5, RST 6.5, RST 5.5, RST 0 to 7
Non vectored interrupt: INTR
Maskable Interrupt: In the microprocessor those interrupts which can be enabled and
disabled under program control is called maskable interrupts.
INTR, RST 7.5, RST 6.5, RST 5.5, RST 0 to 7
Non Maskable Interrupt : TRAP
Hardware Interrupt: In the microprocessor, those pins which allow peripheral device to
interrupt the main program for I/O operations is called Hardware interrupt.
When an interrupt occurs, the 8085 completes the instruction it is currently executing and
transfers the program control to a subroutine that services the peripheral device. Upon
completion of the service routine, the CPU return to the main program.
TRAP, RST 7.5, RST 6.5, RST 5.5 , INTR
Types of Interrupts:
It supports two types of interrupts.
1. Hardware
2. Software
HARDWARE INTERRUPT: An external device initiates the hardware interrupts and placing
an appropriate signal at the interrupt pin of the processor.
26
Dr. M.Moorthi Professor/ECE
If the interrupt is accepted then the processor executes an interrupt service routine.
The 80S5 has five hardware interrupts
(1) TRAP (2) RST 7.5 (3) RST 6.5 (4) RST 5.5 (5) INTR
TRAP: This interrupt is a nonmaskable interrupt. It is unaffected by any mask or interrupt
enable. TRAP has the highest priority. TRAP interrupt is edge and level triggered. This means
that the TRAP must go high and remain high until it is acknowledged. This avoids false
triggering caused by noise and transients.
Once the TRAP is acknowledged, the 8085 completes its current instruction. It then
pushes the address of the next instruction i.e. return address onto the stack and loads PC with
fixed vector address 0024H. Due to this, 8085 starts execution of instructions from address
0024H which is the starting address of an interrupt service routine for TRAP.
RST 7.5 : The RST 7.5 interrupt is a maskable interrupt. It has the second highest priority. It
is positive edge triggered.If the mask bit M 7.5 is 0 i.e. RST 7.5 is unmasked then 8085
completes its current instruction. It then pushes the address of the next instruction onto the stack
and loads PC with fixed vector address 003CH. Due to this, 8085 starts execution of instructions
from address 003CH which is the starting address of an interrupt service routine for RST 7.5.
RST 6.5 and RST 5.5 : The RST 6.5 and RST 5.5 both are level triggered. These interrupts can
be masked using SIM instruction. The RST 6.5 has the third priority whereas RST 5.5 has the
fourth priority. The vector addresses of RST 6.5 and RST 5.5 are 0034H and 002CH
respectively. After recognition of RST 6.5 or RST 5.5 interrupt, 8085 completes its current
instruction; pushes the address of next instruction onto the stack and loads PC with
corresponding vector address.
INTR : INTR is a maskable interrupt, but not the vector interrupt. It is also called hand
shake interrupt. INTR is high level sensitive. It has the lowest priority. The following sequence
of events occur when INTR signal goes high.
1. The 8085 checks the status of INTR signal during execution of each instruction.
2. If INTR signal is high, then 8085 completes its current instruction and sends an active
low interrupt acknowledge signal (INTA) if the interrupt is enabled.
3. The 8085 then expects either a 1-byte CALL (RST 0 to RST 7) or a 3-byte CALL. This
instruction must be provided by external hardware. In other words, the INTA can be used
to enable a tristate buffer. The output of this buffer can be connected to the 8085 data
lines. The buffer can be designed to provide the appropriate Opcode on the data lines.
4. On receiving the instruction, the 8085 saves the address of next instruction on stack and
executes received instruction.
Interrupt type Trigger Priority Maskable Vector Address
st
Edge 1
TRAP No 0024H
And Level (Highest)
RST 7.5 Edge 2nd Yes 003CH
rd
RST 6.5 Level 3 Yes 0034H
th
RST 5.5 Level 4 Yes 002CH
27
Dr. M.Moorthi Professor/ECE
5th
INTR Level Yes -
(Lowest)
SIM and RIM for interrupts:
The 8085 provide additional masking facility for RST 7.5, RST 6.5 and RST 5.5 using
SIM instruction.
The status of these interrupts can be read by executing RIM instruction.
The masking or unmasking of RST 7.5, RST 6.5 and RST 5.5 interrupts can be
performed by moving an 8-bit data to accumulator and then executing SIM instruction.
The format of the 8-bit data is shown below.
The status of pending interrupts can be read from accumulator after executing RIM
instruction.
When RIM instruction is executed an 8-bit data is loaded in accumulator, which can be
interpreted as shown in fig.
28
Dr. M.Moorthi Professor/ECE
PC onto the stack. It then branches the program control to the vector address of the
corresponding RST instruction. The vector address for these interrupts can be calculated as
follows:
Interrupt number x 8 = vector address
Instruction Vector 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
29
Dr. M.Moorthi Professor/ECE
4. NOP: No Operation
Description:
No operation is performed. The instruction is fetched and decoded; however, no operation is
executed. This is an useful instruction for producing software delay and reserve memory space for
future software modifications.
One byte instruction
One machine cycle: Opcode fetch – 4T
5. RIM : Read Interrupt Mask
Description:
This is a multipurpose instruction used to read the status of interrupts 7.5, 6.5, 5.5 and to read
serial data input bit. This instruction loads 8 bits in the accumulator with the interpretations as,
* Bits D0, D1, D2 provide the mask status of RST interrupts.
* If the interrupt enable bit (IE) D3 is “O”, the 8085’s maskable interrupts are disabled. The
interrupts are enabled if this bit is 1. interrupt
* If a particular pending bit is 1, s an interrupt is being requested on the identified RST line.
When this bit is ‘O’, no interrupt is waiting to be serviced.
6. SIM: Set Interrupt Mask
Description:
This is a multipurpose instruction and used to implement the 8085 interrupts
(RST 7.5, 6.5 and 5.5) and serial data output.
The instruction interprets the accumulator content as,
* SOD: Serial Output Data: Bit D7 of the accumulator is latched into the SOD output
line and made available to a serial peripheral if bit D6 = 1
* SDE : Serial Data Enable: If this bit =1, if enables the serial output. To implement serial
output. This bit needs to be enabled.
* XXX = Don’t care.
* R7.5 = Reset RST 7.5 : If this bit =1, RST 7.5 flip – flop is reset. T is is an
additional control to reset RST 7.5.
* MSE: Mast Set Enable: If this it is high it enables the functions of
bits D2, D1, D0. This is the master control over all the interrupt masking bit
2. If this bit is low, bits D2, D1 and D0 do not have any effect on the masks.
M7.5 – D2 = 0, RST 7.5 is enabled.
= 1, RST 7.5 is masked or disabled.
M6.5 – D1 = 0,RST 6.5 is enabled.
= 1, RST 6.5 is masked or disabled.
M5.5 – D0 = 0, RST 5.5 is enabled
= 1, RST 5.5 is masked or disabled.
30
Dr. M.Moorthi Professor/ECE
Machine Cycle:
The time required to access the memory or input/output devices is called machine cycle.
T-State:
The machine cycle and instruction cycle takes multiple clock periods.
A portion of an operation carried out in one system clock period is called as T-state.
The 8085 microprocessor has 5 (seven) basic machine cycles. They are
31
Dr. M.Moorthi Professor/ECE
The memory read machine cycle is executed by the processor to read a data byte from
memory.
The processor takes 3T states to execute this cycle.
The instructions which have more than one byte word size will use the machine cycle
after the opcode fetch machine cycle.
32
Dr. M.Moorthi Professor/ECE
The memory write machine cycle is executed by the processor to write a data byte in a
memory location.
The processor takes, 3T states to execute this machine cycle.
The I/O Read cycle is executed by the processor to read a data byte from I/O port or from
the peripheral, which is I/O, mapped in the system.
The processor takes 3T states to execute this machine cycle.
The IN instruction uses this machine cycle during the execution.
33
Dr. M.Moorthi Professor/ECE
The I/O write machine cycle is executed by the processor to write a data byte in the I/O
port or to a peripheral, which is I/O, mapped in the system.
The processor takes, 3T states to execute this machine cycle.
34
Dr. M.Moorthi Professor/ECE
4200 6AH
4201 52H
35
Dr. M.Moorthi Professor/ECE
4126 C0H
36
Dr. M.Moorthi Professor/ECE
37
Dr. M.Moorthi Professor/ECE
2001 43H
38
Dr. M.Moorthi Professor/ECE
1.Write a program to transfer a block of data from one location to the other.
39
Dr. M.Moorthi Professor/ECE
40
Dr. M.Moorthi Professor/ECE
ANI 0FH
ADD B
STA 420H
HLT
5.Write an assembly language program to convert an 8-bit binary data to
BCD. The binary data is stored in 4200H. Store the hundred’s digit in 4251H.
store the ten’s and unit’s digits in 4250H
MVI E,00H
MOV D,E
LDA 4200H
HUND CPI 64H
JC TEN
SUI 64H
INR D
JMP HUND
TEN: CPI 0AH
JC UNIT
SUI 0AH
INR D
JMP TEN
UNIT: MOV C,A
MOV A,D
RLC
RLC
RLC
RLC
ADD C
STA 4250H
MOV A,E
STA 4251H
HLT
6. Write an assembly language program to find the 7-segment LED code for a
2-digit BCD data, by using look up table. The BCD data is stored in 4200H.
Store the 7-segment code in 4201H and 4202H.
PROGRAM TO FIND THE 7-SEGMENT LED CODE FOR A BCD DATA.
LDA 4200H
MOV B,A
ANI 0FH
MOV L,A
MVI H,50H
MOV A,M
STA 4201H
MOV A,B
ANI F0H
41
Dr. M.Moorthi Professor/ECE
RLC
RLC
RLC
RLC
MOV L,A
MOV A,M
STA 4202H
HLT
7.Write an assembly language program to add or subtract two 16 bit
numbers.
16 bit addition:
LXI H, D000H
MOV A,M
INX H
MOV B,M
INX H
MOV C,M
INX H
MOV D,M
ADD C
MOV L,A
MOV A,B
ADD D
MOV H,A
SHLD 2004 H
16 bit subtraction:
LXI H,D000H
MOV A,M
INX H
MOV B,M
INX H
MOV C,M
INX H
MOV D,M
SUB C
MOV L,A
MOV A,B
SUB D
MOV H,A
SHLD 2004H
8.Write a program to sort the numbers in ascending order.
MVI B, 09
START: LXI H, D000H
MVI C, 09H
42
Dr. M.Moorthi Professor/ECE
43