Sender: M DOT A DOT Bukin AT inp DOT nsk DOT su To: djgpp AT delorie DOT com Subject: Re: PLEASE HELP with ExtAsm References: <66e3ui$9jd$1 AT duke DOT telepac DOT pt> From: Michael Bukin Date: 08 Dec 1997 15:17:10 +0600 In-Reply-To: "Hugo Jose Ferreira"'s message of Sun, 7 Dec 1997 12:17:32 -0500 Message-Id: <20ra7onqi1.fsf@Sky.inp.nsk.su> Lines: 58 Precedence: bulk "Hugo Jose Ferreira" writes: > Can someone, please, help me with this Assembly Routine... > 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" ); > } I don't think your need any assembly here. void setdaccolor (byte color, byte red, byte green, byte blue) { outportb (0x3C8, color); outportb (0x3C9, red); outportb (0x3C9, green); outportb (0x3C9, blue); } Or (trying to add some "optimizations"): void setdaccolor (byte color, byte red, byte green, byte blue) { int port = 0x3C8; outportb (port++, color); outportb (port, red); outportb (port, green); outportb (port, blue); } But I don't think this will be any better (try both and choose best one). Compile it with: gcc -Wall -O2 -S setdac.c And see the resulting code in setdac.s Also, try the following commands: info gcc invo (for gcc switches) info libc alpha outport (for outport prototype, which headers to include...) I have not tested the above functions because I have not DJGPP here, but they should work (after inclusion of correct header and defining `byte' type).