Mail Archives: djgpp/1997/12/08/12:04:27
Hugo Jose Ferreira wrote:
>
> Hi !
> Can someone, please, help me with this Assembly Routine...
> I'm new to the Extended ASM of DJGPP.. I used to program with RealMode, TASM
> Systax,
> but, all this AT&T syntax confuse me ! Please, Correct this function:
>
> void setdaccolor(byte color, byte red, byte green, byte blue) {
> __asm__ __volatile__ (
> "movw $0x3C8, %%dx \n\t"
> "outb %%al, %%dx \n\t"
> "movw $0x3C9, %%dx \n\t"
> "movb red, %%al \n\t"
> "outb %%al, %%dx \n\t"
> "movb green, %%al \n\t"
> "outb %%al, %%dx \n\t"
> "movb blue, %%al \n\t"
> "outb %%al, %%dx"
> : : "rm" (color)
> : "%eax", "%edx" );
> }
>
> Thanks In Advance...
Hmmm. I'm not going to test this, but it should be close if there is a
bug :)
void setdaccolor(byte color, byte red, byte green, byte blue) {
__asm__ __volatile__ (
"movl $0x3C8, %%edx \n\t"
"outb %%al, %%dx \n\t" /* "a" below put color in eax
"incl %%edx\n\t"
"movb %b1, %%al \n\t" /* red */
"outb %%al, %%dx \n\t"
"movb %b2, %%al \n\t" /* green */
"outb %%al, %%dx \n\t"
"movb %b3, %%al \n\t" /* blue */
"outb %%al, %%dx"
: : "a" (color), "rm" (red), "rm" (green), "rm" (blue)
: "%eax", "%edx" );
}
I also changed your 16-bit move to 32-bit because they are
faster&better. Also, instead of using %1, I used %b1 to specify byte
type.
- Raw text -