Movd to movq not working

  • Follow


I am trying to fix a program that compiles and runs fine when I used
Masm 6.14 on a 32 bit machine using Win XP Pro.

I am now using Masm 8.0 and am getting "invalid instruction operands"
with the line below.

If this is changed to movq [edi+eax], MM0, I no longer get an error
message, but the code doesn't work right. The video mode is changed to
a lower resolution ??

Can anyone help me find out what is wrong?

Thanks.

   movd [edi+eax], MM0         ; If this is changed to movq [edi+eax],
MM0 , then
                                               ; Masm 8.0 no longer
complains, but the video
                                               ; mode is changed to a
lower resolution ??
    movd [edi+eax+8],MM1      ;

0
Reply WhiteTea77581 7/23/2009 12:47:55 AM

On 23 Jul 2009 00:47:55 GMT, WhiteTea77581
<andrewkennedy3@MUNGED.microcosmotalk.com> wrote:

>
>I am trying to fix a program that compiles and runs fine when I used
>Masm 6.14 on a 32 bit machine using Win XP Pro.
>
>I am now using Masm 8.0 and am getting "invalid instruction operands"
>with the line below.
>
>If this is changed to movq [edi+eax], MM0, I no longer get an error
>message, but the code doesn't work right. The video mode is changed to
>a lower resolution ??
>
>Can anyone help me find out what is wrong?
>
>Thanks.
>
>   movd [edi+eax], MM0         ; If this is changed to movq [edi+eax],
>MM0 , then
>                                               ; Masm 8.0 no longer
>complains, but the video
>                                               ; mode is changed to a
>lower resolution ??
>    movd [edi+eax+8],MM1      ;

00000000  67& 0F 7E 04 38         movd [edi+eax], MM(0)
00000005  67& 0F 7E 4C            movd [edi+eax+8],MM(1)
          38 08

0000000B  67& 0F 7F 04 38         movq [edi+eax], MM(0)
00000010  67& 0F 7F 4C            movq [edi+eax+8],MM(1)
          38 08

Both seem to work for me.  What version of Masm 8 do you have?
-- 
ArarghMail907 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the extra stuff from the reply address.
0
Reply ArarghMail907NOSPAM 7/23/2009 5:12:04 AM


On Jul 22, 5:47=A0pm, WhiteTea77581
<andrewkenne...@MUNGED.microcosmotalk.com> wrote:
> I am trying to fix a program that compiles and runs fine when I used
> Masm 6.14 on a 32 bit machine using Win XP Pro.
>
> I am now using Masm 8.0 and am getting "invalid instruction operands"
> with the line below.
>
> If this is changed to movq [edi+eax], MM0, I no longer get an error
> message, but the code doesn't work right. The video mode is changed to
> a lower resolution ??
>
> Can anyone help me find out what is wrong?
>
> Thanks.
>
> =A0 =A0movd [edi+eax], MM0 =A0 =A0 =A0 =A0 ; If this is changed to movq [=
edi+eax], MM0 , then
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0; Masm 8.0 no longer complains, but the video
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0; mode is changed to a lower resolution ??
> =A0 =A0 movd [edi+eax+8],MM1 =A0 =A0 =A0;

See here:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedba=
ckID=3D100019

Also check your processor documentation:

MOVD Move Doubleword or Quadword

Moves a 32-bit or 64-bit value in one of the following ways:
- from a 32-bit or 64-bit general-purpose register or memory location
to the low order 32 or 64 bits of an XMM register, with zero-extension
to 128 bits
- from the low-order 32 or 64 bits of an XMM to a 32-bit or 64-bit
general-purpose register or memory location
- from a 32-bit or 64-bit general-purpose register or memory location
to the low order 32 bits (with zero-extension to 64 bits) or the full
64 bits of an MMX register
- from the low-order 32 or the full 64 bits of an MMX register to a 32-
bit or 64-bit general-purpose register or memory location

Mnemonic Opcode Description
MOVD xmm, reg/mem32 66 0F 6E /r Move 32-bit value from a general-
purpose register or 32-bitmemory location to an XMM register.
MOVD xmm, reg/mem64 66 0F 6E /r Move 64-bit value from a general-
purpose register or 64-bitmemory location to an XMM register.
....

How would the assembler know if [edi+eax] is a doubleword or a
quadword? Add dword ptr or qword ptr before that, whichever is
appropriate for your code.

MOVQ, OTOH, always operates on quadwords (if you look at the doc) and
therefore there's no confusion for the assembler as to what size the
memory operand is.

Alex
0
Reply Alexei 7/23/2009 3:06:28 PM

On Jul 23, 12:12=A0am, ArarghMail907NOS...@NOT.AT.Arargh.com wrote:
> On 23 Jul 2009 00:47:55 GMT, WhiteTea77581
>
>
>
> <andrewkenne...@MUNGED.microcosmotalk.com> wrote:
>
> >I am trying to fix a program that compiles and runs fine when I used
> >Masm 6.14 on a 32 bit machine using Win XP Pro.
>
> >I am now using Masm 8.0 and am getting "invalid instruction operands"
> >with the line below.
>
> >If this is changed to movq [edi+eax], MM0, I no longer get an error
> >message, but the code doesn't work right. The video mode is changed to
> >a lower resolution ??
>
> >Can anyone help me find out what is wrong?
>
> >Thanks.
>
> > =A0 movd [edi+eax], MM0 =A0 =A0 =A0 =A0 ; If this is changed to movq [e=
di+eax],
> >MM0 , then
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 ; Masm 8.0 no longer
> >complains, but the video
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 ; mode is changed to a
> >lower resolution ??
> > =A0 =A0movd [edi+eax+8],MM1 =A0 =A0 =A0;
>
> 00000000 =A067& 0F 7E 04 38 =A0 =A0 =A0 =A0 movd [edi+eax], MM(0)
> 00000005 =A067& 0F 7E 4C =A0 =A0 =A0 =A0 =A0 =A0movd [edi+eax+8],MM(1)
> =A0 =A0 =A0 =A0 =A0 38 08
>
> 0000000B =A067& 0F 7F 04 38 =A0 =A0 =A0 =A0 movq [edi+eax], MM(0)
> 00000010 =A067& 0F 7F 4C =A0 =A0 =A0 =A0 =A0 =A0movq [edi+eax+8],MM(1)
> =A0 =A0 =A0 =A0 =A0 38 08
>
> Both seem to work for me. =A0What version of Masm 8 do you have?
> --
> ArarghMail907 at [drop the 'http://www.'from ->]http://www.arargh.com
> BCET Basic Compiler Page:http://www.arargh.com/basic/index.html
>
> To reply by email, remove the extra stuff from the reply address.

Thanks.

I have Version 8.0.50727.104.
0
Reply WhiteTea77581 7/23/2009 3:07:05 PM

On 23 Jul 2009 15:07:05 GMT, WhiteTea77581
<andrewkennedy3@MUNGED.microcosmotalk.com> wrote:
<snip>
>I have Version 8.0.50727.104.

Mine is:
Microsoft (R) Macro Assembler (x86-64) Version 8.00.2207
I don't remember where I got it.

Maybe Microsoft 'fixed' something.  Again.  :-)

-- 
ArarghMail907 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the extra stuff from the reply address.
0
Reply ArarghMail907NOSPAM 7/23/2009 7:11:57 PM

On Jul 23, 10:06=A0am, "Alexei A. Frounze"
<alexfrun...@MUNGED.microcosmotalk.com> wrote:
> On Jul 22, 5:47=3DA0pm, WhiteTea77581
>
> <andrewkenne...@MUNGED.microcosmotalk.com> wrote:
> > I am trying to fix a program that compiles and runs fine when I used
> > Masm 6.14 on a 32 bit machine using Win XP Pro.
>
> > I am now using Masm 8.0 and am getting "invalid instruction operands"
> > with the line below.
>
> > If this is changed to movq [edi+eax], MM0, I no longer get an error
> > message, but the code doesn't work right. The video mode is changed to
> > a lower resolution ??
>
> > Can anyone help me find out what is wrong?
>
> > Thanks.
>
> > =3DA0 =3DA0movd [edi+eax], MM0 =3DA0 =3DA0 =3DA0 =3DA0 ; If this is cha=
nged to movq [=3D
>
> edi+eax], MM0 , then> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D=
A0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D
>
> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0; Masm 8.0 no longer complains, but th=
e video> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =
=3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D
>
> =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0; mode is changed to a lower resolutio=
n ??
>
> > =3DA0 =3DA0 movd [edi+eax+8],MM1 =3DA0 =3DA0 =3DA0;
>
> See here:http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.=
aspx?...
> ckID=3D3D100019
>
> Also check your processor documentation:
>
> MOVD Move Doubleword or Quadword
>
> Moves a 32-bit or 64-bit value in one of the following ways:
> - from a 32-bit or 64-bit general-purpose register or memory location
> to the low order 32 or 64 bits of an XMM register, with zero-extension
> to 128 bits
> - from the low-order 32 or 64 bits of an XMM to a 32-bit or 64-bit
> general-purpose register or memory location
> - from a 32-bit or 64-bit general-purpose register or memory location
> to the low order 32 bits (with zero-extension to 64 bits) or the full
> 64 bits of an MMX register
> - from the low-order 32 or the full 64 bits of an MMX register to a 32-
> bit or 64-bit general-purpose register or memory location
>
> Mnemonic Opcode Description
> MOVD xmm, reg/mem32 66 0F 6E /r Move 32-bit value from a general-
> purpose register or 32-bitmemory location to an XMM register.
> MOVD xmm, reg/mem64 66 0F 6E /r Move 64-bit value from a general-
> purpose register or 64-bitmemory location to an XMM register.
> ...
>
> How would the assembler know if [edi+eax] is a doubleword or a
> quadword? Add dword ptr or qword ptr before that, whichever is
> appropriate for your code.
>
> MOVQ, OTOH, always operates on quadwords (if you look at the doc) and
> therefore there's no confusion for the assembler as to what size the
> memory operand is.
>
> Alex

Thanks Alex.

Putting dword ptr fixed the code to assemble correctly.

Masm 8.0 required a stricter syntax that Masm 6.14.

Take care,
           Andy
0
Reply WhiteTea77581 7/24/2009 8:05:15 PM

On Jul 23, 2:11=A0pm, ArarghMail907NOS...@NOT.AT.Arargh.com wrote:
> On 23 Jul 2009 15:07:05 GMT, WhiteTea77581<andrewkenne...@MUNGED.microcos=
motalk.com> wrote:
>
> <snip>
>
> >I have Version 8.0.50727.104.
>
> Mine is:
> Microsoft (R) Macro Assembler (x86-64) Version 8.00.2207
> I don't remember where I got it.
>
> Maybe Microsoft 'fixed' something. =A0Again. =A0:-)

Up until recently, I never had any problems with Masm until I did some
programming on a Vista system with a 64-bit processor using source
code that worked perfect up to XP on a 32-bit system.

I ran a program that used standard Win API's and Vista said that the
program was broke??

The "learning curve" for Vista 64-bit it is much steeper that when I
went from
Win 98 to XP.

It took me a while to figure out that Vista's "Administrator Account"
is different from that on an XP Pro.

After some extensive searching and registry modifications, "eye" got
to the point where I had a true Admin account.

From what I have read, Masm 7.10 is the best version.

I went to Microsoft's site, but they don't offer it in any current
package.
I would like to use it.

Take care,
           Andy


0
Reply WhiteTea77581 7/24/2009 8:05:58 PM

On Jul 24, 1:05=A0pm, WhiteTea77581
<andrewkenne...@MUNGED.microcosmotalk.com> wrote:
> On Jul 23, 10:06=3DA0am, "Alexei A. Frounze"
....
> > How would the assembler know if [edi+eax] is a doubleword or a
> > quadword? Add dword ptr or qword ptr before that, whichever is
> > appropriate for your code.
>
> > MOVQ, OTOH, always operates on quadwords (if you look at the doc) and
> > therefore there's no confusion for the assembler as to what size the
> > memory operand is.
>
> > Alex
>
> Thanks Alex.
>
> Putting dword ptr fixed the code to assemble correctly.
>
> Masm 8.0 required a stricter syntax that Masm 6.14.
>
> Take care,
> =A0 =A0 =A0 =A0 =A0 =A0Andy

I don't think MASM 6.14 generated 64-bit code and that's why it had no
problems with your code. If it did generate 64-bit code, then two bugs
collided.

Alex
0
Reply Alexei 7/24/2009 10:33:11 PM

On 24 Jul 2009 20:05:58 GMT, WhiteTea77581
<andrewkennedy3@MUNGED.microcosmotalk.com> wrote:

>
>On Jul 23, 2:11=A0pm, ArarghMail907NOS...@NOT.AT.Arargh.com wrote:
>> On 23 Jul 2009 15:07:05 GMT, WhiteTea77581<andrewkenne...@MUNGED.microcos=
>motalk.com> wrote:
>>
>> <snip>
>>
>> >I have Version 8.0.50727.104.
>>
>> Mine is:
>> Microsoft (R) Macro Assembler (x86-64) Version 8.00.2207
>> I don't remember where I got it.
>>
>> Maybe Microsoft 'fixed' something. =A0Again. =A0:-)
>
>Up until recently, I never had any problems with Masm until I did some
>programming on a Vista system with a 64-bit processor using source
>code that worked perfect up to XP on a 32-bit system.
>
>I ran a program that used standard Win API's and Vista said that the
>program was broke??
>
>The "learning curve" for Vista 64-bit it is much steeper that when I
>went from
>Win 98 to XP.
>
>It took me a while to figure out that Vista's "Administrator Account"
>is different from that on an XP Pro.
>
>After some extensive searching and registry modifications, "eye" got
>to the point where I had a true Admin account.
>
>From what I have read, Masm 7.10 is the best version.
Don't have that one.

>I went to Microsoft's site, but they don't offer it in any current
>package.
>I would like to use it.

Since I am unlikely to ever use XP and refuse to use anything later, I
can't really help much.

The latest version of MASM that I normally use is 6.15 - the later
versions just got added to the collection.
-- 
ArarghMail907 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the extra stuff from the reply address.
0
Reply ArarghMail907NOSPAM 7/24/2009 11:52:01 PM

8 Replies
101 Views

(page loaded in 0.098 seconds)


Reply: