GCD in assembly lanuage..

TurtleMan

Golden Member
May 3, 2000
1,424
0
76
Man.. i just don't get assembly lanuage... been programming in java
but now IM try to do find gcd and do it in assembly
it just throw me off....

anyone have any idea how to do such thing ?

I know i have to put the variables into the registers
mov eax, a
mov ebx, b
and a b both are int ,

so i know i have to use cmp value, but i don't get what to know next,

can someone help out ?
 

TurtleMan

Golden Member
May 3, 2000
1,424
0
76
wow......that algorthim looks so hard.....

is it possible to do that much in assembly...
 

Apathetic

Platinum Member
Dec 23, 2002
2,587
6
81
Why don't you write it first in Java and then take your Java and break it down into VERY simple statements? Then take that code and try to translate it into assembly.

For example, turn this
a = b + c;

Into:
a=b;
a=a+c;

And then into
mov eax, b
adc eax, c

It won't give you the best assembly, but it should give you something which works.

Dave