一、逆转字符串
逆转一个字符串可以利用栈这个数据结果,顺次读取所有元素压栈,再出栈所有元素即可逆序
二、push和pop指令
三、pushfd和popfd
四、pushad和popad
五、代码以及结果
TITLE String Reverse INCLUDE Irvine32.inc
includelib Irvine32.lib
includelib kernel32.lib
includelib user32.lib .data
aNAme BYTE "Hello,World",
nameSize = ($ - aNAme) - .code main PROC mov ecx,nameSize
mov esi,
L1:
movzx eax,aNAme[esi]
push eax
inc esi
loop L1 mov esi,
mov ecx,nameSize
L2:
pop eax
mov aNAme[esi],al
inc esi
loop L2
mov edx,OFFSET aNAme
call WriteString
call Crlf
exit main endp END main
结果: