我正在尝试在程序集中创建一个 for 循环,其中EAX
寄存器设置为 5,并增加直到大于 10。每次增加时,它都会输出它的当前值。当我执行我的程序时,它进入一个只输出 4 的无限循环。为什么EAX
的值为 4?为什么寄存器EAX
没有按应有的增加?
include 'include/macro/import32.inc'
format PE console
entry start
section '.text' code readable executable
start:
mov eax,5
loop1:
inc eax
push eax
push msg2
call [printf]
cmp eax,10
jb loop1
call [getchar]
push 0
call [exit]
section '.data' data readable writable
msg2 db "%i",0dh,0ah,0
section 'idata' import data readable
library msvcrt,"msvcrt.dll"
import msvcrt,printf,"printf",getchar,"getchar",exit,"exit"