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

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

问题描述

我正在开始汇编,我正在使用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天全站免登陆