NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: mitulshr on July 01, 2015, 12:57:53 AM
-
Hi All,
I have 2 doubts/problem
1) I am writing assembly code to integrate with Visual Studio 13.
Snippet :
mov rax, 0
db 0x49,0x0F,0xC7,0xF8 ;will transfer data to r8 register
jnc .1
mov [rcx], r8
inc rax
ret
.1
ret
I am getting following error:
error: impossible combination of address sizes
If I comment out the statement I am getting following error:
error: instruction not supported in 32-bit mode
I have tried compiling using Command Line line as well as in Visual Studio.
Doubt:2)
I have 2 identical .asm file(copy pasted). One of them is compiling successfully but other one giving error.
What could be the possible reason for this?? Again I have tried both - Visual Studio and Command Line.
Please let me know if you any further information or clarification.
Thanks... :)
-
Hi mitulshr,
I am not familiar with Visual Studio. Nasm does not seem to have a problem with your code, either encoded as bytes or as:
rdseed r8
Is this error supposed to be coming from Nasm?
Your "Doubt:2" does not seem possible. Either the two .asm files are not identical or the compilation processes are not identical. (the randomness isn't supposed to occur until runtime :) )
I'm inclined to think that this is "not a Nasm problem". Sorry I can't help you.
Best,
Frank
-
Hi Frank Kotler,
Thanks for your response.
Doubt: 1)
rdseed is not being recognized by nasm
and I am getting these errors even if try to compile it command line.
I am using "NASM version 2.09.10 compiled on Jul 15 2011"
Edit:
Just found the documentation about rdseed [C.1.17 Version 2.10.02]
But, there was nothing about rdrand!!!
Doubt: 2)
This is the most surprising :o thing I have seen in my coding history. I do believe there must be some thing I am missing
But, I literally copy pasted the code!!!
-
Well "rdseed" is pretty new, I guess. I would expect a string of "db"s to work anyway. As for "doubt 2"... different line endings, maybe? I'm surprised that would cause a problem. What errors are you seeing there?
Best,
Frank
-
Hi Frank,
Doubt 1)
Now, I have downloaded the latest version and rdrand and rdseed instruction is working
But, I am still getting the same errors. But, I tried to compile it with -fwin64 flag, and now its giving me same error for 32 bit instruction
Is it problem that you cannot compile 32bit and 64bit instructions in same .asm file??
Doubt 2)
A restart in Windows did the trick!!!
-
Well you can't use 64-bit instructions in 32-bit code, of course. You can't push/pop 32-bit registers in 64-bit code. There may be other 32-bit instructions that are not allowed... I can't think of any. I'm not very experienced with 64-bit code. What error are you getting?
Best,
Frank