jump's in inline assembler

Discussion in 'Mac Programming' started by Larrson, Feb 24, 2009.

  1. macrumors newbie

    Joined:
    Feb 24, 2009
    Location:
    Australia
    #1
    Hi,

    Could anyone tell me, please, what wrong is with this frag of code:
    Code:
    ...
    dec     edx
    jnz     short loc_10014FC3
    xor     edx, edx
    ...
    
    There is always "error: expected primary-expression before 'short'"

    And, where i can find more informations about inline assembly on Mac OSX.

    Cheers,
    L.
     
  2. macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #2
    All of my assembly programming have been done on Freescale HC12s, so the information I give could and probably is wrong.

    Fro my understanding, and I can be wrong, that a short is just a way to define a length of bits, problem is you need to define what kind of data it is, an int or what not.

    So from my assembly programming, we don't worry about casting or anything like that. We know that the registers and data are in 2's complement, and are 16 bits (2 words) big.

    This might be a place to start:

    http://developer.apple.com/DOCUMENT...ler/000-Introduction/chapter_1_section_1.html
     
  3. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    From googling that error it looks like you might have a curly-brace syntax error, possibly surrounding the asm block, but that's just a wild guess ;)
     
  4. thread starter macrumors newbie

    Joined:
    Feb 24, 2009
    Location:
    Australia
    #4
    Hi,

    Sorry guys for delay from my end.
    Problem solved by removing word "short"; you right LtRammstein, no casting or anything like that.

    Cheers,
    L.
     
  5. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #5
    Google for "gcc documentation". As a simple example for inline assembler, create a program, enter "htonl", Jump to definition and follow where it takes you. Inline assembler is tough.

    What you are trying to do is assembler, not inline assembler. Go to any source file, best in "Release" mode, and "Show assembler" in the Build menu. Look at what's there. Then add a .s file to your project containing your own assembler code.
     

Share This Page