如何在MASM代码中编写启动的十六进制数字?
我目前正在编辑几个由MASM代码组成的宏。 它们看起来都与此相似:
Primary MACRO
Key 0Bh,'0'
Key 29h,15h
Key 03h,'2'
Key 06h,'5'
Key 0Ch,'+'
Key 0Dh,'´'
Key 1Bh,'¨'
Key 2Bh,27h
Key 35h,'-'
Key 34h,'.'
Key 33h,','
Key 56h,'<'
ENDM
我注意到我可以编写以下格式(以)字符0-9启动的十六进制数字:02H
,12H
,5AH
,等。 但是,如果我尝试以相同的方式编写字母启动的十六进制数字(也就是说,例如abh
,cah
,dfh
,等等。 ),我有一个错误。我尝试了格式0xba
,0xfe
等,但它也不起作用。
在这种情况下,谁能告诉我正确的格式用于编写登录启动的十六进制数字?
I am currently editing several macros consisting of MASM code.
They all look similar to this:
Primary MACRO
Key 0Bh,'0'
Key 29h,15h
Key 03h,'2'
Key 06h,'5'
Key 0Ch,'+'
Key 0Dh,'´'
Key 1Bh,'¨'
Key 2Bh,27h
Key 35h,'-'
Key 34h,'.'
Key 33h,','
Key 56h,'<'
ENDM
I have noticed that I can write hexadecimal numbers which are initiated by (begin with) character 0-9 in the following format: 02h
, 12h
, 5Ah
, etc.
However, if I try to write letter-initiated hexadecimal numbers in the same way (that is, like ABh
, CAh
, DFh
, etc.), I get an error. I have tried the format 0xBA
, 0xFE
, etc., but it doesn't work either.
Can anyone tell me the correct format to use for writing letter-initiated hexadecimal numbers in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HEX
AB
的正确格式是0ABH
。您需要使用数字启动它的原因是,汇编器可以轻松地将其与标签或符号(例如
abh
)区分开。不用担心它有三位数的事实。因此,它不会神奇地变成十二位数字,因此所使用的位数将取决于您使用的地址模式。
The correct format for hex
AB
is0ABh
.The reason you need to start it with a digit is so the assembler can easily distinguish it from a label or symbol such as
ABh
.And don't worry about the fact it has three digits. It doesn't magically turn into a twelve-bit number because of that, the number of bits used will depend on the addressing modes you're using.