So I am wondering why I cannot do this
mov eax, ffffffffh
but I can do this:
mov eax, 0ffffffffh
Could anybody explain please? In this case, I am using the Flat Assembler but I think this is not assembler-specific.
Reverse Engineering Stack Exchange is a question and answer site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation. It only takes a minute to sign up.Sign up to join this community
Most assemblers require numeric constants to begin with a digit, this is so they can distinguish between them and labels.
You can see it in FASM Fundamental syntax rules:
Numbers are distinguished from names by the fact that they either begin with a decimal digit, or with the "$" character followed by any hexadecimal digit. This means that a token can be considered numeric even when it is not a valid number. To be a correct one it must be one of the following: a decimal number (optionally with the letter "d" attached at the end), a binary number followed by the letter "b", an octal number followed by the letter "o" or "q", or a hexadecimal number either prepended with "$" or "0x", or followed by the character "h". Because the first digit of a hexadecimal number can be a letter, it may be needed to prepend it with the digit zero in order to make it recognizable as a number. For example, "0Ah" is a valid number, while "Ah" is just a name.
and in MASM Manual as well:
Hexadecimal numbers must always start with a decimal digit (0–9). If necessary, add a leading zero to distinguish between symbols and hexadecimal numbers that start with a letter.
0ffffffffh you can see 8 significant hex digits, exactly as you'd expect. This is not unique to
0ffffffffh, another numeric literals should be written with a leading zero as well --
These days it is common for assemblers to support the
0xffffffff syntax. If yours is not (FLAT supports it), make sure to pay attention to the leading zero, otherwise the hexadecimal value would be interpreted as a label or another symbol name.