Win32汇编递归实现累加

.386 .model flat,stdcall include msvcrt.inc ;为了使用C输出函数crt_printf includelib msvcrt.lib .data outMsg db '累加计算结果:%d',0ah,0dh,'当前寄存器数据:',0ah,0dh,' eax=%d,ecx=%d',0 .code CalcSum PROC ;Calculates the sum of a list of integers ;Receives: ecx = count ;Returns: eax = sum cmp ecx,0 je L2 add eax,ecx dec ecx call CalcSum ;recursive self L2: ret CalcSum endp Main PROC mov ecx,5 mov eax,0 call CalcSum invoke crt_printf,addr outMsg,eax,eax,ecx ret Main endp end Main

你可能感兴趣的:(c,汇编,list)