flat assembler
Message board for the users of flat assembler.

Index > Windows > how do you make the "return" macro return a value?

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 17 Apr 2005, 20:25
Is there a way to make the "return" macro in the "proc" macro take an argument? This is would save me some time in typing.
Post 17 Apr 2005, 20:25
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 18 Apr 2005, 06:06
Assigning a value to EAX and then "return"... Ain't that easy enough?
Post 18 Apr 2005, 06:06
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 18 Apr 2005, 08:56
Should've included an example, I just want to do this: return eax, or something like return [ecx+edx*4]. It would be just a bit easier, that's all.
Post 18 Apr 2005, 08:56
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 18 Apr 2005, 10:23
Code:
call _myproc, NULL

proc _myproc, lpParam
   mov   eax,[lpParam]
   add    eax,012345678h
   return
endp
    
Post 18 Apr 2005, 10:23
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 18 Apr 2005, 15:17
In "%fasminc%/macros/stdcall.inc" you find "macro return %_", replace it with:
(untested)
Code:
macro return retval %_
if ~ retval eq
  mov eax,retval
end if
...
    
You can also check whether or not retval is eax...
Post 18 Apr 2005, 15:17
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 19 Apr 2005, 11:28
Thanks Tommy! Just change the %_ to _% and it works good!
Matt
Post 19 Apr 2005, 11:28
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.