flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
DimonSoft
Ben321 wrote: To put hexadecimal numbers into the assemble you can do something like 3Eh or 0x3E. While this works for hex numbers that start with a numerical digit like 3, it doesn't work for ones that start with a letter digit like E. For example, while 0xE3 works, E3h does NOT work in FASM. The reason is it says (in its popup error message box) it is an unrecognized label. It seems to think that just because the string started with an E that it's a non-numerical string, and it ignores the h at the end. And then you’ll see people complaining that FASM recognizes F3h as hexadecimal literal instead of an identifier: Code: F3h: ; Implementation of Function 3h goes here How would you define the rules for a valid identifier then? |
|||
![]() |
|
Tomasz Grysztar
Very early versions of fasm were universally case-sensitive and allowed numbers like E3h. From this followed that Ah was a valid hexadecimal number while ah was a register name. This was a very BAD idea and I quickly abandoned the experiment. I proceeded to implement the standard rule held by assemblers that a number must always start with a digit in 0-9 range, so you need to write 0Ah (and you are also allowed to write it as 0aH or 0ah, or 0AH).
|
|||
![]() |
|
Ben321
Tomasz Grysztar wrote: Very early versions of fasm were universally case-sensitive and allowed numbers like E3h. From this followed that Ah was a valid hexadecimal number while ah was a register name. This was a very BAD idea and I quickly abandoned the experiment. I proceeded to implement the standard rule held by assemblers that a number must always start with a digit in 0-9 range, so you need to write 0Ah. What about when you are trying to refer to A0000000h? There's no higher hex digit than the 8th hex digit, when working with 32bit numbers. As far as I know, using "h" at the end of the hex string is standard for 32bit numbers is standard for assemblers. Or what if you are just using one byte of data at its maximum value value of FFh? That should work, but it won't in FASM. I could do 0FFh, but 0FFh indicates that there's 3 nibbles of data being worked with, even though a byte (the data I'm working with) contains only 2 nibbles. Again, it's important to stick with the industry standard for assemblers, that hex strings always use uppercase letters, and that the last symbol in a hex string is a lowercase h. |
|||
![]() |
|
Tomasz Grysztar
Ben321 wrote: Again, it's important to stick with the industry standard for assemblers, that hex strings always use uppercase letters, and that the last symbol in a hex string is a lowercase h. If you dislike that starting 0 so much, there is also a $FFFFFFFF syntax allowed. |
|||
![]() |
|
DimonSoft
Ben321 wrote: Again, it's important to stick with the industry standard for assemblers, that hex strings always use uppercase letters, and that the last symbol in a hex string is a lowercase h. Can you give a link to the standard you’re talking about? Tomasz Grysztar wrote: From this followed that Ah was a valid hexadecimal number while ah was a register name. This was a very BAD idea and I quickly abandoned the experiment. Wow! That’s an even better example. Thanks. |
|||
![]() |
|
revolution
Some assemblers use the position of the text to decide if it is a label or a number. So if the text starts on the first column (col=1) then it is a label regardless of which character it begins with. So those assemblers allow labels like "0x3e" AND numbers like "0x3e" all mixed together in the same file.
Industry standard? I don't believe such a thing exists. Often the first assembler we encounter becomes the "normal" syntax and thus should be the "standard" syntax all others should follow. But once we encounter other assemblers and see that they are very different from each other we begin to understand that standards don't really exist. |
|||
![]() |
|
revolution
In fasm we used to be able to specify the floating point number ".e", and the label ".e" was not possible.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.