1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Inline assembly query.

Discussion in 'C' started by Auraomega, Aug 29, 2010.

  1. Auraomega

    Auraomega New Member

    Aug 29, 2010
    Likes Received:
    Trophy Points:
    I've never used inline assembly shockingly, and I'm just wondering how/if I can do something.

    Bit of background; I'm coding a basic OS kernel, I have various subroutines written in assembly and amongst others I have a puts subroutine that is an attempt at mimicking puts in C. In order to call puts I move the address of my string to the esi register and call puts:

    mov esi, strDATE
    call puts
    I'm using the GCC compiler (and possibly in the future G++), how could I get puts to print a string from C? I guess I'm looking for something like...

    char HW[] = "Hello World!";

    asm("mov HW, esi");
    asm("call puts");
    (inverted code because GCC uses AT&T syntax I believe?).

Share This Page