如何在程序集中表示八进制数字? [英] How to represent octal numbers in Assembly?

查看:116
本文介绍了如何在程序集中表示八进制数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如对于十六进制数字,我们可以使用0x983988790h.

For example for hexadecimal numbers we can use 0x98398 or 8790h.

如何编写八进制数字常量?这行得通吗?

How can octal numeric constants be written? Does this work?

mov eax, 70o

推荐答案

NASM支持 70o70q0o700q70八进制.

我建议使用0q70版本,以避免将来(人类)读者将小写字母o误写为零的风险.我也不喜欢十六进制的后缀样式,因为它很容易错过.它有助于使用与常量的其余部分相反的情况,但更清晰的前导0x或0q. (对于十六进制,避免了前导0使其成为数字常量而不是符号名称.)

I'd recommend the 0q70 version, to avoid the risk of future (human) readers mistaking the lower-case-o for a zero. I'm not a fan of the trailing suffix style for hex, either, because it's easy to miss. It helps to use the opposite case from the rest of the constant, but a leading 0x or 0q is clearer. (And for hex, avoids the need for a leading 0 to make it a numeric constant instead of a symbol name.)

对于十六进制常量支持,

As for hex-constant support, it will certainly vary by assembler, so just check your assembler manual. e.g. most DOS/Windows-only assemblers don't support 0xDEADBEEF, only 0DEADBEEFh style, so I'd guess they have fewer options for octal, too.

请参见标签Wiki的问题,以获取指向以下链接的链接各种汇编器手册(以及许多其他有用的资源和指南).

See the x86 tag wiki for links to various assembler manuals (and lots of other useful resources and guides).

这篇关于如何在程序集中表示八进制数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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