Can you create PROCs with a MACRO? Or is there another way to dynamically create PROCs, I guess creating MACROs with MACROs would work too, but I really doubt that is likely :) Otherwise, I'll have to resort to creating the assembly file with another language. Thanks, bitRAKE
Macros may call other macros (even themselves if need be). Macros may contain code, so yes, you may define a proc in a macro. What are you trying to accomplish? If it runs on a computer, it can be written in MASM.
May I ask why you would want to make proc's from macros? that would make your code very large. cuz macros place the code at each spot the macro is found. using proc's is what saves space. it sounds to me like you might be wanting to make a language? write the macros as keywords???? <--- this is why other languages are so large. programmers that use VB, VC, ect. just don't care or repect other peoples resources. they use it up. you know memory and hard drive space is getting cheaper, but you should use it sparinly. cuz it's not yours to use up, and remember there are other programs running in that machine also. I hope your not thinking of writting a language. tell us alittle about what you are trying to do maybe we can help you to optimize your macros for better performance....
I want to use the MMX registers to do parallel logical operations. Like 64 half-/full-adders in parrallel. bitRAKE
Perhaps he's doing an asm analog of the C++ template class, define one outline on how to perform some activity, and customise it in a macro. The only time I've actually put procs in macros is when I was using an .inc file to hold several macro options, and by picking a macro I could bring in that code. These macros were only called ONCE. Since then I've learned how to build a proper code library.
I understand that code is generated by PROCs, and MACROs make code/data every time they are executed. What I don't understand is how MASM deals with them exactly. Guess I really needed to go back to the manual to go over the details in more detail :) I had assumptions about MASM that were wrong. My answers were in there. And trying out simple pieces of code didn't hurt either :) Another simple example is that you could write a MACRO that would generate the PROCs of a COM interface - a Set/Get type of properties PROCs that are quite common. Thanks, bitRAKE
Well... actually there are three different kinds of macros. The first is a simple TEXTEQU, as in MyName TEXTEQU
Seems simple... MASM replaces the symbol "MyName" with the text "Ernie" as if it was typed there orgionally... so
username BYTE "MyName", 0 ; is quite legal.
The 2nd kind is a text macro. Again, these act as if the substuitute text was typed there:
MyFullName MACRO First:REQ, Last:REQ
FullName TEXTEQU First ; demonstration only,
FullName CATSTR FullName, Last ; this could be done on 1 line
And can be used like so:
MyNameIs BYTE "MyFullName, Ernie, Guess", 0
Which is the same as:
MyNameIs BYTE "ErnieGuess", 0
The most interesting kind of macro can perform loops and do most anything. For example, hutch includes a few helper macros for things like memory to memory transfers (m2m).
m2m MACRO mem1:REQ, mem2:REQ
m2m MyVal1, MyVar2
The point with these is, no matter what is inside the macro, it only gets added where the macro is used. If it makes code, it inlines the code every time the macro name is used, with the sole exception of it it is used inside another macro! Then, it waits silently until the outer macro is used.
Macros are a pure compile time creation. They are first expanded, then the source is compiled.
Nice demonstration ErniePosted on 2001-03-02 06:55:00 by bitRAKE