Re: [Dev-C++] Problem with "asm" statement
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel K. O. <dan...@ya...> - 2004-12-13 21:04:01
|
Farzan Hajian wrote:
> Dear Dec-C++ user,
> I have problem with using "asm" statement.
> Please tell me the correct syntax of this statement.
> For example how can I use the following assembly codes in my C++
> programs?
>
> mov ah,20h
> mov bl,ah
> inc bl
> add ah,bl
You use the way that is defined in the C++ standard:
asm(" ........ ");
So you would do:
---
asm(
"movb $0x20, %ah \n"
"movb %ah, %bl \n"
"incb %bl \n"
"addb %bl, %ah \n"
);
---
Remember, GCC uses AT&T syntax by default. If you want to work with
Intel syntax use the "-masm" option:
|-masm=|dialect||
Output asm instructions using selected dialect. Supported choices
are |intel| or |att| (the default one).
More info at:
http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html
Daniel K. O.
|