[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inline asm?



On Fri, 28 May 1999, Dennis Payne wrote:

> asm {
> ...
> }
> 
> However that would be gnu assembly.
> 
> It sounds to me like you're talking about assembly to access hardware
> devices.  In general you don't do this under linux.  Instead you use
> a library that does all the hardware manipulation.  You might want to
> take a look at SVGALib or KGI if you want to know how it works underneath.

Hmm...is optimization over-rated then? Most of the graphics literature
I've been reading talks about using bitshifts instead of multiplies for
pixel placement, etc, and shows how much faster these things are. Would
it be safe to assume that the way the library does it is "good enough"?

i.e. what I have been doing to keep with the literature I have is to get
direct access to the video memory via

unsigned char* vidmem = vga_getvidmem() // SVGALib code of course

and then doing something like
void SetPixel(ushort x, ushort y, byte color) {
  vidmem[320*y + x] = color;
}

This would be the kind of code that my books would go into assembly over
and talk about how to make it better and faster, etc.

Can I rely on vga_drawpixel() to be as fast as I could make it with the
proper asm language? Or should I even care with modern processors?

Thanks ;)

-j

--
Joel R. Stanley                   *  jstanley@up.edu       
http://rainier.up.edu/~jstanley   *  #include <std_disclaimer.h>