flat assembler
Message board for the users of flat assembler.
Index
> Main > Undefined symbol hex Goto page 1, 2 Next |
Author |
|
revolution 05 Oct 2017, 15:41
All numbers must start with a digit, (0-9) only. So you need 0FFFFFFFFh
But also note that you can't encode this number for RCX. Instead you can sign extend it to 0FFFFFFFFFFFFFFFFh, or perhaps more simply -1. |
|||
05 Oct 2017, 15:41 |
|
Tomasz Grysztar 05 Oct 2017, 15:52
It seems that manual for fasm 1 has this detail not clarified. The fasmg manual does it a bit better:
Fundamental syntax rules wrote: 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 a name. revolution wrote: But also note that you can't encode this number for RCX. Instead you can sign extend it to 0FFFFFFFFFFFFFFFFh, or perhaps more simply -1. |
|||
05 Oct 2017, 15:52 |
|
revolution 05 Oct 2017, 16:11
Tomasz Grysztar wrote:
|
|||
05 Oct 2017, 16:11 |
|
Furs 06 Oct 2017, 10:57
Just use 0xFFFFFFFF, problem solved. Superior notation anyway.
|
|||
06 Oct 2017, 10:57 |
|
revolution 06 Oct 2017, 11:01
How about 1 shl 32-1?
|
|||
06 Oct 2017, 11:01 |
|
Furs 06 Oct 2017, 11:04
Well I was talking about notation for hex numbers (and this was just one example), otherwise of course there's an infinite ways you can write it as (with a lot of redundancy), even decimal. But anyway I meant 0x is superior to h notation (because C/C++ also use it and they are the best HLL languages )
I'd use "1 shl 32-1" if it made sense, depending on context (for example if it was related to a mask of bits, or bitfield) |
|||
06 Oct 2017, 11:04 |
|
revolution 06 Oct 2017, 11:15
Or perhaps 1 shl (1 shl 5) - 1. That way we can change it to a 64 bit mask by only changing the 5 to a 6.
|
|||
06 Oct 2017, 11:15 |
|
Tomasz Grysztar 06 Oct 2017, 11:34
Furs wrote: Just use 0xFFFFFFFF, problem solved. Superior notation anyway. A note on a margin: this is just a curiosity, but early versions of fasm were so strongly case-sensitive that all hexadecimal digits had to be upper case. But thanks to that these early releases allowed hexadecimal numbers to start with a letter - for example "Ah" was a valid hexadecimal number, distinguished only by the case from the x86 register "ah". |
|||
06 Oct 2017, 11:34 |
|
Tomasz Grysztar 06 Oct 2017, 11:53
Furs wrote: (because C/C++ also use it and they are the best HLL languages ) |
|||
06 Oct 2017, 11:53 |
|
Furs 06 Oct 2017, 13:42
Tomasz Grysztar wrote:
C/C++ also have great syntax (even though a lot of people bash it, they just don't understand what true programming is about). Examples:
Compare: Code: a = 5; b = 6; Code: let a be 5; let b be 6; Another thing about C/C++ is the fact that they allow you to be "raw" with your stuff. It's not required, but they allow you to. "Safe arrays" being a builtin language construct (instead of library feature) is just dumb, if it concerns a runtime cost. This is why D is a horrible language, even though it's similar to C++. Languages that get compiled to machine code should be as optimized as possible. No infesting the runtime with crap. Minimally invasive machine code. Otherwise, managed or scripting languages should be used. Compiling to machine code should be a serious thing not a casual crap and ending up with super bloated executables. For casuals scripting languages fit the bill just fine. Yeah, C++ is bloated, but if you compare any program compiled in C (less C++) versus any of the other popular HLLs, you always see C much smaller and more efficient. That's because the other languages should not be compiled to machine code. That's what makes them horrible. Infest the machine code with crap like "safe arrays" and redundant checks during runtime is appalling. At least managed code has this built-in, so it's more tolerated. Then again, a lot of people also bash x86 (and bashed it for a long time) clinging to stupid RISC designs, fortunately x86 won the popularity contest or we'd be stuck with those idiocies like MIPS (ARM is more tolerable at least). Doesn't change the fact x86 is the best (to me). x86 isn't perfect though, it has a lot of redundancy. But RISC has much more redundancy, in the name of "order". A lot of people like RISC because it's more "ordered" and "simple" as in almost all operations are similar in structure, but that is exactly why it's NOT good and I despise it. This leads to redundancy in the name of keeping things simple. The best, objectively, is that which has zero redundancy. I know that you, for example, said you liked the sal opcode because it kept a nice symmetry. I completely disagree with this idea. sal is perfect example of redundancy that should not exist and I hate it. That's why I despise RISC and don't care how "clean" people say it is. Everything redundant should be special purposed, that would be an ideal CPU without the human mind infesting it. (e.g. xor reg, reg may be the only way to clear something to zero, sub reg, reg should be something special and such) |
|||
06 Oct 2017, 13:42 |
|
revolution 06 Oct 2017, 14:22
Hehe, a number formatting question turns into a CISC vs RISC discussion only on board.flatassembler.net.
I don't like to think of things like this as better or worse, but rather just different, and for different purposes, different needs, different prices, different power usages, different memory sizes, different ... Fortunately popularity does not equate to better. The former is quantifiable, the latter is subjective. |
|||
06 Oct 2017, 14:22 |
|
Tomasz Grysztar 06 Oct 2017, 15:01
revolution wrote: I don't like to think of things like this as better or worse, but rather just different, and for different purposes, different needs, different prices, different power usages, different memory sizes, different ... |
|||
06 Oct 2017, 15:01 |
|
revolution 06 Oct 2017, 19:52
Tomasz Grysztar wrote: A note on a margin: this is just a curiosity, but early versions of fasm were so strongly case-sensitive that all hexadecimal digits had to be upper case. But thanks to that these early releases allowed hexadecimal numbers to start with a letter - for example "Ah" was a valid hexadecimal number, distinguished only by the case from the x86 register "ah". |
|||
06 Oct 2017, 19:52 |
|
Tomasz Grysztar 06 Oct 2017, 20:00
revolution wrote: I'm actually glad I never saw those versions. I might never have come back to see a later version. I would have been scarred for life. |
|||
06 Oct 2017, 20:00 |
|
Furs 07 Oct 2017, 11:33
Well, I never said that they're good because they are popular. Heck, I hate Java or Python and they're both "popular" (especially Python, the syntax is just horrendous and forced indentation is ugh...). I only stated that it's good C/C++ became popular (in my opinion of course) since they have good syntax (to me, not as a literature author ).
I don't think C is perfect though. Function pointer syntax is a bit... ehm hard to grasp for newbies. It does make sense when you learn how it parses though. Wouldn't say I'm a fan of that. Also, Lisp is a nice concept but again, the syntax is horrendous. It's great that it is compact and is less ugly than some Perl's "compact syntax", but the parentheses just throw me off. They just look so intimidating. |
|||
07 Oct 2017, 11:33 |
|
Tomasz Grysztar 07 Oct 2017, 13:09
Furs wrote: Also, Lisp is a nice concept but again, the syntax is horrendous. It's great that it is compact and is less ugly than some Perl's "compact syntax", but the parentheses just throw me off. They just look so intimidating. |
|||
07 Oct 2017, 13:09 |
|
neville 08 Oct 2017, 04:11
I want to revisit the '0x' notation convention used by C/C++ etc which I absolutely despise because I feel strongly that it is totally illogical and therefore completely without merit.
For a start it obviously requires ALL hex numbers to start with a '0' whether they need to or not. That's inefficient and just plain DUMB!! Secondly it uses 'x' for hex. That's about as logical as using 'y' for assembly or 'r' for assembler... h is for hex, just as d is for decimal etc. Thirdly, it precedes the hex number with its stupid notation which probably prevents the 2-char sequence '0x' ever being used as a string elsewhere, at least not without some useless warning message from the compiler... So its clearly time for a far superior HLL, maybe called C++++, in which hex numbers are ONLY identified by a trailing 'h' and must be preceded by a '0' ONLY if they start with an 'alpha' digit _________________ FAMOS - the first memory operating system |
|||
08 Oct 2017, 04:11 |
|
revolution 08 Oct 2017, 06:39
Code: 0hffffffff 0xffffffff 0ffffffffh $ffffffff hex(ffffffff) ffffffff_hex |
|||
08 Oct 2017, 06:39 |
|
Furs 08 Oct 2017, 10:58
neville wrote: For a start it obviously requires ALL hex numbers to start with a '0' whether they need to or not. That's inefficient and just plain DUMB!! neville wrote: Secondly it uses 'x' for hex. That's about as logical as using 'y' for assembly or 'r' for assembler... h is for hex, just as d is for decimal etc. Code: 1234UL ; unsigned long integer, base 10 0x1234UL ; unsigned long integer, base 16 1.0f ; single-precision floating point constant Code: 1234hUL ; WTF is this hUL unit/format?!? neville wrote: Thirdly, it precedes the hex number with its stupid notation which probably prevents the 2-char sequence '0x' ever being used as a string elsewhere, at least not without some useless warning message from the compiler... Consistency must not be your forte. |
|||
08 Oct 2017, 10:58 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.