I'm new in assembly and was trying to get this program to work, it supposed to calculate the square root of any integer but i don't know how to load the ax into stack, get the square root and return the value to the c++ variable, that was the closest i could come up with, it's really killing me this cuz i can't find it anywhere
plz help

void squareroot(int intA, float Result)
{
asm{
finit
mov ax,intA
mov ss,ax
fsqrt               //Compute sqrt(intA).
fstsw ax
mov Result,ax



}
cout<<"Square root of: "<<intA<<"="<<Result;
getch();
asm{
JMP End
}
End:

right soz for bothering everyone i finally got it :DDD and it works

void square_root(int intA, float Result)
{

asm {
fild intA
fsqrt
fst Result

jmp End
}
End:
cout<<Result;
getch();
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.