flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Moving ".IF" macro to a higher level

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 12 Nov 2010, 06:14
Hi guys,

Even coding in assembler, I like to have my code as "readable" as possible so... I was wondering if it would be possible to pass function names to the defined ".if" macro. Example:

Code:
; start the party...

  .if ( IsRunning(12) & IsUserRestricted() )

     mov ebx, 1

  .else

     mov ebx, 0

  .endif

; here comes the procedures definitions

IsRunning proc check_param

 ; some code here

 mov eax, 1
 ret

IsRunning endp

IsUserRestricted proc
 
 ; some code here 

 mov eax, 0
 ret

IsUserRestricted endp        


So, the above ".if" would detect that we are passing a function name because of the brackets "( )" and it would generate something like:

Code:
_call IsRunning, 12
cmp eax, 0
jz @ff
_call IsUserRegistered
jz @ff
mov ebx, 1
....    


Thanks!
Post 12 Nov 2010, 06:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20422
Location: In your JS exploiting you and your system
revolution 23 Nov 2010, 13:11
Are you trying to make assembly look like C? Confused

I think you missed the whole point of assembly! Razz
Post 23 Nov 2010, 13:11
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 24 Nov 2010, 00:01
Too late, I remember this was already done some years ago,

(Maybe not exactly with this syntax, maybe not full-featured, I don't remember exactly, but the idea of function-call-inside-if-macro was already here and was implemented).

PS: FASMLIB "libcall" macro did check for error inside nested FASMLIB function call... but nobody cares :'(
Post 24 Nov 2010, 00:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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.