flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Case Macro: Is it possible?

Author
Thread Post new topic Reply to topic
KronosRJ



Joined: 03 Jul 2005
Posts: 15
KronosRJ 06 Jul 2005, 14:35
Hi all,

First of all, I would like to compliment privalov on FASM. It has a really wonderful preprocessor.

I would like to buid a macro that would enable me to write something like:

Code:
macro case a_dwdValue,[args]
{
    forward
        cmp a_dwdValue,args
        je .args1
}
    


Where args1 would be the argument after args.

The use would be something like
Code:
     mov eax , [esp + 4]
     case eax,15,Found0,20,Found0,30,Found1,35,Found2,NotFound
    


Is there any way to accomplish this?
Post 06 Jul 2005, 14:35
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 06 Jul 2005, 15:03
something like this?
Code:
macro case var,[val,lbl] {
forward
   if ~lbl eq
        cmp     var,val
        je      lbl
   else
        jmp     val
   end if
}
case eax,15,Found0,20,Found0,30,Found1,35,Found2,NotFound     
Post 06 Jul 2005, 15:03
View user's profile Send private message Visit poster's website Reply with quote
KronosRJ



Joined: 03 Jul 2005
Posts: 15
KronosRJ 07 Jul 2005, 03:34
Thanks a lot!!! I didn't know this would work.
I am currently working in one (of the many) OO macros (with polymorphism and possibly exception handling for win32).
This will help me a lot.
Post 07 Jul 2005, 03:34
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.