Behrooz
Behrooz

Reputation: 1734

Beginner problem with inline assembly

I am using VS2008 C++ (no libs). This is my code:

    __asm
    {
    jmp start
msg:
          db "http://www.stackoverflow.com"
dtfld:
          db "00/00/0000"
tmfld:
          db "00:00:00"
start:

I am getting the following errors:

Error 1 error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
Error 2 error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
Error 3 error C2400: inline assembler syntax error in 'opcode'; found 'bad token'

Why is this?

Upvotes: 2

Views: 3033

Answers (1)

AndiDog
AndiDog

Reputation: 70148

Quote from Data Directives and Operators in Inline Assembly (Microsoft):

Although an __asm block can reference C or C++ data types and objects, it cannot define data objects with MASM directives or operators. Specifically, you cannot use the definition directives DB, DW, DD, DQ, DT, and DF, or the operators DUP or THIS. MASM structures and records are also unavailable. The inline assembler doesn't accept the directives STRUC, RECORD, WIDTH, or MASK.

Upvotes: 5

Related Questions