我们的任务是比较整数值并打印出适当的提示以显示哪些值更大.
我在下面的代码分别将'i'和'j'初始化为5和4.目标是比较"变量"而不是直接值本身.所以在这个例子中,我把'i'和'j'放在cmp中,而不是5和4.
global _main
extern _printf, _system
section .text
_main:
; clear screen
push clr
call _system
add esp, 4
;Test prints out i. Successfully does the job.
push dword [i] ; why did it work here and not in *cmp*?
push prompt2
call _printf
add esp, 8
;compare values and do a conditional jump.
CMP dword [i], dword [j] ; compares values stored in i and j. i and j are base 10 nums. This is where …
Run Code Online (Sandbox Code Playgroud)