News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Why don't move?

Started by alex-rudenkiy, July 02, 2017, 11:01:39 PM

Previous topic - Next topic

alex-rudenkiy

Why does an error occur when I want to move the number to xmm?

prog2.asm(14) : error A2085: instruction or register not accepted in current CPU mode
prog2.asm(15) : error A2085: instruction or register not accepted in current CPU mode


.686
.mmx
.xmm

option casemap:none

include \masm32\include\masm32rt.inc
include \masm32\macros\macros.asm
includelib \masm32\lib\kernel32.lib
include \masm32\include\kernel32.inc

.code
start:
movq xmm0, 9876543210
                movq xmm1, xmm0
end start
end main

felipe

PHUK! It looks than this question has a simple answer, but i still haven't study this kind of instructions.   :bgrin:

Be patience. Wait for other replies.  :t

And yes, that's the best way of show your code.  ;)

JoeBr

See http://x86.renejeschke.de/html/file_module_x86_id_201.html - the source operand needs to be either a memory reference/variable or another xmm register.

Which Assembler are you using?  MASM/UASM/FASM...?

Instead, you might use something like....

      .data
      qSrc dq   9876543210
      .code
      movq xmm0, qSrc
      movq xmm1, xmm0

(IF you're assembling 64-bit - 32 bit wouldn't work with the above as the constant loaded into qSrc is beyond a 32-bit value)

Joe

alex-rudenkiy

masm32. Damn, it did not work, the same error :(

Quote from: JoeBr on July 03, 2017, 02:48:32 AM
See http://x86.renejeschke.de/html/file_module_x86_id_201.html - the source operand needs to be either a memory reference/variable or another xmm register.

Which Assembler are you using?  MASM/UASM/FASM...?

Instead, you might use something like....

      .data
      qSrc dq   9876543210
      .code
      movq xmm0, qSrc
      movq xmm1, xmm0

(IF you're assembling 64-bit - 32 bit wouldn't work with the above as the constant loaded into qSrc is beyond a 32-bit value)

Joe

jj2007

The order of the directives is important.

include \masm32\include\masm32rt.inc
.686p
.xmm

.code
myq dq 9876543210
start:
  movq xmm0, myq
  movaps xmm1, xmm0
  exit
end start

JoeBr

Sorry, noob I am - I didn't note the directives order - JJ's code should work perfectly.   And you CAN use the (above-32-bit) value you note in the beginning, I believe it ties to the directives.  JJ - thanks!

Joe

alex-rudenkiy

Quote from: jj2007 on July 03, 2017, 05:22:08 PM
The order of the directives is important.

include \masm32\include\masm32rt.inc
.686p
.xmm

.code
myq dq 9876543210
start:
  movq xmm0, myq
  movaps xmm1, xmm0
  exit
end start


Thank you :t