填坑,汇编递归版- Include masm32rt.inc
- .const
- CrLf db 0DH,0AH,0
- .data?
- Input db 20 dup (?)
- .code
- recursion Proc Uses Ebx Eax Ecx lpStr:dword
- Mov Ebx,lpStr
- .If Byte Ptr [Ebx+1] != NULL
- Mov Al,Byte Ptr [Ebx]
- Xor Ecx,Ecx
- .Repeat
- XChg Al,[Ebx+Ecx]
- Mov Byte Ptr [Ebx],Al
- Inc Ebx
- Invoke recursion,Ebx
- Dec Ebx
- XChg Al,[Ebx+Ecx]
- Mov Byte Ptr [Ebx],Al
- Inc Ecx
- .Until Byte Ptr [Ebx+Ecx] == NULL
- .Else
- Invoke StdOut,Offset Input
- Invoke StdOut,Offset CrLf
- .EndIf
- Ret
- recursion Endp
-
- Start:
- Invoke ArgClC,1,Offset Input
- Invoke recursion,Offset Input
- Invoke ExitProcess,NULL
- End Start
- End
复制代码
|