【发布时间】:2013-07-25 23:51:02
【问题描述】:
假设我有一个高级语言的 while 循环,看起来像:
当 i >= 0 且 x
x86 中的汇编代码看起来如何?我曾尝试考虑将 cmp 用于 while 语句的条件部分,但我不确定 AND 将如何实现。
谢谢
【问题讨论】:
标签: loops assembly while-loop x86 conditional
假设我有一个高级语言的 while 循环,看起来像:
当 i >= 0 且 x
x86 中的汇编代码看起来如何?我曾尝试考虑将 cmp 用于 while 语句的条件部分,但我不确定 AND 将如何实现。
谢谢
【问题讨论】:
标签: loops assembly while-loop x86 conditional
;; assuming eax contains i, ecx contains x
myloop:
test eax, eax
jl exitloop ; i < 0
cmp ecx, 5
jge exitloop ; x >= 5
;; loop content goes here
jmp myloop
exitloop:
;; life continues after the loop
【讨论】: