如何在 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屋!