flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Macro itself substitutes AL or AX or EAX. How ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 598
Roman
Code:
macro .  chDest,chVal { mov eax,chVal
                                  mov [chDest],eax
                    }
    


Work good if i put dword Value.
Code:
. Life,0xffff
    


But how work with byte or word or qword ?
Code:
. Life, byte 100  or . Life, qword 0xffffffffffff
    


Does not want to make a few macros ! For byte or for qword value.
I want one universal macro Smile
Post 28 Mar 2014, 11:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
Not sure what you are trying to do actually, but this appears to be what you are asking for:
Code:
macro . dest,val {mov [dest],val }    
BTW: A single dot is a special character inside struc macros.
Post 28 Mar 2014, 11:35
View user's profile Send private message Visit poster's website Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 729
tthsqe
roman, after reading the fasm pdf, I think the eqtype operator will be good for you. something like
Code:
if chVal eqtype byte 0
   ; use al/ah
elseif chVal eqtype word 0
  ; use ax
elseif chVal eqtype dword 0
  ; use eax
...    

Hopefully a more experienced fasmer can comment on this operator.

EDIT: i thiks revolution's answer doesn't work for qwords
Post 28 Mar 2014, 11:37
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 598
Roman
Thanks tthsqe
Post 28 Mar 2014, 12:07
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.