can anyone tell me how should I compile SSE assembly code?
Posted on 2004-04-02 21:15:11 by archi
You have to specify which assembler you are using. Are you having a problem with the instructions ? In MASM you must specify


[b].XMM[/b] ; <<< Enable SSE instructions
.model flat, stdcall
option casemap :none
Posted on 2004-04-02 21:19:33 by donkey
masm which version?
Posted on 2004-04-02 21:24:10 by archi
btw donkey, does .XMM automatically add .MMX, or rather "set XMM/MMX level"? I think someone had problems with SSE code because he had .XMM first, followed by .MMX, but I could remember wrong.
Posted on 2004-04-02 21:25:13 by f0dder
Thanks f0dder,

Wasn't aware of that, all opcodes are intrinsically available in GoAsm so there are no directives.

masm which version?

Version 7 or above I believe, haven't used MASM for a while.
Posted on 2004-04-02 21:26:39 by donkey
Me too. I have only masm6. Where can i get masm7?
A link would be great.
Posted on 2004-04-02 21:29:01 by archi
I don't know if there's a way to get it for free, legally. It's included with later versions of visual studio.
Posted on 2004-04-02 21:34:39 by f0dder
Will nasm compile this, then?
Or are there other free asm compilers which "understand" xmm instructions?
Posted on 2004-04-02 21:40:33 by archi
GoAsm is very close to MASM in syntax and will compile SSE and SSE2 instructions as well as branch hints for the P4 processor. Also I think that there was an instruction or two in MASM that was not available in SSE because of reserved symbol problems, this is not the case in GoAsm.

Not for the light of heart, there are none of the normal high level constructs like .IF or .WHILE etc... You have to actually code for real ;)

It does have some better features like Unicode and pushed strings etc....

invoke lstrlen, "Hello"

UString DUS "Unicode string",0

It comes with it's own linker, resource compiler and debugger and can be used with RadASM, I have includes for it on my site. If you have MASM modules that you do not wish to translate you can compile them as a static lib and import them directly into a GoAsm program.

You can find examples of GoAsm programs on my website.
Posted on 2004-04-02 21:43:46 by donkey
Great thanks.
Posted on 2004-04-02 21:48:59 by archi
If you want to work with the MASM, you can get it form the
There you can get the MASM32 version 8, and it's free. And it works fine with RadASM.
Posted on 2004-04-03 03:37:38 by bszente
masm32v8 includes an old masm version. Besides, be sure to read the license and see in which ways it restricts your software development.
Posted on 2004-04-03 03:41:17 by f0dder
You're right f0dder. Sorry for the incorrect advice. I did not saw that the assembler is not updated.

So which is the best assembler to work with? What do you recommend for us? Will be the GoAsm package supported well?

Thanks for your advice.
Posted on 2004-04-03 03:55:45 by bszente
The version included with masm32v8 (6.15.8803) does handle SSE, the catch is you must write the XMMx register names in uppercase. - XMM0 is valid, xmm0 isn't. There are still the license issues, though.

There's plenty of (free) assemblers out there, I think the two most interesting ones are fasm and GoAsm.
Posted on 2004-04-03 04:10:18 by f0dder
I used the MASM32 package, because it seemed easy to use for me.
I will try GoAsm and fasm too, I saw that there is a plenty of good coding hints on the GoAsm site.

I think masm32v8 has an include file for handling the SSE instructions, but i'm not sure. That's why the uppercase limitations.
Posted on 2004-04-03 04:22:45 by bszente
Nah, masm handles it natively, at least the 6.15 version. If you look at ml.exe in a hex editor, you will see the registers and instructions.

Masm is probably a good place to start, it's the assembler that most people around here use, and the one with most sample code etc. And as long as you're not doing commercial applications with it, there shouldn't be any problems.
Posted on 2004-04-03 05:03:13 by f0dder
I found the XMM registers in the "ml.exe".
I have only the 6.14.8444 version, but it contains the XMM extension.

Posted on 2004-04-03 05:21:35 by bszente
Look for ml7. It has more support for SSE2 if I am not wrong.
Posted on 2004-04-03 06:02:47 by roticv
Dear Donkey,
GoASM can do unicode very good
I think MASM can do Unicode very good too.
By using macro it can handle almost unicode char.
I see many of macros from this board

-Ernest Murphy

But any way if don't use macro we can do a little urly code:

;Urly Unicode sample

.model flat, stdcall
option casemap:none

include \masm32\include\
include \masm32\include\
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

MessageBoxW proto :DWORD, :DWORD, :DWORD, :DWORD


szText dw 'H','e','l','l','o',' ','U','n','i','c','o','d','e',0
szAppName dw 'T','e','s','t',' ','U','n','i','c','o','d','e',0



invoke MessageBoxW, 0, OFFSET szText, OFFSET szAppName, MB_OK
invoke ExitProcess, NULL

end start
Posted on 2004-04-04 04:15:46 by nhnpresario
That's not a very pretty way to do unicode ^_^. Iirc, the macros for masm have some problems with max string length, because of som silly masm line-length limitations.
Posted on 2004-04-04 04:24:11 by f0dder