Professional Documents
Culture Documents
Experiment No: 9
Experiment No: 9
AIM: Write an assembly language program using 8086 to find Square root of 16 bit number. REQUIREMENTS: 8086 microprocessor programming kit, Xtalk (Assembler). THEORY: Square root of a no. can be obtained by subtracting continuous odd numbers from the no. till the result reduces less than zero. The no. of such subtractions possible is the square root of the no. PROCEDURE:
1. 2. 3. 4. 5.
Take CX as the register having odd number. Move the source address in SI in which number is stored. Take DX as the counter register. Move the content of SI to AX. Increment the index register SI twice to point the location where result is to be stored. Subtract CX from AX.
6.
7. Repeat steps 8 to 10 till result of subtraction is not less than zero. 8. Increment the counter. 9. Increment CX by 2. 10.
11.
Jump to step 6.
Store the value of DX (Square root of number) at the location pointed by SI.
FLOWCHART: START
No in AX
Take CX=0001H
AX=AX-CX
IS Diff >=0
Yes
NO
Store result in DX
DX=DX + 1
STOP
CX=CX + 02
Number in [SI] or 5000 H : 0010 H Square root of given number at 5002 H: 0004 H