如何检查是否一些重presents在NASM大会大写字符? [英] How to check if a number represents an uppercase character in NASM Assembly?

查看:194
本文介绍了如何检查是否一些重presents在NASM大会大写字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你有存储在 EAX 的数字。如何检查这个数字再$ P $是否psents大写字符或不?

Suppose that you have a number stored in EAX. How can I check whether this number represents an uppercase character or not?

坦率地说,我没有尝试过任何东西。我最近的想法是创造的大写字符('A','B','C'D',...)的数组,然后检查是否 EAX 等于任何这些。有没有更简单的方式在NASM大会做到这一点?

Frankly, I haven't tried anything. The closest idea I had was to create an array of upper case characters ('A','B','C,'D',...) and then check if EAX was equal to any of these. Is there a simpler way to do this in NASM Assembly?

我使用的是64位的CentOS,对于32位程序。

I'm using 64-bit CentOS, for a 32-bit program.

推荐答案

有关ASCII字符,像这样的工作:

For ASCII characters, something like this would work:

cmp eax,'A'
setnc bl    ; bl = (eax >= 'A') ? 1 : 0
cmp eax,'Z'+1
setc bh     ; bh = (eax <= 'Z') ? 1 : 0
and bl,bh   ; bl = (eax >= 'A' && eax <= 'Z')
; bl now contains 1 if eax contains an uppercase letter, and 0 otherwise

这篇关于如何检查是否一些重presents在NASM大会大写字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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