Microprocessor
Microprocessor
Microprocessors and microcontrollers (definition only)-intel 8085- 8 bit microprocessor-pin disruption - 8085
instructions – addressing modes(definition only)- interrupts (definition only) -assembly language - simple
programs- addition, subtraction.
Microprocessor
A microprocessor is a controlling unit of a micro-computer wrapped inside a small chip. It performs
Arithmetic Logical Unit (ALU) operations and communicates with the other devices connected with it. It is a
single Integrated Circuit in which several functions are combined.
These microprocessors don’t have RAM, ROM, and other peripheral on the chip. A system designer has
to add them externally to make them functional. Application of microprocessor includes Desktop PC’s, Laptops,
notepads etc.
Types of Microprocessor
There are basically 5 kinds of microprocessors
Complex Instruction Set Microprocessors
Reduced Instruction Set Microprocessors
Superscalar Processors
The Application Specific Integrated Circuit
Digital Signal Multiprocessors (DSPs)
Basic features of Microprocessors
The following features enable microprocessor to be a versatile component in an instrumentation
system.
1. Memory
2. Decision making power based on previously entered values
3. Repeatability of the reading
4. Digital read-out and interactiveness
5. Parallel Processing
6. Time sharing and multiprocessing
7. Data storage, retrieval and transmission
8. Effective control of multiple equipment in time sharing basis
9. Microprocessors are extremely used where a lot of processing is required
Advantages of a Microprocessor
Low Cost
Microprocessors are available at low cost due to integrated circuit technology.
High Speed
Microprocessor chips can work at very high speed due to the technology involved in it.
Small Size
Due to very large scale and ultra large scale integration technology the size of the entire computer system
is reduced.
1
Versatile
The same chip can be used for a number of applications by simply changing the program
Low Power Consumption
Microprocessors are usually manufactured using metal oxide semiconductor technology. So the power
consumption is very low compared to others.
Less Heat Generation
Compared to vacuum tube devices, semiconductor devices won’t emit that much heat.
Reliable
Microprocessors are very reliable, failure rate is very less as semiconductor technology is used.
Portable
Devices or computer system made with microprocessors can be made portable due to the small size and
low power consumption.
Applications of Microprocessor
Microprocessors are mainly used in devices like:
Calculators
Accounting system
Games machine
Complex industrial controllers
Traffic light
Control data
Military applications
Defense systems
Computation systems
Microcontroller
A microcontroller is a chip optimized to control electronic devices. It is stored in a single integrated
circuit which is dedicated to performing a particular task and execute one specific application.
A microcontroller has a CPU, in addition with a fixed amount of RAM, ROM and other peripherals all
embedded on a single chip. At times it is also termed as a mini-computer or a computer on a single chip.
It has specially designed circuits for embedded applications and is widely used in automatically
controlled electronic devices. It contains memory, processor, and programmable I/O.
Types of Microcontroller
Here are important types of Microcontroller:
8 bit Microcontroller
16 bit Microcontroller
32 bit Microcontroller
Embedded Microcontroller
External memory Microcontroller
Features of Microcontroller
Here are some important features of Microcontroller:
Processor reset
Program and Variable Memory (RAM) I/O pins
Device clocking central processor
2
Instruction cycle timers
Applications of Microcontroller
Microcontrollers are mainly used in devices like:
Mobile phones
Automobiles
CD/DVD players
Washing machines
Cameras
Security alarms
Keyboard controllers
Microwave oven
Watches
Mp3 players
Microprocessor vs. Microcontroller
Here is the difference between Microprocessor vs. Microcontroller
Microprocessor Microcontroller
Microprocessor is the heart of Computer system. Micro Controller is the heart of an embedded
system.
It is only a processor, so memory and I/O Micro Controller has a processor along with
components need to be connected externally internal memory and I/O components.
Memory and I/O has to be connected externally, so Memory and I/O are already present, and the
the circuit becomes large. internal circuit is small.
You can't use it in compact systems You can use it in compact systems.
Cost of the entire system is high Cost of the entire system is low
Due to external components, the total power As external components are low, total power
consumption is high. consumption is less.
Most of the microprocessors do not have power Most of the microcontrollers offer power-saving
saving features. mode.
Microprocessor has a smaller number of registers, Microcontroller has more register. Hence the
so more operations are memory-based. programs are easier to write.
Microprocessors are based on Von Neumann Micro controllers arc based on Harvard
model architecture
3
It is a central processing unit on a single silicon- It is a byproduct of the development of
based integrated chip. microprocessors with a CPU along with other
peripherals.
It has no RAM, ROM, Input-Output units, timers, It has a CPU along with RAM, ROM, and other
and other peripherals on the chip. peripherals embedded on a single chip.
It uses an external bus to interface to RAM, ROM, It uses an internal controlling bus.
and other peripherals.
Microprocessor-based systems can run at a very Microcontroller based systems run up to 200MHz
high speed because of the technology involved. or more depending on the architecture.
It's used for general purpose applications that It's used for application-specific systems.
allow you to handle loads of data.
Intel 8085
"Eighty-eighty-five" microprocessor is an 8-bit microprocessor designed by Intel in 1977 using NMOS
technology.
It has the following configuration −
8-bit data bus
16-bit address bus, which can address upto 64KB
A 16-bit program counter
A 16-bit stack pointer
Six 8-bit registers arranged in pairs: BC, DE, HL
Requires +5V supply to operate at 3.2 MHZ single phase clock
It is used in washing machines, microwave ovens, mobile phones, etc.
Functional Units in 8085 microprocessor
8085 is an 8-bit, general purpose microprocessor. It consists of following functional units:-
1. Arithmetic and Logic Unit (ALU) :
It is used to perform mathematical operations like: addition, multiplication, subtraction, division,
decrement, increment, etc.
2. Flag Register :
It is an 8-bit register that stores either 0 or 1 depending upon which value is stored in the accumulator.
Flag register basically holds the status of the current result generated by the ALU
3. Accumulator :
Accumulator is used to perform I/O,Load/Store, arithmetic and logical operations. It is connected to ALU
and internal data bus.
4. General Purpose Registers :
There are 6 general purpose registers. These registers can hold 8 bit values. These 8-bit registers are
B,C,D,E,H,L. These registers work as 16-bit registers when they work in pair like: B-C, D-E, H-L.
4
5. Program Counter :
Program Counter holds the address value of the memory to the next instruction that is to be executed. It
is a 16-bit register.
6. Stack Pointer :
It works like stack. In stack, the content of register is stored that is later used in the program. It is a 16-bit
special register.
7. Temporary Register :
It is a 8-bit register that holds data values during arithmetic and logical operations.
8. Instruction register and decoder :
It is a 8-bit register that holds the instruction code that is being decoded. The instruction is fetched from
the memory.
9. Timing and control unit :
The timing and control unit comes under the CPU section, and it controls the flow of data from CPU to
other devices. It is also used to control the operations performed by the microprocessor and the devices
connected to it. There are certain timing and control signals like: Control signals, DMA Signals, RESET
signals, Status Signal.
10. Interrupt control :
Whenever a microprocessor is executing a main program and if suddenly an interrupt occurs, the
microprocessor shifts the control from the main program to process the incoming request. After the
request is completed, the control goes back to the main program. There are 5 interrupt signals in 8085
microprocessors: INTR, TRAP, RST 7.5, RST 6.5, RST 5.5
11. Address bus and data bus :
Data bus is bidirectional and carries the data which is to be stored. Address bus is unidirectional and
carries location where data is to be stored.
12. Serial Input/output control :
It controls the serial data communication by using Serial input data and Serial output data.
8085 Architecture
5
The following image depicts the pin diagram of 8085 Microprocessor −
6
The size of the data bus of the 8085 microprocessor is 8 bits. To reduce the number of bus lines these
8-bit data bus lines are multiplexed with the 8-bit address bus.
3. Power supply and clock signals
In 40 pin configuration, 5 pins are allotted to this particular category.
VCC – Pin number 40 denotes VCC, and an external power supply of + 5 V is provided at this pin.
VSS – Its pin number is 20. This pin shows the grounded connection of the microprocessor.
X1 and X2 – These are represented by pin number 1 and 2 respectively in the pin configuration. These 2
pins are connected with a crystal or LC network to maintain the internal frequency of the clock generator.
CLK (OUT) – It is the 37th pin of the 8085 IC and acts as the system clock that keeps the record of time
duration required by each operation to get completed.
4. Serial I/O ports
It has basically 2 pins.
SID SID denotes Serial Input Data pin. Its pin is numbered as 5. Awith this pin, data is serially fed to the
processor directly through the input devises.
SOD SOD denotes Serial Output Data pin. Its pin number is 4 in the pin configuaration. This pin outputs
serial data when a SIM instruction is executed. Once the data is processed in the microprocessor then this
pin represents bit by bit results at the output device.
5. Control and status signals
Basically 6 pins of the pin configuration are used by control and status signals.
ALE – It is an Address Latch Enable signal. Its pin number is 30. It is a positive going pulse generated when a
new operation is started by the microprocessor. When the pulse goes high, it indicates address. When the pulse
goes down it indicates data.
RD – This pin is numbered 32 in the configuration. A low signal in this pin shows the read operation either from
I/O devices or from the memory unit. Thereby indicating that the data bus is now in a state or position to accept
the data from the memory or I/O devices.
WR – It is the 31st pin in the pin diagram. A low signal in this pin represents the write operation at the memory
or I/O devices. This indicates that the data present in the data bus is to be written into the desired memory
address or I/O device by the processor.
IO/M – It is pin number 34 and indicates the selection of a memory address or input-output device. This shows
whether the read/write operation is to be carried out at the memory location or at the I/O device.
S0 and S1 – The pins S0 and S1 represent the status signal at pin number 29 and 33 respectively. These signals
show the type of recent operation of the microprocessor. The table below represents the status of the data bus
under different conditions:
7
READY
This is the 35th numbered pin in the pin diagram that maintains synchronization between the processor
and peripherals, memory. It is clear that a microprocessor has a much faster response than peripherals and
memory.
So, this pin is enabled when the processor as well as the peripherals and memory both become ready
to begin the next operation.
In the case when the READY pin is disabled, then the microprocessor is in the WAIT state.
6. Interrupts and externally generated signals
Interrupts are the signals that are generated to break the sequence of an ongoing operation. When an
interrupt signal is generated then CPU immediately stops its recent task under operation and switches to some
other program known as interrupt service routine (ISR). After handling ISR, the CPU gets back to its main
program for execution.
The 8085 has five interrupt signals that can be used to interrupt a program execution. They are.
(i) INTR
(ii) RST 7.5
(iii) RST 6.5
(iv) RST 5.5
(v) TRAP
The microprocessor acknowledges Interrupt Request by INTA’ signal. In addition to Interrupts, there
are two externally initiated signals namely RESET IN and RESET OUT.
The interrupt signals are grouped into 2 types. They are Maskable Interrupt and Non- maskable
interrupt.
INTR
This is a maskable interrupt signal. It’s pin number is 10. This signal can be allowed or not allowed by
the software. When INTR pin goes high then the 8085 microprocessor completes the instruction of current which
is being executed and then recognizes the INTR signal and progresses it.
RST 5.5, RST 6.5, RST 7.5
These pins are the restart interrupts or Vectored Interrupts, used to insert an inner restart function
repeatedly. It’s pin numbers are 9, 8 and 7 respectively. All these interrupts are maskable. They can be allowed
or not allowed by using programs.
TRAP
Along with the 8085 microprocessor interrupts, TRAP is a non-maskable interrupt. It’s pin number is 6.
It doesn’t allow or stopped by a program. TRAP has the maximum precedence between the interrupts.
INTA
When the 8085 microprocessor gets an interrupt signal, then it should be recognized. This will be done
by INTA. As a result, when the interrupt will be obtained then INTA will go high. This is a non-maskable interrupt.
It’s pin number is 11
RESET IN –
It is pin number 36 in the pin diagram. An active low signal at this pin resets the PC of the microprocessor
to 0. Or we can say, after resetting the PC holds its initial memory address.
8
RESET OUT –
It is the 3rd pin in the pin diagram. This pin generates a signal to provide information about the resetting
of the microprocessor. Also, we can say that once a processor is reset then all the connected devices must also
be reset.
Note.
The priority order from maximum to low includes TRAP, RST 5.5, RST 6.5, RST 7.5, and INTR.
7.Direct Memory Access (DMA) :
The memory and I/O devices are connected with each other by the microprocessor. So microprocessor
(CPU) acts as an intermediator.
When data in a large amount is to be transferred between I/O devices and memory the CPU gets
disabled by tri-stating its buses. And this transfer is manageable by external control circuits. And this transfer is
manageable by external control circuits. The DMA has 2 pins.
HOLD –
This signal is generated at pin number 39. This pin generates a signal to notify the processor that more
than one request is present to access the data and address bus.
When this signal gets enabled, the CPU frees the bus after completion of the recent operation. Once the
hold signal gets disabled, the processor can access the bus again.
HLDA –
This signal is generated at pin number 38. This signal is enabled at the time when the processor gets
HOLD signal and it releases HLDA i.e., hold acknowledge signal. In order to show that the multiple requests are
kept on hold and will be considered once the bus gets free after the recent operation. After the disabling of
hold request, the HLDA signal becomes low.
Maskable and Non-Maskable Interrupts
Maskable Interrupts are those which can be disabled or ignored by the microprocessor. These
interrupts are either edge-triggered or level-triggered, so they can be disabled. INTR, RST 7.5, RST 6.5, RST
5.5 are maskable interrupts in 8085 microprocessor.
Non-Maskable Interrupts are those which cannot be disabled or ignored by microprocessor. TRAP is
a non-maskable interrupt. It consists of both level as well as edge triggering and is used in critical power failure
conditions.
Instruction Set of 8085
An instruction is a binary pattern designed inside a microprocessor to perform a specific function. The
entire group of instructions that a microprocessor supports is called Instruction Set. 8085 has 246 instructions.
Each instruction is represented by an 8-bit binary value. These 8-bits of binary value is called Op-Code or
Instruction Byte
Notation and Meaning
M : Memory location pointed by HL register pair
r : 8-bit register
rp : 16-bit register pair
TS : Source register
rd : Destination register
addr : 16-bit address/8-bit address
9
Classification of Instruction Set
• Data Transfer Instruction
• Arithmetic Instructions
• Logical Instructions
• Branching Instructions
• Control Instructions
1. Data Transfer Instructions
These instructions are used by the microprocessor in order to transfer the data from one location to
another More specifically, these instructions move data between registers, or between memory and registers.
These instructions copy data from source to destination. While copying, the contents of source are not modified.
Thus it is more convenient to call it a data copy instruction.
MOV --(move)
This instruction copies the contents of the source register into the destination register without any alteration.
MOV R1,R2 - copies the contents of the register R2 to the register R1
MOV K, L - copies the contents of the register L to the register K
MOV M,R - copies the contents of the register R to the Memory
MOV R,M - Copies the contents in the memory to the register R
MVI – Move immediately
MVI R,data copies the data to the register
MVI M,data copies the data to the memory
LDA - Load the accumulator
LDA 2034K - The contents of the memory 2034 is loaded to the accumulator
LXI - Load the register pair immediate
LXI K, 3225L - loads the data in the memory to the register
LXI R,data - loads the data to the register
STA - STore Accumulator contents in memory
STA 325K - The contents of the accumulator are copied into the memory location 325K
STAX -- Store the accumulator indirect
STAX K - The contents of the accumulator are copied into the memory location specified
SHLD -- Store H and L registers direct
SHLD 3225K - The contents of register L are stored in the memory 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.
LHLD -- Load H and L registers direct
LHLD 3225K - The instruction copies the contents of the memory location pointed out by the address into
register L and copies the contents of the next memory location into register H
LDAX -- LoaD Accumulator from memory
LDAX rp - This instruction uses register indirect addressing for specifying the data.( rp. stands for register pair)
10
XCHG -- eXCHanGe
XCHG - The contents of register H are exchanged with the contents of register D, and the contents of register L
are exchanged with the contents of register E.
2. Arithmetic Instructions
Arithmetic Instructions are the instructions which perform basic arithmetic operations such as
addition, subtraction increment, decrement etc.
ADD – Add
ADD B - It adds the content of register B with the content of the accumulator and the result is stored in the
accumulator
ADD M - It adds the content of memory with the content of the accumulator and the result is stored in the
accumulator
ADI – Add Immediate
ADI 55K - The 8-bit data is added to the contents of the accumulator and the result is stored in the accumulator.
ADC – Addition with Carry
ADC R - The contents of the register R and the Carry flag are added to the contents of the accumulator and the
result is stored in the accumulator.
ADC M -The contents of the memory and the Carry flag are added to the contents of the accumulator and the
result is stored in the accumulator.
SUB – Subtraction
SUB R - The contents of the register R are subtracted from the contents of the accumulator, and the result is
stored in the accumulator.
SUB M - The contents of the register or the memory are subtracted from the contents of the accumulator, and
the result is stored in the accumulator.
SUI -- Subtract immediate
SUI 55K - The 8-bit data is subtracted from the contents of the accumulator & the result is stored in the
accumulator.
SBB -- Subtract the source and borrow from the accumulator
SBB. R.
The contents of the register and the Borrow flag are subtracted from the contents of the accumulator and the
result is placed in the accumulator..
SBB. M.
The contents of the memory & the Borrow flag are subtracted from the contents of the accumulator and the
result is placed in the accumulator.
SBI -- Subtract an immediate data
SBI 50 - The contents of the accumulator register are subtracted with immediate 8-bit data AND the borrow
value (specified by the CY flag)
INR -- Increment
INR R - The contents of the designated register are incremented by 1 and their result is stored at the same place.
11
INR M - The contents of the memory are incremented by 1 and their result is stored at the same place.
INX -- Increment register pair by 1
INX K - The contents of the designated register pair are incremented by 1 and their result is stored at the same
place.
DCR – Decrement
DCR R - The contents of the designated register are decremented by 1 and their result is stored at the same
place.
DCR M - The contents of the memory are decremented by 1 and their result is stored at the same place.
DCX -- Decrement the register pair by 1
DCX R - The contents of the designated register pair are decremented by 1 and their result is stored at the
same place.
DAD -- Add the register pair to H and L registers
DAD rp - The 16-bit data of the specified register pair are added to the contents of the HL register.
3. Logical Instructions
These instructions perform logical operations on data stored in registers, memory and status flags. The
logical operations are: AND, OR, XOR, Rotate, Compare and Complement. In Intel’s 8085 microprocessor, the
destination operand for the instructions is always the accumulator register. Here, the logical operations work
on a bitwise level. The corresponding result is also stored in the accumulator register.
ANA – Logical AND
ANA R - The contents of the accumulator are logically AND with the contents of the register and the result is
placed in the accumulator.
ANA M - The contents of the accumulator are logically AND with the memory, and the result is placed in the
accumulator.
ANI -- Logical AND immediate
ANI data - The contents of the accumulator are logically AND with the 8-bit data and the result is placed in the
accumulator.
ORA -- Logical OR
ORA R - The contents of the accumulator are logically OR with the contents of the register, and result is placed
in the accumulator.
ORA M - The contents of the accumulator are logically OR the contents of the memory, and result is placed in
the accumulator.
ORI -- Logical OR immediate
ORI data - The contents of the accumulator are logically OR with the 8-bit data and the result is placed in the
accumulator.
XRA -- Exclusive OR
XRA R - The contents of the accumulator are Exclusive OR with the contents of the register, and the result is
placed in the accumulator.
XRA M - The contents of the accumulator are Exclusive OR with the contents of the memory, and the result is
placed in the accumulator.
12
XRI -- Exclusive OR Immediate
XRI data - The contents of the accumulator are Exclusive OR with the 8-bit data and the result is placed in the
accumulator.
CMP – Compare
CMP R - The contents of the register are compared with the contents of the accumulator.
CMP M - The contents of the memory are compared with the contents of the accumulator.
CPI – Compare Immediate
CPI data - The second byte data is compared with the contents of the accumulator.
RLC -- Rotate Left Accumulator
Each binary bit of the accumulator is rotated left by one position
RRC -- Rotate Right Accumulator
Each binary bit of the accumulator is rotated right by one position
RAL -- Rotate Accumulator Left and also involving Carry
Each binary bit of the accumulator is rotated left by one position through the Carry flag.
RAR -- Rotate Accumulator Right and also involving Carry
Each binary bit of the accumulator is rotated right by one position through the Carry flag.
CMA -- Complement accumulator
The contents of the accumulator are complemented
CMC -- Complement carry
Only the Carry flag is complemented
STC – Set Carry
STC None - The Carry flag is set to 1. No other flags are affected.
4. Branching Instructions
The branching instruction alter the normal sequential flow. These instructions alter either
unconditionally or conditionally.
The three types of branching instructions are:
1. Jump (unconditional and conditional)
2. Call (unconditional and conditional)
3. Return (unconditional and conditional)
JMP -- Jump unconditionally
JMP 2034H - The program sequence is transferred to the memory address given in the operand.
JC -- Jump on Carry
JC address (eg JC 2050) - Jumps to the address if carry flag is 1
JNC Jump on no Carry
JNC address (eg. JNC 2050) - Jumps to the address if carry flag is 0
13
JP -- Jump on positive
JP address (eg. JP 2050) - Jumps to the address if sign flag 0
JM -- Jump on minus
JM address (eg. JM 2050) - Jumps to the address if sign flag is 1
JZ -- Jump on zero
JZ address (eg. JZ 2050) - Jumps to the address if zero flag is 1
JNZ -- Jump on no zero
JNZ address (eg. JNZ 2050) - Jumps to the address if zero flag is 0
JPE -- Jump on parity even
JPE address (eg. JPE 2050) - Jumps to the address if parity flag is 1
JPO -- Jump on parity odd
JPO address (eg. JPO 2050) - Jumps to the address if parity flag is 0
CALL -- Unconditionally calls
CALL address - The program sequence is transferred to the memory address given in the operand
CC -- Call on Carry
CC address -The program sequence is transferred to the memory address given in the operand if the flag CY is
1
CNC -- Call on no Carry
CNC address - Program sequence is transferred to the memory address given in the operand if the flag CY is 0
CP -- Call on positive
CP address - The program sequence is transferred to the memory address given in the operand if the flag S is 0
CM -- Call on minus
CM address - The program sequence is transferred to the memory address given in the operand if the flag S is
1
CZ -- Call on zero
CZ address - The program sequence is transferred to the memory address given in the operand if the flag Z is 1
CNZ -- Call on no zero
CNZ address - Program sequence is transferred to the memory address given in the operand if the flag Z is 0
CPE -- Call on parity even
CPE address - Program sequence is transferred to the memory address given in the operand if the flag P is 1
CPO -- Call on parity odd
CPO address - Program sequence is transferred to the memory address given in the operand if the flag P is 0
RET -- Return
RET none - When this instruction is executed the program sequence is transferred from the subroutine to the
calling program
14
Return from the subroutine unconditionally
RC -- Return on Carry
RC address - The program sequence is transferred from the subroutine to the calling program if the flag of the
PSW is CY = 1
RNC -- Return on no Carry
RNC address - The program sequence is transferred from the subroutine to the calling program if the flag of
the PSW is CY = 0
RP -- Return on positive
RP address - The program sequence is transferred from the subroutine to the calling program if the flag of the
PSW is S = 0
RM -- Return on minus
RM address - The program sequence is transferred from the subroutine to the calling program if the flag of the
PSW is S = 1
RZ -- Return on zero
RZ address - The program sequence is transferred from the subroutine to the calling program if the flag of the
PSW is Z = 1
RNZ -- Return on no zero
RNZ address - The program sequence is transferred from the subroutine to the calling program if the flag of
the PSW is Z = 0
RPE -- Return on parity even
RPE address - The program sequence is transferred from the subroutine to the calling program if the flag of the
PSW is P = 1
RPO -- Return on parity odd
RPO address - The program sequence is transferred from the subroutine to the calling program if the flag of
the PSW is P = 0
PCHL -- Load the program counter with HL contents
PCHL None - The contents of registers H & L are copied into the program counter. The contents of H are placed
as the high-order byte and the contents of L as the loworder byte
RST – Restart - The RST instruction is used as software instructions in a program to transfer the program
execution to one of the following eight locations.
Instruction Restart Address
RST 0 0000H
RST 1 0008H
RST 2 0010H
RST 3 0018H
RST 4 0020H
15
RST 5 0028H
RST 6 0030H
RST 7 0038H
The 8085 has additionally 4 interrupts, which can generate RST instructions internally and doesn’t require any
external hardware. Following are those instructions and their Restart addresses
Interrupt Restart
Address
TRAP 0024H
17
Maskable interrupt − In this type of interrupt, we can disable the interrupt by wri ng some instruc ons
into the program. For example: RST7.5, RST6.5, RST5.5.
Non-Maskable interrupt − In this type of interrupt, we cannot disable the interrupt by wri ng some
instructions into the program. For example: TRAP.
Note − NTA is not an interrupt, it is used by the microprocessor for sending acknowledgement. TRAP has the
highest priority, then RST7.5 and so on.
Assembly Language
Each personal computer has a microprocessor that manages the computer's arithmetical, logical, and
control activities. Each family of processors has its own set of instructions for handling various operations.
These set of instructions are called 'machine language instructions'.
A processor understands only machine language instructions, which are strings of 1's and 0's. However,
machine language is too obscure and complex for using in software development. So, the low-level assembly
language is designed for a specific family of processors that represents various instructions in symbolic code
and a more understandable form.
An assembly language is a low-level programming language designed for a specific type of processor. It
may be produced by compiling source code from a high-level programming language (such as C/C++) but can
also be written from scratch. Assembly code can be converted to machine code using an assembler.
Advantages
1. It allows complex jobs to run in a simpler way.
2. It is memory efficient, as it requires less memory.
3. It is faster in speed, as its execution time is less.
4. It is mainly hardware-oriented.
5. It requires less instruction to get the result.
6. It is used for critical jobs.
7. It is not required to keep track of memory locations.
8. It is a low-level embedded system.
Disadvantages
1. It takes a lot of time and effort to write the code for the same.
2. It is very complex and difficult to understand.
3. The syntax is difficult to remember.
4. It has a lack of portability of program between different computer architectures.
5. It needs more size or memory of the computer to run the long programs written in Assembly Language.
Simple programs- addition, subtraction
1. Add two 8-bit numbers
Example
(2501 H) = 99H
(2502 H) = 39H
Result (2503 H) = 99H + 39H = D2H
Since,
1 0 0 1 1 0 0 1 (99H)
+ 0 0 1 1 1 0 0 1 (39H)
18
1 1 0 1 0 0 1 0 (D2H)
Program
1. LXI H, 2501H : "Get address of first number in H-L pair. Now H-L points to 2501H"
2. MOV A, M : "Get first operand in accumulator"
3. INX H : "Increment content of H-L pair. Now, H-L points 2502H"
4. ADD M : "Add first and second operand"
5. INX H : "H-L points 4002H"
6. MOV M, A : "Store result at 2503H"
7. HLT : "Stop"
2. Add the contents of memory locations 4000H and 4001H and place the result in memory location 4002H.
3. Write a program to add data at 3005H & 3006H memory location and store the result at 3007H memory
location.
LXI H 3005H : "HL points 3005H"
MOV A, M : "Getting first operand"
INX H : "HL points 3006H"
ADD M : "Add second operand"
INX H : "HL points 3007H"
MOV M, A : "Store result at 3007H"
HLT : "Exit program"
4. Subtract two 8-bit numbers
Example
(2501 H) = 49H
(2502 H) = 32H
Result (2503 H) = 49H - 32H = 17H
Program
1. LXI H, 2501H : "Get address of first number in H-L pair. Now H-L points to 2501H"
2. MOV A, M : "Get first operand in accumulator"
19
3. INX H : "Increment content of H-L pair. Now, H-L points 2502H"
4. SUB M : "Subtract first to second operand"
5. INX H : "H-L points 4002H"
6. MOV M, A : "Store result at 2503H"
7. HLT : "Stop"
5. Subtract the contents of memory location 4001H from the memory location 2000H and place the result in
memory location 4002H.
20