《intel 汇编语言程序设计》第八章练习题 ;程序的描述:求最大公约数算法的汇编递归实现,欧几里得算法又称辗转相除法;作者:落叶树;创建日期: 16 : 42 2007 - 7 - 30 ;版本:INCLUDE Irvine32.inc.data.codemain PROC mov eax,1000h mov ebx,100h call TwoIntnoRecursive_gcd ;大写的被禁止了,晕 call DumpRegs call Crlf exitmain ENDP;其他子程序TwoIntnoRecursive_gcd PROC;参数:eax,ebx为求最大公约数的两个整数;返回:edx为最大公约数 push eax push ebx test eax,80000000h . if Sign ? neg eax ;求绝对值 .endif test ebx,80000000h . if Sign ? neg ebx ;求绝对值 .endif . if eax < ebx xchg eax,ebx .elseif ebx == 0 mov edx,eax ;当余数为0,返回edx值 jmp quit .endif mov edx, 0 div ebx mov eax,ebx mov ebx,edx call TwoIntnoRecursive_gcd quit: pop ebx pop eax retTwoIntnoRecursive_gcd ENDPEND main