Home »
Embedded Systems
Find Square Root of a number | 8086 Microprocessor
In this tutorial, we will learn how to find square root of a number using 8086 Microprocessor?
By Akash Kumar Last updated : May 22, 2023
Problem Statement
Write a program in 8086 microprocessor to find square root of a number.
Algorithm
- Move the firstnumber in register AX.
- Assign the value of register CX as 0000 and register BX as FFFF.
- Add 0002 to value of register BX.
- Update the value of register CX by one.
- Subtract the content of register AX and BX.
- If the value of zero flag is not set then goto step 3 otherwise goto next step.
- Store the value of CX to memory.
- Terminate the program.
Program
MOV AX, [0600]
MOV CX, 0000
MOV BX, FFFF
*** ADD BX, 02
INC CX
SUB AX, BX
JNZ ***
MOV [0602], CX
HLT
Observation
INPUT:
0600:19
0601:00
OUTPUT:
0602:05
Hence, we successfully calculated the square root of a number using 8086 Microprocessor.