I'm learning how to use it, but I get stuck on very basic things.
For instance, if I try to assemble the following code:
.686
.XMM
.MODEL FLAT, STDCALL
.LISTALL
.DATA?
xmmwrd XMMWORD ?
.CODE
xmmwrdproc PROC arg1:XMMWORD
ret
xmmwrdproc ENDP
Start:
invoke xmmwrdproc, [xmmwrd]
invoke xmmwrdproc, xmm0
invoke xmmwrdproc, eax
invoke xmmwrdproc, 100h
END Start
I get errors on each INVOKE:
.686
.XMM
.MODEL FLAT, STDCALL
.LISTALL
00000000 .DATA?
00000000 xmmwrd XMMWORD ?
00000000000000000000000000000000
00000000 .CODE
00000000 xmmwrdproc PROC arg1:XMMWORD
00000000 55 * push ebp
00000001 8B EC * mov ebp, esp
ret
00000003 C9 * leave
00000004 C2 0010 * ret 00010h
00000007 xmmwrdproc ENDP
00000007 Start:
invoke xmmwrdproc, [xmmwrd]
xmmword.asm(17) : error A2114: INVOKE argument type mismatch : argument : 1
00000007 E8 FFFFFFF4 * call xmmwrdproc
invoke xmmwrdproc, xmm0
xmmword.asm(19) : error A2033: invalid INVOKE argument : 1
xmmword.asm(19) : error A2114: INVOKE argument type mismatch : argument : 1
0000000C E8 FFFFFFEF * call xmmwrdproc
invoke xmmwrdproc, eax
xmmword.asm(21) : error A2114: INVOKE argument type mismatch : argument : 1
00000011 E8 FFFFFFEA * call xmmwrdproc
invoke xmmwrdproc, 100h
xmmword.asm(23) : error A2114: INVOKE argument type mismatch : argument : 1
00000016 E8 FFFFFFE5 * call xmmwrdproc
END Start
I really have no clue how to get it working :(
The only thing I can see from the listing is that XMMWORD parameter really occupies 16 bytes on the stack (ret 00010h).
(I use ML 8.00.50727.42 from VS2005)
May be you should start thinking of using pointers instead? Or push'em all (DWORDs) with your own hands...
Hi asmfan,
I know I can use pointers. I just want to know my tools. If MASM allows me to define an argument as XMMWORD, I'd like to know how can I pass something to this argument.
Oh, those pseudo hi-level invokes... disaster. Masm has nothing to do with the real capabilities of a CPU. There's no opcode to push more than a DWORD at a time (in 32 bit mode of course:).
I think the easiest way is
sub esp, 10h
movdqa xmm0, xmmwrd
movdqu [esp], xmm0
call xmmwrdproc
I know there is no such opcode, but INVOKE can usually handle these cases, for instance REAL10 as a parameter (compiles fine also with ML 6.14):
.686
.MODEL FLAT, STDCALL
.DATA?
real10var REAL10 ?
.CODE
real10proc PROC arg1:REAL10
real10proc ENDP
Start:
invoke real10proc, real10var
END Start
Hello,
I use ml 8.0 and he don't know the XMMWORD typedef.
The SDK don't know it,where it is defined ?
ToutEnMasm
ToutEnMasm, do you use the latest version, 8.00.50727.42? IIRC the SDK still contains some older version. Mine comes from VS2005.
I use the 8.00.50727.104 coming from http://www.microsoft.com/downloads/details.aspx?FamilyId=7A1C9DA0-0510-44A2-B042-7EF370530C64&displaylang=en
This free versions don't seems to know the standard macros and typedefs include in the masm Help.
ToutEnMasm
ToutEnMasm, it is really weird. Since I use VS2005 professional, I can't help you.
I decided to report my original problem as a bug:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=181923
Please vote for it and validate it. It helps to accelerate the fixing process.
The answer is here
http://msdn2.microsoft.com/en-us/library/cw0399sf.aspx
using the include files of the SDK with declared typedef is the anwer (follow __m128 link)
ToutEnMasm
Note:The sample on the link works also with the free ml.
It doesn't work in my case neither:
Code:
.686
.XMM
.MODEL FLAT, STDCALL
.DATA?
testvar XMMWORD ?
.CODE
testproc PROC arg1:XMMWORD
ret
testproc ENDP
Start:
invoke testproc, xmmword ptr testvar
invoke testproc, xmmword ptr [testvar]
END Start
Listing:
.XMM
.MODEL FLAT, STDCALL
00000000 .DATA?
00000000 testvar XMMWORD ?
00000000000000000000000000000000
00000000 .CODE
00000000 testproc PROC arg1:XMMWORD
ret
00000007 testproc ENDP
00000007 Start:
invoke testproc, xmmword ptr testvar
xmmword.asm(15) : error A2114: INVOKE argument type mismatch : argument : 1
invoke testproc, xmmword ptr [testvar]
xmmword.asm(16) : error A2114: INVOKE argument type mismatch : argument : 1
END Start
MazeGen,
poasm can handle this! Pelle will actually listen to you (if you find bugs), what you cant say about masm support.
i strongly suggest you consider poasm...
all i know that masm works ok with qwords (but not immediate qwords)
.DATA?
q1 QWORD ?
.CODE
testproc PROC arg1:qword,arg2:qword,arg3:qword
ret
testproc ENDP
start:
invoke testproc, q1,edx::eax,ebx::ecx
Hi drizz,
in fact, I have started this topic because I code macros to support FASTCALL calling convention in ML64 and I need to know first how ML (32-bit) handles XMMWORD type.
As for PoAsm, I already code many macros, which I use in my projects, some of them quite complicated, and I don't believe they would work with PoAsm without modifications. I already stick to MASM so closely that I don't want to move to another (kind of incompatible) assembler. Beside this, I take some exceptions to PoAsm's development, but these are not the matter under discussion.
Hello,
Searching for translating the size of the __m128 typedef size ,P1 provided me with this link
http://www.masm32.com/board/index.php?topic=4808.0
The posts give this another one.
http://www.intel.com/cd/ids/developer/asmo-na/eng/167741.htm?prn=Y
Perhaps it is not usefull with ml 8
ToutEnMasm.
Thanks ToutEnMasm,
but it doesn't seem to help me. Since I code the FASTCALL macros for ML64, I'd need to know how to pass something to function's XMMWORD parameter using INVOKE with 32-bit ML. I hope somebody from Microsoft tells us how it should work.
the worst workaround would be to recode INVOKE
;if @Version LE 800
option nokeyword:<invoke>
invoke macro
endm
;endif
but i leave it up to you...