Comments: Authenticated sender is From: "George Foot" To: Endlisnis Date: Sun, 23 Aug 1998 22:45:20 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: ASM Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk CC: djgpp AT delorie DOT com Message-Id: Precedence: bulk On 23 Aug 98 at 11:39, Endlisnis wrote: > > Why don't you want to use input registers? > > I was trying to make an 'RGB' function that took 3 byte's as parameters and > returned a long. My idea was to do something like: > > unsigned int RGB(unsigned char R, unsigned char G, unsigned char B) > { > unsigned Ret; > asm ("shll $8, %%eax; " > "movb G, %%al; " > "shll &8, %%eax; " > "movb B, %%al; " > : "=a" (Ret) : "a" (R) : ); > return Ret; > } > > That would be faster than loading R,G,B into registers then combining them into > one register. Hmm. Write your own function then; you can then access the parameters directly, on the stack. unsigned int RGB (unsigned char, unsigned char, unsigned char); asm ( ".globl _RBG \n" "_RGB: \n" " xorl %eax, %eax \n" " movb 4(%esp), %ah \n" " movb 8(%esp), %al \n" " shll $8, %eax \n" " movb 12(%esp), %al \n" " ret \n" ); -- george DOT foot AT merton DOT oxford DOT ac DOT uk