Mail Archives: djgpp/1996/08/09/21:15:19
patrick fox wrote:
>
> void v_putpixel(int x,int y,char clr)
> {
> __asm__ __volatile__(
> "pushl %%eax\n"
> "pushl %%edi\n"
> "pushw %%es\n"
> "movl %0,%%eax\n"
^
Should this not read "movl %1,%%eax\n" ?
> "movl %%eax,%%edi\n"
> "shll $8,%%eax\n"
> "shll $6,%%edi\n"
> "addl %0,%%eax\n"
> "addl %%eax,%%edi\n"
> "movw _dos_ds,%%ax\n"
> "movw %%ax,%%es\n"
> "movb %2,%%al\n"
> "stosb\n"
> "popw %%es\n"
> "popl %%edi\n"
> "popl %%eax");
> }
Also, if you wish to replace y*320 by faster instructions, try
movl %1,%%edi
leal [%%edi,%%edi,4],%%edi
shll $6,%%edi
(you *can* leal with edi can't you?)
So the complete version would read
void v_putpixel(int x,int y,char clr)
{
__asm__ __volatile__(
"pushl %%eax\n"
"pushl %%edi\n"
"pushw %%es\n"
"movl %1,%%edi\n"
"leal [%%edi,%%edi,4],%%edi
"shll $6,%%edi\n"
"addl %0,%%edi\n"
"movw _dos_ds,%%ax\n"
"movw %%ax,%%es\n"
"movb %2,%%al\n"
"stosb\n"
"popw %%es\n"
"popl %%edi\n"
"popl %%eax"
);
Bob.
- Raw text -