如何在Masm代码中写字母起始的十六进制数字? [英] How do I write letter-initiated hexadecimal numbers in masm code?
问题描述
我目前正在编辑由MASM代码组成的几个宏. 它们看起来都与此类似:
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
我注意到我可以用以下格式写由十六进制数字(由字符0-9开始)的十六进制数字:02h
,12h
,5Ah
等.
但是,如果我尝试以相同的方式写字母起始的十六进制数字(即ABh
,CAh
,DFh
等),则会出现错误.我已经尝试过0xBA
,0xFE
等格式,但是它也不起作用.
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?
推荐答案
十六进制AB
的正确格式为0ABh
.
The correct format for hex AB
is 0ABh
.
您需要以数字开头的原因是,以便汇编程序可以轻松地将其与标签或符号(例如ABh
)区别开.
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.
这篇关于如何在Masm代码中写字母起始的十六进制数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!