flat assembler
Message board for the users of flat assembler.

Index > Main > Stop fasm complaining about operand sizes?

Author
Thread Post new topic Reply to topic
AzraelUK



Joined: 23 Nov 2008
Posts: 3
AzraelUK 24 Nov 2008, 18:20
Is there a way to stop fasm giving the error 'operand sizes do not match.'? I've got 32 reserved bytes with an ASCII string, and to do comparing I figure the fastest way to do it is 4 bytes at a time. However, because the string is defined with rb, if I try 'mov eax, [user+ecx]' then it will give the operand size error because it doesn't understand that I want to load four bytes of data into eax, rather than just the one.

Is there any way to coerce the assembler into letting me do this? Reserving the bytes with rd isn't an option, because I need to play with the individual bytes of the string in other parts of the code.

The only solution I can think of is loading each byte into al and then doing a shl 8, but that's so tedious I may as well just give up and write my program in C. Wink
Post 24 Nov 2008, 18:20
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 24 Nov 2008, 18:34
AzraelUK, use label directive or override type with dword operator.


Last edited by baldr on 24 Nov 2008, 18:36; edited 1 time in total
Post 24 Nov 2008, 18:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20513
Location: In your JS exploiting you and your system
revolution 24 Nov 2008, 18:36
Or just use the dword override:
Code:
mov eax,dword[user+ecx]    
Post 24 Nov 2008, 18:36
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 24 Nov 2008, 18:39
revolution,

I thought about two labels to the same address and edited post… And you was first, Mr. Hyde! Wink
Post 24 Nov 2008, 18:39
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20513
Location: In your JS exploiting you and your system
revolution 24 Nov 2008, 18:41
baldr: Too slow Dr. Jekyll.
Post 24 Nov 2008, 18:41
View user's profile Send private message Visit poster's website Reply with quote
wht36



Joined: 18 Sep 2005
Posts: 106
wht36 26 Dec 2008, 06:52
The easiest is just put a colon after your label.
So instead of
Code:
a_string rb 32    

use
Code:
a_string: rb 32    
Post 26 Dec 2008, 06:52
View user's profile Send private message 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.