Home »
Embedded Systems
Find Square of an 8-bit Number in 8085 Microprocessor
In this tutorial, we will learn how to find square of an 8-bit number in 8085 Microprocessor?
By Akash Kumar Last updated : May 14, 2023
8085 program to find square of an 8-bit number
Given an 8-bit number, we have to write 8085 program to find its square.
Algorithm
- Load the register H with value 20H and the register L with value 50H and the value of accumulator with 00H.
- Load the content of register B with the value taken from memory.
- Add the content of M in accumulator A and decrement the value of register B by one.
- Check if value of register B is 00 if yes then store result at memory location otherwise goto step 3.
- Terminate the program.
Program
MVI L 50
MVI H 20
MVI A 00
MOV B, M
**ADD M
DCR B
JNZ **
STA 3050
HLT
Observation
INPUT:
2050 : 03
OUTPUT:
3050 : 09
Hence, we successfully find the square of an 8-bit number using 8085 Microprocessor.