TITLE  Square Root By Odd Numbers (ANS41.ASM)
          PAGE      ,132
OUR_CODE  SEGMENT   PARA 'CODE'
	  PUBLIC    SR32
SR32      PROC      FAR
          ASSUME    CS:OUR_CODE
          PUSH      AX		     ;Save original number
	  PUSH	    DX
	  PUSH      CX		     ; and CX on stack
	  MOV	    BX,1	     ;To start, (BX) = 1
	  SUB	    CX,CX	     ; and (CX) = 0
AGAIN:	  SUB	    AX,BX	     ;Subtract next odd no. from AX
	  SBB	    DX,0	     ; and DX
	  JC	    DONE	     ;Did sub. create a borrow?
	  INC	    CX		     ; No. Increment the square root,
	  ADD       BX,2	     ;  calculate the next odd no.
	  JMP       AGAIN	     ;  then go make next subtraction
DONE:	  MOV	    BX,CX	     ; Yes.  Transfer result to BX
	  POP	    CX		     ;  and restore the registers
	  POP	    DX
	  POP       AX
	  RET
SR32      ENDP
OUR_CODE  ENDS
      END       SR32
                