Last update March 7, 2012

Doc Comments /
IAsm



Inline Assembler

More Information

CMPXCH8B vs. CMPXCHG8B

Why is the op-code named CMPXCH8B and not CMPXCHG8B? -- ThomasKühne

Operand Types: AsmTypePrefix

The section "Operand Types" does not contain the keyword "qword ptr". This keyword is required even for 32bit machines. Some MMX instructions take arguments of this type!

Did I miss something?

from NG:digitalmars.D/31469 by Tiago Gasiba

Note: qword ptr also seems to work as double ptr.

Accepting Different Styles of the Assembly Syntax

Q: How difficult would it be to alter the inline assembler to accept parameter arguments for new default syntaxes? For instance, you could have something like asm(intel) or asm(gas) or asm(arm) or asm(hal). That way somebody could progromatically decide the base style of the assembly syntax they were going to use. It doesn't seem to be internally inconsistent, as virtually all assembler code should be written in 'version' tags anyway, as I see it. (based on NG:digitalmars.D/40249)

A: Very time consuming - you'd have to write whole new assemblers. ( NG:digitalmars.D/40251)

Non-usable Data Definition Keywords

  • db - define byte
  • dw - define word
  • dd - define double word
  • dq - quad word
  • etc.
This is how it *should* be done, any other assembler or earth knows those keywords (TASM, MASM, FASM, YASM, NASM, etc.) except mighty D, you had to invent your own "keywordology" to confuse assembler coders, I just don't get it. -- BinkySmith?

What about assembly functions?

How about something like :-

asm int myFunction()
{
    ... assembly code ...
}

The compiler handles the function call handling but the body of the function is pure assembly. This saves the tedious bit of handling the function call which is normally fairly fixed and lets you focus on the assembly implementation. It also provides a small amount of implementation independence.

How would this be different from the below code? ThomasKühne

int myFunction(){
    asm{
        naked;
        ... assembly code ...
    }
}

Message

Add your comments here...

Links


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: March 7, 2012 20:25 (diff))