Microprocessor Lab
Microprocessor Lab
180970101038
Code:
Output: (Register Environment Window)
PROGRAM 2
AIM: - Write a program using 8085 and verify for addition of two 16-
bit numbers.
THEORY: - To perform this task, we are using the HL and DE pairs in the
following addition. When the Carry is present, increase count register by 1,
otherwise only store result into memory location.
Code:
Output: (Memory Environment Window)
Program – 3
AIM: - Write a Program Using 8085 & Verify for Subtraction of Two 8-Bit
Numbers. (Display of borrow).
THEORY: -In 8085, the SUB instruction is used 2’s complemented method for
subtraction. When the first operand is larger, the result will be positive. It will
not enable the carry flag after completing the subtraction. When the result is
negative, then the result will be in 2’s complemented form and carry flag will be
enabled.
THEORY: Get the LSB and MSB in L and H register of 16 Bit number.
Exchange the content of HL with DE register. Again Get the LSB and MSB in L
and H register of 16 Bit number. Subtract the content of L from E register and
subtract the content of H from D register and borrow from previous step. Store
the result in memory location.
Program – 5
AIM: Write a program of division in 8085 microprocessor
THEORY:
ALGORITHM:
1)
Start the program by loading HL register pair with address of
memory location.
2) Move the data to a register (B register).
3) Get the second data and load into Accumulator.
4) Compare the two numbers to check for carry.
5) Subtract the two numbers.
6) Increment the value of carry.
7) Check whether repeated subtraction is over and store the value of
product and carry in memory location.
8) Terminate the program.
Code:
Output:
Program – 6
AIM: Write a program of multiplication by rotation in 8085 microprocessor.
THEORY:
The 8085 has no multiplication operation. To get the result of multiplication, we
should use the repetitive addition method. After multiplying two 8-bit numbers
it may generate 1-byte or 2-byte numbers, so we are using two registers to hold
the result
Code:
Output:
Program – 7
AIM: Write a program to find a square of a number in 8085 microprocessor.
THEORY: In 8085, we cannot perform the multiplication operation directly.
Approach –
Combine the content of registers H and A, the resultant content can be used to
indirectly point to memory location and that memory location is specified by
M. To find square of any number, keep on adding that number in accumulator
A which initially contains 0 by that number of times whose square we need to
find.
Code:
Output:
Program – 8
AIM: Write a program to find a square root of a number in 8085
microprocessor.
THEORY:
Algorithm:
Code:
Output:
Program – 9
AIM: Write a program to add BCD number in 8085 microprocessor.
THEORY: Here we are taking the numbers from memory and after adding we
need to put DAA instruction to adjust the accumulator content to decimal form.
Code:
Output:
Program – 10
AIM: Write a program to find out odd and even number in 8085 microprocessor.
THEORY:
Given number is EVEN number if its lower bit is 0 i.e. low otherwise number is
ODD. To check whether the number is odd or even, we basically perform AND
operation with 01 by using ANI instruction. If number is even then we will get
00 otherwise 01 in accumulator. We use 11 to represent odd number and 22 to
represent even number.
Algorithm:
Code:
Output: