8086 program to find Square Root of a number
Problem – Write an assembly language program in 8086 microprocessor to find square root of a number.
Example –

Algorithm –
- Move the input data in register AX
- Move the data 0000 in CX and FFFF in BX
- Add 0002 to the contents of BX
- Increment the content of CX by 1
- Subtract the contents of AX and BX
- If Zero Flag(ZF) is not set go to step 3 else go to step 7
- Store the data from CX to offset 600
- Stop
- M0V AX, [500] is used to move the data from offset 500 to register AX
- MOV CX 0000 is used to move 0000 to register CX
- MOV BX FFFF is used to move FFFF to register BX
- ADD BX, 02 is used to add BX and 02
- INC CX is used to increment the content of CX by 1
- SUB AX, BX is used to subtract contents of AX with BX
- JNZ 040A is used to jump to address 040A if zero flag(ZF) is 0
- MOV [600], CX is used to store the contents of CX to offset 600
- HLT is used end the program
- 8086 program to find the square root of a perfect square root number | Set-2
- 8085 program to find square root of a number
- 8086 program to find the factorial of a number
- 8086 program to find sum of digits of 8 bit number
- 8085 program to find square of a 8 bit number
- 8086 program to find the min value in a given array
- 8086 program to find GCD of two numbers and print the GCD
- 8086 program to find sum of Even numbers in a given series
- 8086 program to find average of n numbers
- 8086 program to find sum of odd numbers in a given series
- 8086 program to convert an 8 bit BCD number into hexadecimal number
- 8086 program to Print a 16 bit Decimal number
- 8086 program to reverse 16 bit number using 8 bit operation
- 8086 program to reverse 8 bit number using 8 bit operation
- 8086 program to search a number in a string
Program –
| OFFSET | MNEMONICS | COMMENT |
|---|---|---|
| 0400 | MOV AX, [500] | AX <- [500] |
| 0404 | MOV CX, 0000 | CX <- 0000 |
| 0407 | MOV BX, FFFF | BX <- FFFF | 040A | ADD BX, 02 | BX = BX + 02 | 040E | INC CX | C = C + 1 | 040F | SUB AX, BX | AX = AX – BX | 0411 | JNZ 040A | JUMP to 040A if ZF = 0 | 0413 | MOV [600], CX | [600] <- CX | 0417 | HLT | Stop |
Explanation –
Recommended Posts:
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



