复杂的IF语句汇编 [英] complex IF statement in assembly
本文介绍了复杂的IF语句汇编的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我应该如何在装配写出这样的如果
语句?
How should I write such an if
statement in assembly?
if ((a == b AND a > c) OR c == b) { ...
平台:英特尔32位机,NASM语法
Platform: Intel 32-bit machine, NASM syntax.
更新
有关变量类型和价值,使用什么是更容易理解。整数会正常工作对我来说,我猜。
For variable types and value, use whatever is more easy to understand. Integers would works fine for me, I guess.
推荐答案
在一般的组装,这将是基本上是这样的( A
在 AX
, b
在 BX
, C
在 CX
)
In generic assembly, it will be basically something like this (a
in ax
, b
in bx
, c
in cx
):
cmp bx, cx
jeq istrue
cmp ax, cx
jle isfalse
cmp ax, bx
jeq istrue
isfalse:
; do false bit
jmp nextinstr
istrue:
; do true bit
nextinstr:
; carry on
如果没有虚假位,它可以被简化为:
If there's no false bit, it can be simplified to:
cmp bx, cx
jeq istrue
cmp ax, bx
jne nextinstr
cmp ax, cx
jle nextinstr
istrue:
; do true bit
nextinstr:
; carry on
这篇关于复杂的IF语句汇编的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文