TITLE  Square Root (EX44.ASM)
          PAGE      ,132
OUR_CODE  SEGMENT   PARA 'CODE'
	  PUBLIC    SQRT32
SQRT32    PROC      FAR
          ASSUME    CS:OUR_CODE
	  PUSH      BP		     ;Save contents of BP
	  PUSH      DX		     ; and source number DX:AX
	  PUSH	    AX
	  MOV	    BP,SP	     ;BP points to AX on the stack
	  MOV       BX,200	     ;As a first approx,
	  DIV       BX		     ; divide source number by 200,
	  ADD	    AX,2	     ; then add 2
NXT_APP:  MOV	    BX,AX	     ;Save this approx. in BX
	  MOV	    AX,[BP]	     ;Read source number again
	  MOV       DX,[BP+2]
	  DIV       BX		     ;Divide by last approx.
	  ADD	    AX,BX	     ;Average last two approxs.
	  SHR       AX,1
	  CMP       AX,BX	     ;Last two approxs. identical?
	  JE        DONE
	  SUB       BX,AX	     ; No. Check for diff. of 1
	  CMP	    BX,1
	  JE        DONE
	  CMP	    BX,-1
	  JNE       NXT_APP
DONE:	  MOV	    BX,AX	     ;Put result in BX
	  POP	    AX		     ;Restore source number
	  POP	    DX
	  POP	    BP		     ; and scratch register BP
	  RET
SQRT32    ENDP
OUR_CODE  ENDS
   	  END       SQRT32
                     