0

私は次のコードを使用しています:

int _tmain(int argc, _TCHAR* argv[])
{
    __asm{ 
           "MOV EAX, DMSN[0]";
           "LEA EBX, DMSN[0]";
           "CALL EBX";
         };
    return 0;
}

MOV EAXおよびLEA EBX、は後で2つの異なる配列を含みます。しかし、例に関しては、それらは同じものを含みます。

私は以下を使用しています:

const BYTE DMSN[694]={blah, blah, blah};

しかし、私はこれらのエラーに気づいています:

1>c:\users\1337\documents\visual studio 2010\projects\test2\test2\test2.cpp(49): error     C2400: inline assembler syntax error in 'opcode'; found 'bad token'
1>c:\users\1337\documents\visual studio 2010\projects\test2\test2\test2.cpp(50): error     C2400: inline assembler syntax error in 'opcode'; found 'bad token'
1>c:\users\1337\documents\visual studio 2010\projects\test2\test2\test2.cpp(51): error     C2400: inline assembler syntax error in 'opcode'; found 'bad token'**strong text**

なにが問題ですか?

4

2 に答える 2

2

構文に誤りがあります。次のように使用してください:-

 int _tmain(int argc, _TCHAR* argv[])
    {
      _asm{ 
           mov eax, DMSN[0]
           lea ebx, DMSN[0]
           call ebx
          }
        return 0;
    }

VSベースのコンパイラ用。

于 2012-08-14T09:56:41.590 に答える
1

if dmsn is array, you dont have to put [0] to access first element

int _tmain(int argc, _TCHAR* argv[])
{
    __asm{ 
           mov eax, DMSN
           lea ebx, DMSN
           call ebx
         };
    return 0;
}

mov instruction will automatically check for the operand sizes and will take first 32 bits into register(eax) and 32 bit effective address to register(ebx)

VC++ 2010 express

于 2012-08-14T11:24:59.607 に答える