Mail Archives: djgpp/1998/05/13/00:03:43
>DJGPP uses AT&T syntax. For more info on assembly programming go to the
>DJGPP main page(www.delorie.com). There is also another option of using
>NASM assembler with DJGPP.
><
You can also generate interrupts with c callable functions, and you can do OUTS
with outportb (I think outportw too...)
I don't know quite that much about converting inline asm to djgpp's syntax...
but I do know some things.... the order of operands is reversed...
..also, "immediate" operands have a $ in front of them...
you precede register operands with a % symbol... and the letter after the
instruction tells the SIZE of the move or assignment....
I was just looking for a good example but... well here goes....
mov ax, 0x03
is something like
movw $0x03, %ax
Here's some code that does nothing in particular.... it's inline assembly
though.... the __volatile__ keyword, I believe, tells GAS (djgpps assembler)
not to mess with the code and change things around...
notice the \n\t after each line of code.... I've seen code without it... but
this is the way I do it....
__asm__ __volatile__(
"movl $99,%ebx\n\t"
"shll $8,%ebx\n\t"
"movl %ebx,%eax\n\t"
"shrl $2,%ebx\n\t"
);
There are many faqs out there... but one you may want to look at is the one in
the DJGPP section of the game programming megasite:
http://www.perplexed.com/GPMega/
Good luck!
Jim the loiterer
aloiterer AT juno DOT com
http://members.xoom.com/JimMcCue/index.htm
(Jim the loiterer's PC games, programming, & stuff...)
- Raw text -