flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Compatibility with "dword ptr [xxx]", etc from MAS

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 17 Apr 2008, 11:34
Hello guys,

Is there any way that I can use the "PTR" keyword in FASM like in MASM when accessing to a memory address?

Example:

mov eax, dword ptr [ebx]

I know that FASM is more friendly and does not need the "PTR" but I have some code to convert and I'm also quite used to "PTR" keyword.

I have tried the following macro with no success:

macro PTR { }

Trying to assign it to "nothing" but it doesn't seem to do the job.

Any ideas?

Thanks a lot!!!
Post 17 Apr 2008, 11:34
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 17 Apr 2008, 11:48
manual of fasm

Quote:

When operand is a data in memory, the address of that data (also any numerical expression, but it may contain registers) should be enclosed in square brackets or preceded by ptr operator. For example instruction mov eax,3 will put the immediate value 3 into the EAX register, instruction mov eax,[7] will put the 32-bit value from the address 7 into EAX and the instruction mov byte [7],3 will put the immediate value 3 into the byte at address 7, it can also be written as mov byte ptr 7,3. To specify which segment register should be used for addressing, segment register name followed by a colon should be put just before the address value (inside the square brackets or after the ptr operator).



use seek and replace tool:
"ptr" ==> "nothing"

note fasm macro are case sensitive, if the name of macro is PTR in order to replace ptr, it will not work.
Post 17 Apr 2008, 11:48
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 17 Apr 2008, 11:55
You can use "fix" or "equ", but redefining syntax keywords is not really the best idea. In FASM, "ptr" works differently
Post 17 Apr 2008, 11:55
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 17 Apr 2008, 12:56
Code:
...
ptr equ
...    
ought to do the trick
Post 17 Apr 2008, 12:56
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 17 Apr 2008, 13:16
THANKS!!!!
Post 17 Apr 2008, 13:16
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.