News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

error A2085

Started by Theidson, June 21, 2007, 10:35:01 AM

Previous topic - Next topic

Theidson

Hello everyone,
Newbie question here:

getting the following error:
error A2085: instruction or register not accepted in current CPU mode

when assembling code with:
      .486
      .model flat, stdcall
      option casemap :none

on this instruction:
   MOVD      tX[ DI ], 0

using:
m32v9r
i.e.
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

anybody help ?
appologies if i'm asking an obvious question but i've tried all types of the MOVD, MOVQ instructions but to no avail


Tedd

mov DWORD PTR tx[di],0

The instruction is always just "mov" - if you want/need to specify a size then that's separate (byte/word/dword; and annoyingly followed by 'ptr')
No snowflake in an avalanche feels responsible.

hutch--

I would like to know a bit more about what tX is and how its defined and I would like to see the context where you are using DI rather than the 32 bit EDI. Just make sure you are not trying to build 16 bit code or use 16 bit addressing in 32 bit mode which is what you have defined with,


      .486
      .model flat, stdcall
      option casemap :none
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

Theidson,

MOVD and MOVQ are MMX instructions, so you need to use a .MMX (or .XMM) directive to enable the instruction set. The directive should follow option casemap :none, otherwise ML will recognize only upper case for the register names (MM0 but not mm0, etc.)

You cannot use a 16-bit register to store an address in 32-bit code, because such code uses 32-bit addresses.
eschew obfuscation

Theidson

tX was defined:
   tX                                  dd 16 dup(0)

the .mmx changed the error to:
error A2070: invalid instruction operands
on either
MOVD tx[ DI ], 0
MOVD tx[ EDI ], 0
MOVD tx[ EDI ], EAX

The instruction set ref. says:
"The source and destination operands can be general-purpose registers"
MOVD mm, r/m32   Move doubleword from r/m32 to mm.
MOVD r/m32,mm    Move doubleword from mm to r/m32

Yes 32-bit code is what I'm wanting to produce ultimately
Thank you for your suggestions so far
I suspect i have the syntax wrong somehow as its been a while since I did assembler, but really want to get back into it.

Tedd

None of those involve mmx registers, so they're not mmx instructions - you're simply storing a general-purpose register, or constant value, into memory (indexed by edi).
MOVD is specifically for mmx, e.g. "movd MM0,eax", "movd tX[edi],MM0", etc
No snowflake in an avalanche feels responsible.

Theidson

Yes, so if the instruction set ref. says:
"The source and destination operands can be general-purpose registers"
I should be able to use MOVED with normal registers shouldn't I ? or even MOVEQ ?

Tedd

Well, no - if it doesn't involve an mmx register then it's not an mmx instruction. There are already general-purpose instructions for moving to/from/between general-purpose registers and memory.
The source can be a general purpose register, or the destination can be a general purpose register, but not both at the same time -- one must be an mmx register; ditto for memory.

MOVQ allows a different combination, which excludes general-purpose registers (but includes memory <-> mmx/xmm-register).
No snowflake in an avalanche feels responsible.