Inline assembly query.

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

  1. Auraomega

    Auraomega New Member

    Joined:
    Aug 29, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice