//汉诺塔
思路来源:
https://blog.csdn.net/xb2355404/article/details/79144451
.386 .model flat, stdcall include kernel32.inc includelib kernel32.lib includelib msvcrt.lib ;引用C库文件 printf PROTO C:ptr sbyte,:vararg ;C语言printf函数原型声明 scanf PROTO C:ptr sbyte,:vararg ;C语言scanf函数原型声明 option casemap :none ;*【*/ .data InFmt BYTE '%d', 0 OutFmt BYTE '%c移1个盘到%c', 0AH , 0 .data? n DWORD ? .code moved PROC a:DWORD, c_:DWORD MOVZX EAX, BYTE PTR a MOVZX EBX, BYTE PTR c_ invoke printf,ADDR OutFmt, EAX, EBX RET moved ENDP hanoi PROC n_:DWORD, a:DWORD, b:DWORD, c_:DWORD MOVZX EAX, BYTE PTR a MOVZX EBX, BYTE PTR b MOVZX ECX, BYTE PTR c_ .IF n_ == 1 invoke moved, a, c_ MOVZX EAX, BYTE PTR a MOVZX EBX, BYTE PTR b MOVZX ECX, BYTE PTR c_ .ELSE MOV EDX, n_ DEC EDX invoke hanoi, EDX, EAX, ECX, EBX MOVZX EAX, BYTE PTR a MOVZX EBX, BYTE PTR b MOVZX ECX, BYTE PTR c_ invoke moved, EAX, ECX MOVZX EAX, BYTE PTR a MOVZX EBX, BYTE PTR b MOVZX ECX, BYTE PTR c_ MOV EDX, n_ DEC EDX invoke hanoi, EDX, EBX, EAX, ECX .ENDIF RET hanoi ENDP start: invoke scanf, ADDR InFmt, ADDR n invoke hanoi, n, 'A', 'B', 'C' end start invoke ExitProcess,0 ;*】*/
文章来源: https://blog.csdn.net/c44303436/article/details/88924002