flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > need some help.

Author
Thread Post new topic Reply to topic
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
has code:
Code:
...
ecx = bl*bl*100
...
    

part of macros:
Code:
...
match =0 ==src*src2*src3,status param 
\\{

\\}
...
    

how can I know where src | src2 | src3 is immediate value and where a register? I made this macros for registers and know try to make for immediate values and registers, but don't know how to solve this problem.
Post 21 Feb 2006, 23:13
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
In assembly time with "if macroArgument eqtype eax" is enought to check if the argument is a register, and if you need to check if it is an inmediate with "if macroArgument eqtype 1" you get it.

I don't know how to do the same in preprocesing time, maybe you should post more code in order to help you more.

Quote:
has code:

Code:

...
ecx = bl*bl*100
...
That's works for you??
Post 22 Feb 2006, 02:21
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
locodelassembly
I learn how to write macros,and some time ago I have done the macros to mul two registers. Yesterday I try to make macros to multiply registers and immediate values. In macros I match the argument, like I post ago. But I don't know how to get type of src,src2,src3.

And also question: if I write:
"ebx = bl*10*bl*10" then when I will match I will have four arguments or three?
Code:
match =0 ==src*src2*src3,status param  
\\{ 

\\}    
or I must write:
Code:
match =0 ==src*src2*src3*src4,status param  
\\{ 

\\}    
Quote:
I don't know how to do the same in preprocesing time, maybe you should post more code in order to help you more.

I will post macros at night if the problem will not be solved.
Post 22 Feb 2006, 07:53
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Code:
macro displayType param{
  if param eqtype eax
    display "(register)"
  else if param eqtype 1
    display "(inmediate)"
  else
    display "(unsupported type)"
  end if
  display 13, 10
}


macro macroName status, param{
  match =0 dest==src*src2*src3*src4, status param
  \{
     display "destination = ", \`dest
     if ~dest eqtype eax
       display "(WARNING: destination is not a register!!)"
     end if
     display 13, 10, "-------------", 13, 10

     display "source  = ", \`src
     displayType src
     display "source2 = ", \`src2
     displayType src2
     display "source3 = ", \`src3
     displayType src3
     display "source4 = ", \`src4
     displayType src4

  \}
}

macroName 0, ebx = 5 * eax * .label * edx

.label: ; Note that labels will be treated as inmediates too but normally that will not be a problem for you    


The code above answers your question?

About "ecx = bl*bl*100" note that if you put only that in a line you will get an error but if that expression is a macro argument (like the code above) then there is no error.
Post 22 Feb 2006, 13:13
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
Great Thanks! It is work! Thank you all. Good bye.
Post 22 Feb 2006, 13:38
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.