views:

289

answers:

1

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?

+4  A: 

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.

AndiDog
thanks.i didn't know that thing.
Behrooz
But you should be able to reference string constants defined in actual C++, so you're not losing much in this case.
Steven Sudit
char* c = "15 chars"
Behrooz