using ASM in C and C++

can anyone help me.i'm new.and dont know how to use asm in C. can anyone send me full program(it can be simple no matter) which works, for me to try.which codes should i use. does it work with no problem in WinXP?

Comments

  • : can anyone help me.i'm new.and dont know how to use asm in C. can anyone send me full program(it can be simple no matter) which works, for me to try.which codes should i use. does it work with no problem in WinXP?
    :


    In C:

    There is no standard way to do it.
    I could be one of the following:

    asm NOP;
    asm {NOP};
    asm "NOP";
    asm {"NOP"};

    asm can be __asm, etc. There are as many variants as there are compilers. Check your compiler documentation.


    In ANSI/ISO C++:

    [code]
    asm
    {
    "NOP"
    };
    [/code]

  • : : can anyone help me.i'm new.and dont know how to use asm in C. can anyone send me full program(it can be simple no matter) which works, for me to try.which codes should i use. does it work with no problem in WinXP?
    : :
    :
    :
    : In C:
    :
    : There is no standard way to do it.
    : I could be one of the following:
    :
    : asm NOP;
    : asm {NOP};
    : asm "NOP";
    : asm {"NOP"};
    :
    : asm can be __asm, etc. There are as many variants as there are compilers. Check your compiler documentation.
    :
    :
    : In ANSI/ISO C++:
    :
    : [code]
    : asm
    : {
    : "NOP"
    : };
    : [/code]
    :
    :
    [green]
    Dev c uses _asm("NOP"); and uses the AT&T sysntax as default.
    [/green]
  • : : : can anyone help me.i'm new.and dont know how to use asm in C. can anyone send me full program(it can be simple no matter) which works, for me to try.which codes should i use. does it work with no problem in WinXP?
    : : :
    : :
    : :
    : : In C:
    : :
    : : There is no standard way to do it.
    : : I could be one of the following:
    : :
    : : asm NOP;
    : : asm {NOP};
    : : asm "NOP";
    : : asm {"NOP"};
    : :
    : : asm can be __asm, etc. There are as many variants as there are compilers. Check your compiler documentation.
    : :
    : :
    : : In ANSI/ISO C++:
    : :
    : : [code]
    : : asm
    : : {
    : : "NOP"
    : : };
    : : [/code]
    : :
    : :
    : [green]
    : Dev c uses _asm("NOP"); and uses the AT&T sysntax as default.
    : [/green]
    :

    Most compilers use AT&T syntax, but some are able to use Intel too.

    If you want your own assembler syntax, use your favorite assembler and link it. It isn't very hard to write C[++] funcs in asm
  • : : : : can anyone help me.i'm new.and dont know how to use asm in C. can anyone send me full program(it can be simple no matter) which works, for me to try.which codes should i use. does it work with no problem in WinXP?
    : : : :
    : : :
    : : :
    : : : In C:
    : : :
    : : : There is no standard way to do it.
    : : : I could be one of the following:
    : : :
    : : : asm NOP;
    : : : asm {NOP};
    : : : asm "NOP";
    : : : asm {"NOP"};
    : : :
    : : : asm can be __asm, etc. There are as many variants as there are compilers. Check your compiler documentation.
    : : :
    : : :
    : : : In ANSI/ISO C++:
    : : :
    : : : [code]
    : : : asm
    : : : {
    : : : "NOP"
    : : : };
    : : : [/code]
    : : :
    : : :
    : : [green]
    : : Dev c uses _asm("NOP"); and uses the AT&T sysntax as default.
    : : [/green]
    : :
    :
    : Most compilers use AT&T syntax, but some are able to use Intel too.
    :
    : If you want your own assembler syntax, use your favorite assembler and link it. It isn't very hard to write C[++] funcs in asm
    :
    [green]
    Microsoft and Borland use Intel. Dev C is the only one I have come across that uses AT&T by default.
    [/green]
  • : :
    : : Most compilers use AT&T syntax, but some are able to use Intel too.
    : :
    : : If you want your own assembler syntax, use your favorite assembler and link it. It isn't very hard to write C[++] funcs in asm
    : :
    : [green]
    : Microsoft and Borland use Intel. Dev C is the only one I have come across that uses AT&T by default.
    : [/green]
    :

    gcc uses AT&T but is able to use Intel if you tweak it
  • You might want to check www.codepedia.com/1/CppAsm
    bilderbikkel

  • [b][red]This message was edited by Lundin at 2006-11-9 1:24:59[/red][/b][hr]
    : You might want to check www.codepedia.com/1/CppAsm
    : bilderbikkel
    :
    :


    My first post as well as Codepedia seems to be wrong.
    Here is from the ANSI/ISO C++ standard:

    [code][b]7.4 The asm declaration[/b]

    1 An asm declaration has the form

    asm-definition:

    asm ( string-literal ) ;

    The meaning of an asm declaration is implementation-defined.
    [/code]


    Meaning that correct syntax is

    asm ( "NOP" );

    and nothing else.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories