From: lonniem AT cs DOT utexas DOT edu (Lonnie McCullough) Newsgroups: comp.os.msdos.djgpp Subject: Re: 24-bpp putpixel (last mesg. of the day, I swear :) Date: Thu, 10 Jul 1997 06:00:46 GMT Message-ID: <33c47729.2594911@news.nol.net> References: <33C18042 DOT 318F8F1F AT execulink DOT com> NNTP-Posting-Host: ip39-86.nol.net Lines: 25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >I'm looking for a 24-bpp putpixel function (perferably AT&T ASM, but I >can convert from C or Intel ASM). I tried a very simple one: This is what I do (24-bpp is a pain in the ass) void _putpixel24 (SURFACE* surface, int x, int y, long color) { asm ("andl $0x00FFFFFF,%%eax \n\t" /* restrict it to lower 3 bytes */ "andl $0xFF000000,(%%edx) \n\t" /* zero out video memory */ "orl %%eax,(%%edx) \n\t" /* or it with video memory */ : : "a" (color), "d" (surface->offset + y * surface->bytesperline + x * 3) : "eax", "edx"); } This is very slow but it works. Actually just use Shawn's code. Much better. Just thought I'd throw in someting else for flavor and what not to do in high speed performance programming. There are 2 read's and 2 write's here to memory and if the address is not properly aligned this code is horribly slow. Oh well. It works but I need to fix it. Lonnie McCullough lonniem AT cs DOT utexas DOT edu