flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > match for many arg. How do ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 20 Sep 2024, 07:17
Fasmw 1.73
Code:
macro mA a,b,c { add a,b
 sub a,c }

macro mB a,b,c { add [a],c
 sub [b],c }

macro mC a,b { sub a,b }

macro mdo [args] { match \{ \} }

;in code
mdo [mA,mB,mC],[1,2,3],\ ;params for mA
       [p1,p2,4],\       ;params for mB
       [2,2]             ;params for mC

    
Post 20 Sep 2024, 07:17
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 20 Sep 2024, 08:09
Second variant not work.
Code:
macro mDo m,p  {  match d , p \{ m edx,d \}  ;fasm error invalid macro arguments
}

macro mA a,b  { add a,b }


Start:  eqmA equ eax,11,ebx
        mDo mA,eqmA
    
Post 20 Sep 2024, 08:09
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1042
Location: Russia
macomics 20 Sep 2024, 09:10
Use <> brackets
Post 20 Sep 2024, 09:10
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 20 Sep 2024, 10:01
Right ?
eqmA equ <eax>,<11>,<ebx>
Fasm error again.

Code:
macro mDo m,p  {  match d , p \{ m edx,d \}  ;fasm error invalid macro arguments
}

macro mA a,b  { add a,b }


Start:  eqmA equ <eax>,<11>,<ebx>
        mDo mA,eqmA
    
Post 20 Sep 2024, 10:01
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 20 Sep 2024, 10:29
I do this but not understood why not work ?!
Code:
macro mA a,b  { add a,b }

macro mDo m,p  {
      match o , p \{ irps v, o \\{ ;display m
            zEqq equ v
      \\}
     irpv ii,zEqq \{ m edx,ii ;this fasm error invalid macro arguments
          display ii  ;ii=eax
     \}
     \} }    

;in code
eqmA equ eax,ecx,ebx
        mDo mA,eqmA
    
Post 20 Sep 2024, 10:29
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 20 Sep 2024, 11:21
I do this. Work.
Code:
macro mA a,b  { add a,b }

macro mDo m,p,val  {  irpv v,p \{ irps n,v \\{ m n,val \\}  \}   }
;in code
     eqmA equ eax ebx ecx ebx        
     mDo mA,eqmA,11 
    
Post 20 Sep 2024, 11:21
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.