Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

8086 program to find Square Root of a number

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

Example –

Algorithm –

  1. Move the input data in register AX
  2. Move the data 0000 in CX and FFFF in BX
  3. Add 0002 to the contents of BX
  4. Increment the content of CX by 1
  5. Subtract the contents of AX and BX
  6. If Zero Flag(ZF) is not set go to step 3 else go to step 7
  7. Store the data from CX to offset 600
  8. Stop
  9. Program –

    0400MOV AX, [500]AX <- [500]
    0404MOV CX, 0000CX <- 0000
    0407MOV BX, FFFFBX <- FFFF
    040AADD BX, 02BX = BX + 02
    040EINC CXC = C + 1
    040FSUB AX, BXAX = AX – BX
    0411JNZ 040AJUMP to 040A if ZF = 0
    0413MOV [600], CX[600] <- CX

    Explanation –

    1. M0V AX, [500] is used to move the data from offset 500 to register AX
    2. MOV CX 0000 is used to move 0000 to register CX
    3. MOV BX FFFF is used to move FFFF to register BX
    4. ADD BX, 02 is used to add BX and 02
    5. INC CX is used to increment the content of CX by 1
    6. SUB AX, BX is used to subtract contents of AX with BX
    7. JNZ 040A is used to jump to address 040A if zero flag(ZF) is 0
    8. MOV [600], CX is used to store the contents of CX to offset 600
    9. HLT is used end the program
    My Personal Notes arrow_drop_up
Last Updated : 22 May, 2018
Like Article
Save Article
Similar Reads