装配中的双重条件检查 [英] double condition checking in assembly

查看:26
本文介绍了装配中的双重条件检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始组装,我正在使用 nasm 来组装代码,我正在尝试处理驻留在内存中的字符串并更改它,我想检查一个字节是否在某个范围内(ascii),以便我可以决定如何处理它,我似乎无法弄清楚如何检查一个值是否在某个范围内,我全都知道不同类型的跳转标志,但我如何组合 2 cmp 语句?

i'm beginning assembly, i'm using nasm for assembling the code, i'm trying to process a string residing in memory and change it, i want to check if a byte is in a certain range (ascii) so i can decide what to do with it, i can't seem to figure how to check if a value is in a certain range, i know all about the different kind of jump flags but how can i combine 2 cmp statements ?

我的问题是:我如何在组装中产生与此类似的东西?

my question is : how do i produce something similiar to this in assembly ?

if (x>=20 && x<=100)
     do something

非常感谢!

推荐答案

取决于您使用的语法,并假设 xeax 寄存器中,某些东西像这样:

Depending on what syntax you're using, and assuming x is in the eax register, something like this:

cmp  eax, 20
jl   ELSE
cmp  eax, 100
jg   ELSE
#do something
jmp  END

ELSE:
#do else

END:

这篇关于装配中的双重条件检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆