[OT] Assembler

hi,
i know it’s ot, but i don’t find any docu…
Does anyone know how to do inline assembler with gnu c++ compiler.
someone told me it was __adm in vc++, but it doesn’t work with gnu c++.
Please help me…

thx
Olli–
Oliver van Porten aka McDeck >||< ICQ: 68507164
Reg. Linux User #170855 >||< IRC: #gamedev.ger
Linux Guru at skullpture >||< www.skullpture.de
PGP-Key-ID: 0xBC04CA5B >||< “LINUX rulez”

“Oliver van Porten [McDeck]” wrote:

hi,
i know it’s ot, but i don’t find any docu…
Does anyone know how to do inline assembler with gnu c++ compiler.
someone told me it was __adm in vc++, but it doesn’t work with gnu c++.
Please help me…

Try:

http://linuxassembly.org/

JW–
// John Watson
// Software Engineer – STScI Archive Team

VC++ and the GNU tools use different assembler syntaxes… the GNU
tools use the AT&T assembler syntax. I believe there are converters
available, however.On Sat, Jun 24, 2000 at 12:33:13AM +0200, Oliver van Porten [McDeck] wrote:

hi,
i know it’s ot, but i don’t find any docu…
Does anyone know how to do inline assembler with gnu c++ compiler.
someone told me it was __adm in vc++, but it doesn’t work with gnu c++.
Please help me…

thx
Olli


“I know not with what weapons World War III will be fought, but I know
that World War IV will be four with sticks and stones.” — Einstein

“Oliver van Porten [McDeck]” wrote:

hi,
i know it’s ot, but i don’t find any docu…
Does anyone know how to do inline assembler with gnu c++ compiler.
someone told me it was __adm in vc++, but it doesn’t work with gnu c++.
Please help me…

You use the asm("…") thingy to insert inline assembly code. But
beware: the syntax the GNU Assembler uses is very different from the
standard 80x86 assembly you’re probably accustomed to. For example,
where you would write

mov	eax,ebx

in standard Intel assembly syntax, you would have to write

movl	%ebx,%eax

(AT&T syntax) but that’s only scratching the surface… And you can’t
use MMX, 3DNow!, or any instructions available in instruction sets
beyond Pentium Classic, because GAS just plain doesn’t support them.
And in the meantime, visit http://linuxassembly.org/. I think in most
cases, you can avoid using inline assembly and dealing with GAS by
trying to write assembly procedures that interface to your C code, and
use NASM to do your assembly. This is far saner because not only does
NASM have syntax more similar to standard 80x86 assembly syntax, it
allows you to build your code on non-GNU systems without trouble,
because NASM can create objects compatible with those generated by VC++,
for instance… If you wanted inline asm, you would have to write two
versions for the same platform, with all the trashwork involved in
converting the oddball AT&T notation into standard Intel assembly… I
suppose some hardworking person out there could do the work of
converting GCC-style inline asm to a more standard inline asm…

By the way, is Brennan’s Guide to Inline Assembly still available? I
remember reading this document several years ago when I was trying to
write stuff for djgpp, and it might help here…–
Rafael R. Sevilla <@Rafael_R_Sevilla> +63 (2) 4342217
ICSM-F Development Team +63 (917) 4458925
University of the Philippines Diliman

I would warn against inline assembly language in all cases that it can be
avoided. If you want a really great cross platform X86 assembler get NASM
(The Netwide Assembler).

I have had great success with it in both DOS/Win32 and Linux platforms.

It’s syntax is like MASM but you should read the docs to see how it
handles lables. For example most of your LEA instructions will just be
MOV instructions.

It’s really quite neat!!!

DaveOn Sat, 24 Jun 2000, Dido Sevilla wrote:

“Oliver van Porten [McDeck]” wrote:

hi,
i know it’s ot, but i don’t find any docu…
Does anyone know how to do inline assembler with gnu c++ compiler.
someone told me it was __adm in vc++, but it doesn’t work with gnu c++.
Please help me…

You use the asm("…") thingy to insert inline assembly code. But
beware: the syntax the GNU Assembler uses is very different from the
standard 80x86 assembly you’re probably accustomed to. For example,
where you would write

mov eax,ebx

in standard Intel assembly syntax, you would have to write

movl %ebx,%eax

(AT&T syntax) but that’s only scratching the surface… And you can’t
use MMX, 3DNow!, or any instructions available in instruction sets
beyond Pentium Classic, because GAS just plain doesn’t support them.
And in the meantime, visit http://linuxassembly.org/. I think in most
cases, you can avoid using inline assembly and dealing with GAS by
trying to write assembly procedures that interface to your C code, and
use NASM to do your assembly. This is far saner because not only does
NASM have syntax more similar to standard 80x86 assembly syntax, it
allows you to build your code on non-GNU systems without trouble,
because NASM can create objects compatible with those generated by VC++,
for instance… If you wanted inline asm, you would have to write two
versions for the same platform, with all the trashwork involved in
converting the oddball AT&T notation into standard Intel assembly… I
suppose some hardworking person out there could do the work of
converting GCC-style inline asm to a more standard inline asm…

By the way, is Brennan’s Guide to Inline Assembly still available? I
remember reading this document several years ago when I was trying to
write stuff for djgpp, and it might help here…


Rafael R. Sevilla +63 (2) 4342217
ICSM-F Development Team +63 (917) 4458925
University of the Philippines Diliman