Bunch of 9 different but unique guys, each with their own quality, good and bad.

Monday, October 09, 2006

SQUARE ROOT of 32 BIT NO.
Author:rahul

Comment: the 32 bit no can be entered as 2 16 bit nos with least significant word entered first followed by msw

Status:PERFECT

Prog:
.model small
.data
num dw 8001h,8ffeh
root dw 1 dup(0)
.code
start: mov ax,@data
mov ds,ax
mov si,offset num
mov bx,0h
a: clc
inc bx
mov ax,bx
mul bx
mov cx,ax
sub cx,[si]
mov cx,dx
sbb cx,[si+2]
jb a
xor dx,[si+2]
jnz b
xor ax,[si]
jz finish
b: dec bx
finish: mov di,offset root
mov [di],bx
mov ax,4c00h
int 21h
end start
end

0 Comments:

Post a Comment

<< Home