flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > what's the use of coding things like "dword eax"?

Author
Thread Post new topic Reply to topic
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
In current fasm (1.67.23) you can write things like
Code:
mov eax,dword ebx
    

Does that make sense?

also, you can write
Code:
mov eax,word ebx
    

which will generate an "operand sizes do not match" error.

Tomasz:
What if we disallow the usage of size prefixes before registers, would that make fasm's code more complicated or could we even drop some code?

I mean, both examples are nonsense, the first one because register sizes are implicit, the second one because register sizes are fixed.
Post 29 Oct 2007, 16:01
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
I think extra explicitness isn't a problem. You could use same argument for "mov eax, dword [abcd]".
Post 29 Oct 2007, 16:12
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
i think it is for coders that are used to other asm compilers

but in fact this is not really usefull

twobytes db 0,1
db 2,3
mov eax,dword[twobytes]

this is usefull to override the size of the label, and by evidence, tomasz didn't see any problem to let the user writing explicit sizes in instructions
in my case it's really not a problem, i focus my mind on coding, not on compiler features

if you don't understand why you can write
mov eax,dword ebx
it's only because for compiler, the operands are threaded one by one, so, if you see mov, then it's a mov instruction, if you see eax, it's the eax register the destination, if you see dword, it means that the following operand size is a dword, even if it's not a dword
if you see ebx, it means that the source is ebx

there is no reason to add a test to see if there is need or not of dword like statement
it's to the coder to make this
Post 29 Oct 2007, 17:08
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2912
Location: [RSP+8*5]
bitRAKE
Sometimes macros are used without restiction on operand type, but limiting to dword size. Such instances would be more difficult to code without the ability to overstate implicit sizes.
Post 01 Nov 2007, 16:05
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.