问题
I've searched all over the web, but I couldn't find what the "fh" means in the following instruction and eax, 38fh
. I know that "h" stands for hexadecimal and "d" for decimal, but I've never seen fh before.
回答1:
If an Intel assembler (ie. MASM) token starts with a number (0 to 9) then it is assumed to be that the entire token is a value. If the value ends with an h
the assembler assumes it is Hexadecimal.
In your case 38fh
starts with a number so it is assumed to be a value. The end of the token in your case is h
(or H
) so it is treated as hexadecimal number. So 38f
is treated as a hexadecimal value. The f
just happens to be a valid hexadecimal digit. 38f
is 911 in decimal and 1110001111 in binary.
A problem does arise if you have a token like f8h
. Because it starts with a letter (not a digit 0 to 9) it will be treated as an identifier or symbol. This will likely lead to some form of syntax error if it appeared as and eax, f8h
. The question one may have - if a hexadecimal value starts with a letter A to F how can I represent it using an h
suffix? Simple, just place a 0 on the front. This would work and eax, 0f8h
.
As Fifoernik pointed out One trick would be to use a different capitalization to make the suffix stand out: 38Fh . It might have been easier for a human new to assembler to see that f
was a hexadecimal digit had it been made upper case F
while leaving the suffix character 'h' lower case.
来源:https://stackoverflow.com/questions/37720738/what-does-the-fh-suffix-mean-on-a-number-like-38fh-in-intel-assembly