NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: johnd on May 12, 2010, 08:45:18 AM
-
Hello all,
I'm new to NASM, and very new to MacOS, please excuse what is probably a very newbe question.
I'm trying to port some Linux code over to Mac OS X (10.6.3).
nasm -v reports:
"NASM version 0.98.40 (Apple Computer, Inc. build 11) compiled on Oct 1 2009"
There's a snippet of code below, the problem is that every line that includes "xmmword" generates a "error: comma or end of line expected" error. I've googled a fair amount and tried changing "xmmword" to "xmmword ptr" or to "oword ptr" but I get the same errors. The most successfull change was to change "xmmword" to "qword", which I think got me further, but I get a bunch of "mismatch in operand sizes" errors, which are probably correct.
I'd appreciate any help. Thanks,
John.
code snippet follows.
movdqu xmm1,xmmword [ecx+edi*8] ; L = 2 F64 from L1
mulpd xmm1,xmm5 ; L *= R0
movdqu xmmword [esi+edi*8],xmm1 ; X1 = 2 F64 from L
sub edi,2 ; try decrement bnd by 2
jnc F64_MUL10_F64_F64_loop ; if bnd>=0 goto loop
add edi,2 ; else restore bnd...
jmp F64_MUL10_F64_F64_scalar ; ...and finish with scalar routine
-
You were closing in on it, John! I think you want just "oword" there. (Nasm doesn't use "ptr", at all, anywhere) These "?word" size specifiers aren't too well documented, as such. The section on "Pseudo-instructions":
http://www.nasm.us/doc/nasmdoc3.html#section-3.2
Comes about as close as anything, I guess. Doesn't quite say that you can use "byte", "word", "dword", "qword", "tword", "oword", and "yword" as size specifiers... but you can.
I guess if you've got a bunch of code full of "xmmword", you could:
%define xmmword oword
;%idefine ptr ; as nothing... if you need to...
Let us know how it comes out. We need Mac OSX examples!
Best,
Frank
-
Hi Keith,
OK, I needed to remove the xmmword text completely (as your macro would have done).
In addition I needed to remove the "dword" specifier when using the cvtsi2sd instruction so:
cvtsi2sd xmm5, dword [ecx]
becomes:
cvtsi2sd xmm5, [ecx]
It now all assembles fine for 32 bit. I have a different problem with macho64, which I'll post separately.
I'll try to post some cutdown illustrative code when I get a moment and everything is working.
Thanks for your help,
/john
-
Hi Keith,
Perhaps you meant Hi Frank?
-
Eh, "hi" to everybody! Awaiting your problem with macho64, John. That'll be Keith's baliwick!
Best,
Frank