inline asm trouble

This is a discussion on inline asm trouble within the C Programming forums, part of the General Programming Boards category; Hello all. Code: asm ( "bsf %1,%0;" "btr %0,%1" : "=r" (col) // output : "0" (thisdelta) // input ); ...

  1. #1
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192

    inline asm trouble

    Hello all.

    Code:
    asm (
                "bsf %1,%0;"
                "btr %0,%1"
    
                :   "=r" (col)             // output
                :   "0" (thisdelta)     // input
    
                );
    I'm using the Bloodshed compiler.

    This code should find the first set bit in thisdelta, and then clear it, leaving the index of the set bit in col. Using the Bsf on it's own works fine, but here the bit never seems to get cleared.

    I don't know whether the problem is in the assembly code itself or the way I'm specifying the parameters.

    Can anyone recommend any good books/resources on x86 assembler?

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    Not sure about AT&T style but there are some good online resources for Intel style syntax.

    [edit] I googled for you
    http://maven.smith.edu/~thiebaut/Art.../artofasm.html[/edit]
    Last edited by sand_man; 02-27-2005 at 05:05 PM.

  3. #3
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    Thanks. looks interesting. I figure if I'm going to learn x86 asm I may as well learn intel + AT&T syntax.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 10:42 PM
  2. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM
  3. Inline asm
    By wavering in forum C Programming
    Replies: 2
    Last Post: 01-29-2002, 02:42 AM
  4. Inline asm - I love it!
    By wavering in forum C Programming
    Replies: 2
    Last Post: 01-08-2002, 02:19 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21