In MASM manuals I can see that subj is possible
(I assume it should work as exitm %value in regard of
usage the retvalue generated by macro)
yet I failed to make any use of it.
ml doens't mind if I write something like
endm %statement
yet I can not use the return from it in any expression.
Could someone help me out and show if
it's possible to use such a construction in an example?
(I assume it should work as exitm %value in regard of
usage the retvalue generated by macro)
yet I failed to make any use of it.
ml doens't mind if I write something like
endm %statement
yet I can not use the return from it in any expression.
Could someone help me out and show if
it's possible to use such a construction in an example?
Are you shure? I couldn't find such syntax in masm docs. Only endm without param.
Yes, here is qoute:
name MACRO []]]...
statements
ENDM []
name MACRO []]]...
statements
ENDM []
I see. I'm sure it's erratum.
The why ml doesn't inform me of the error
when I type something after endm?
somemac macro par1
echo par1
endm par1
Echo works OK, so the macro works and no error about
about endm par1?
when I type something after endm?
somemac macro par1
echo par1
endm par1
Echo works OK, so the macro works and no error about
about endm par1?
I use ml.exe 6.15.8803 and the doc was supplied with it.
Might be it can help somehow?
Might be it can help somehow?
It appears MASM ignores everything after the ENDM until the end of line. Same as the multi-line COMMENT directive:
COMMENT ~
~ MASM ignores this text until the end of the line...
I wouldn't be surprised to find similar "holes" in the syntax. In the case of ENDM [] the manual is in error. Similarly, MASM ignores line of text after EXITM:MyMACRO MACRO
EXITM
maybe type some documentation here?
ENDM
MASM is funny like this. :)Yes it's funny :)
Last two things I noticed was:
1. It doesn't differ base and index in pointer and
always codes and with as base.
That's 1 byte longer compare with case when ebp placed in index field.
Solution is to write DS: in the case it places reg code for ebp in index field of SIB wich results in 1 byte shorter instruction.
But the method doesn't work with lea - no matter whether you wrote lea eax, or lea eax,DS: - masm always places code for ebp in base field and makes it 1 byte longer.
It forced to write macro wich places code for ebp in index field with lea.
2. $ operator returns invalid counter when reffers to labels inside code used "invoke" "proc" etc.
Last two things I noticed was:
1. It doesn't differ base and index in pointer and
always codes and with as base.
That's 1 byte longer compare with case when ebp placed in index field.
Solution is to write DS: in the case it places reg code for ebp in index field of SIB wich results in 1 byte shorter instruction.
But the method doesn't work with lea - no matter whether you wrote lea eax, or lea eax,DS: - masm always places code for ebp in base field and makes it 1 byte longer.
It forced to write macro wich places code for ebp in index field with lea.
2. $ operator returns invalid counter when reffers to labels inside code used "invoke" "proc" etc.
The Svin,
You won't get very far with ENDM <var> . Try EXITM <var> instead. You are defining a MACRO FUNCTION instead of a plain MACRO. See example in ZIP file. Ratch
You won't get very far with ENDM <var> . Try EXITM <var> instead. You are defining a MACRO FUNCTION instead of a plain MACRO. See example in ZIP file. Ratch
The Svin,
Could you post an example of the correct code and the incorrect code so I can understand what the problem is? Thanks, Ratch
Last two things I noticed was:
1. It doesn't differ base and index in pointer and
always codes and with as base.
That's 1 byte longer compare with case when ebp placed in index field.
1. It doesn't differ base and index in pointer and
always codes and with as base.
That's 1 byte longer compare with case when ebp placed in index field.
Could you post an example of the correct code and the incorrect code so I can understand what the problem is? Thanks, Ratch
The Svin,
OK, now I understand what you are saying. Easy solution. Always code the index with 1*REG. This tells MASM explicitly what the index register is. Ratch.
OK, now I understand what you are saying. Easy solution. Always code the index with 1*REG. This tells MASM explicitly what the index register is. Ratch.
00000000 8D 44 0D 00 LEA EAX,[ECX+EBP]
00000004 8D 04 29 LEA EAX,[EBP+ECX]
00000007 8D 04 29 LEA EAX,[ECX+1*EBP]
0000000A 8D 44 0D 00 LEA EAX,[EBP+1*ECX]
0000000E 8D 04 69 LEA EAX,[ECX+2*EBP]
00000011 8D 44 4D 00 LEA EAX,[EBP+2*ECX]
00000015 8D 04 69 LEA EAX,[2*EBP+ECX]
00000018 8D 44 4D 00 LEA EAX,[2*ECX+EBP]
Thanks. That's easier than using macro.
The Svin,
You won't get very far with ENDM <var> . Try EXITM <var> instead. You are defining a MACRO FUNCTION instead of a plain MACRO. See example in ZIP file. Ratch
I know about EXITM and heavily use it.
Orignal question was about MASM docs where incorrectly stated that the same method can be used with ENDM <value>