0% found this document useful (0 votes)
33 views

Microprocessor Lab

This document contains 10 programs written for an 8085 Microprocessor Lab. Each program has an aim, theory section explaining the concept, steps to execute the program, code in assembly language, and output of the program execution. The programs cover concepts like addition, subtraction and multiplication of 8-bit and 16-bit numbers, division, square, square root, BCD addition, and checking for odd and even numbers.

Uploaded by

Mansi Mansi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Microprocessor Lab

This document contains 10 programs written for an 8085 Microprocessor Lab. Each program has an aim, theory section explaining the concept, steps to execute the program, code in assembly language, and output of the program execution. The programs cover concepts like addition, subtraction and multiplication of 8-bit and 16-bit numbers, division, square, square root, BCD addition, and checking for odd and even numbers.

Uploaded by

Mansi Mansi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

MICROPROCESSOR LAB

SUBJECT CODE: – BSCP-601

SUBMITTED TO: SUBMITTED BY:


MR. ASHISH SEMWAL RIYA MALIK

180970101038

CSE 3RD YEAR


PROGRAM 1
AIM: - Write a program using 8085 and verify for addition of
two 8- bit numbers
THEORY: - To perform this task, we are using the ADD operation of 8085
Microprocessor. When the result of the addition is the 1-byte result, then the
carry flag will not be enabled. When the result is exceeding the 1-byte range,
then the carry flag will be 1.

Steps: 1. Write the program code on editor file window.

2. Store some input data at specified Memory Array.3

3. Click on the option Assemble for simulation.


4. Write the starting address of the program to simulate option.
5. Simulation of entire code could be run at a time or step by step.
6. Execution results can be checked through the Register, Memory and Device
environment window.
7. Note down updated register and memory content value for verification of
result.

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.

1. Write the program code on editor file window


2. Store some input data at specified Memory Array.
3. Click on the option Assemble for simulation.
4. Write the starting address of the program to simulate option.
5. Simulation of entire code could be run at a time or step by step.
6. Execution results can be checked through the Register, Memory and
Device environment window.
7. Note down updated register and memory content value for verification
of result.

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.

Steps: 1.Write the program code on editor file window.


2. Store some input data at specified Memory Array.
3. Click on the option Assemble for simulation.
4. Write the starting address of the program to simulate option.
5. Simulation of entire code could be run at a time or step by step.
6. Execution results can be checked through the Register, Memory and Device
environment window.
7. Note down updated register and memory content value for verification of
result.
Code:

Output: (Register Environment Window )


Program – 4
AIM: Write a Program Using 8085 & Verify for Subtraction of Two 16-Bit
Numbers. (Display of borrow).

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.

Steps: 1.Write the program code on editor file window.


2. Store some input data at specified Memory Array.
3. Click on the option Assemble for simulation.
4. Write the starting address of the program to simulate option.
5. Simulation of entire code could be run at a time or step by step.
6. Execution results can be checked through the Register, Memory and Device
environment window.
7. Note down updated register and memory content value for verification of
result.
Code:
Output: (Memory Environment Window)

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

In successive addition method, the second operand is considered as the counter,


and the first number is added to itself until counter decrements to zero.

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:

 Assign 01 to register C and B


 Load the value, 24 in accumulator A
 Subtract value stored at accumulator A from register D
 Check if accumulator holds 0, if true then jump to step 8
 Increment value of register B by 2
 Increment value of register C by 1
 Jump to step 3
 Move value stored at register C to A
 Store the value of A in memory location 2050

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:

 Load the accumulator with the first data.


 Perform AND operation with 01 on first data using ANI Instruction.
 Check if zero flag is set then set the value of accumulator to 22 otherwise 11
to accumulator.
 Now load the result value in memory location.

Code:
Output:

You might also like