I find it rather irritating when I get this message when I try to move parts of a string (declared as byte) in to a reg32, couldn't fasm output a warning instead of an error for this? Instead of halting the compilation, when the operans are a register and a memory location. IMO one should in "the fasm standard syntax" specify the operand sizes when "overriding" the original declation, but I don't think it should be neccesary when using GPRs and memory opernads.
As I stated in the subject field, this is just a little comment from me, nothing that bothers me big time.
Posted on 2003-06-03 13:53:29 by scientica
Wouldn't that need a compleatly new opcode? MOV -> MOVZX ? Or am I thinking wrong here?
Posted on 2003-06-03 14:31:34 by Delight
uhm, no. movzx isn't that zero extended mov? Perhaps I should give an code example.

What I mean is if I declate a string like this:
szFooBar db "Foo",0

and I do this:
mov eax,

I get the operand size error, but if I type
mov eax, dword
then no error, don't you think it would be better with a warning ("Warning: Openand sizes do not match") rather than a fatal error?
Posted on 2003-06-03 23:45:46 by scientica
Afternoon, scientica.

But a warning would mean "wtf is this supposed to mean?"

szFooBar is declared as a bunch of bytes.
would mean the coder wants the first byte.
mov eax, would mean the coder wants the first byte put into eax?
But eax is a dword!
mov eax, would mean the coder wants the first dword put into eax?

In any case, whether it's a warning or an error, the coder should check the code to make sure it's going to assemble correctly.

Since the coder should stop and check the code in either case, it's better (IMO) to have this as an error and not a warning.

Cheers,
Scronty
Posted on 2003-06-04 00:45:34 by Scronty

But a warning would mean "wtf is this supposed to mean?"

Yes, but what is most likley when typing mov reg32, ? A dword move is the most likley action, and the compiler should assume this and output a notification that the compiler made this assumption via an warning message that says something like "Conflicting operand size, assuming regiser size for operand size".


szFooBar is declared as a bunch of bytes.
would mean the coder wants the first byte.
mov eax, would mean the coder wants the first byte put into eax?
But eax is a dword!
mov eax, would mean the coder wants the first dword put into eax?

If I want to put the first byte of szFooBar in eax I'd use either xor eax,eax / mov al, or use movzx eax, byte . If i say put the data at in eax then I mean put the dword at , I don't say put the byte at in eax.
I still think that a mov to a reg from memory should follow the register size unless an override is specified, a mov to eax from should grab a dword at and put it in eax, and output a warning unless I've specified dword as override.


Since the coder should stop and check the code in either case, it's better (IMO) to have this as an error and not a warning.

No, IMO an warning is better (as you've probably already noticed), since it's not fatal. Becuase IMO, when typing mov reg32, then a dword is to be moved to reg32 unless other is said.


In any case, whether it's a warning or an error, the coder should check the code to make sure it's going to assemble correctly.

Yes, but once more, a warning isn't fatal. And IMO, at a "release" the source code should be in the "the fasm standard syntax", but when still developing/debuggging a greratere tolerance should be allowed.
Posted on 2003-06-04 02:06:02 by scientica
IMHO it would be quite nice to treat variable like as label (it is treated in this manner in the most cases). Then it just would say: get value in the size correct to register from labeled address and put it into register.
But the problem is that looking on the others code somebody would find sematic error. I see db putting into reg32? Something isn't right. Those dword before tells me that I get dword from this address no byte.
Using dword is propably good to be compatibile to other asm compilers (like TASM) but I thing it should be only warnig too. FASM is compiler which is wery close to processor. Let it behave like processor. He can inform me about possible sematic error, but syntaticly it is everything rigth. Second operand had to be only memmory addres. So what it is defined as byte. Programmer is computer God. If he want it, let him do this. If it would make program not working, compiler could always say: "I told you" :)
Posted on 2003-06-04 06:10:31 by Dryobates

Programmer is computer God. If he want it, let him do this.

If he wants it, he should tell what he wants unambiguosly. That's why "mov eax,dword " should be used, "mov eax," while szFooBar is declared as byte label is the same "mov eax,byte " and therefore it should be clear why fasm sees it as an error.
Posted on 2003-06-04 06:41:57 by Tomasz Grysztar
ok, then I'll just have to put a jmp @F over my lazyness ;)
Posted on 2003-06-04 08:13:16 by scientica
A question raised would be, if you declare a variable using dd instead of db would this then preclude taking byte level action?



szFooBar dd "Foo",0

instead of:


szFooBar db "Foo",0
Posted on 2003-06-15 02:49:20 by jInuQ
Yes, you would have to do mov al, byte and mov eax, .
Posted on 2003-06-15 10:22:02 by comrade