Home »
Embedded Systems
Find Square Root of an 8-bit Number in 8085 Microprocessor
In this tutorial, we will learn how to find the square root of an 8-bit number using 8086 Microprocessor?
By Akash Kumar Last updated : May 14, 2023
8085 program to find square root of an 8-bit number
Given an 8-bit number, we have to write 8085 program to find its square root.
Algorithm
- Assign the value of register D and E with 01H.
- Load the number from memory.
- Subtract the content of accumulator with the content of register D.
- Check if the value of accumulator is zero if yes goto step 8.
- Increase the content of register by 02H.
- Increase the content of register by 01H.
- Goto step 3.
- Move the content of register E to accumulator.
- Store the result of register E to the memory.
- Terminate the program.
Program
MVI E, 01
MVI D, 01
LDA 2050
**** SUB D
JZ ***
ADI D, 02
INC E
JMP ****
*** MOV A, E
STA 3050
HLT
Observation
INPUT:
2050 : 09
OUTPUT:
2051 : 03
Hence, we successfully find the square root of an 8-bit number using 8085 Microprocessor.