flat assembler
Message board for the users of flat assembler.

Index > Main > Problem with EQU and Call.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1618
Roman 08 Aug 2018, 05:44
I have macro.
Code:
macro Data chName,chNamz,FileName {local lp1,lp2
chNamz EQU P_OpenTextFiles_#chName ;#_OpenFile
                jmp lp2
           P_OpenTextFiles_#chName: 
 lp1    dd 0,0,0,0
           P_OpenTextFiles_#chName#_OpenFile:
              mov ebx,lp1
              mov [ebx],FileName
              Call  DoSomeProc
 lp2:             
             }
                  
    


When i do work ok:
Code:
Data Md1,up1,'text.txt'    


But Fasm get me error when i do:
Code:
Call up1+_OpenFile
Call up1#_OpenFile  ;or this variant
    



How fix this problem ?


But this work ok:
Code:
Call P_OpenTextFiles_Md1_OpenFile    
Post 08 Aug 2018, 05:44
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8268
Location: Kraków, Poland
Tomasz Grysztar 08 Aug 2018, 08:43
You have to extract the value of EQU-defined variable with MATCH:
Code:
match p, up1
{
  Call p#_OpenFile
}    
Post 08 Aug 2018, 08:43
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1618
Roman 08 Aug 2018, 08:55
Thanks.
It is sad.

Easy do in macro:
chNamz#_OpenFile EQU P_OpenTextFiles_#chName#_OpenFile

And use in code:
Call up1_OpenFile
Post 08 Aug 2018, 08:55
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.