[comp.unix.microport] mods to hercules driver: 386, faster, better, ...

dave@micropen (David F. Carlson) (06/21/88)

First, I'd like to thank John Antypas for the hercules graphics driver
he posted recently.  To keep it going I'd like to contribute the following
tips.

1).	The use of fpbyte/spbyte are easy but require (I believe) a subroutine
linkage for *each pixel set*!!!!  This is very painful and costs far more than
the math to be done on the pixel.  

Under SV/386 the the lines in open() and the following macros make things
work at memory speed rather than subroutine linkage speed:

static char *base;  /* extern scope */

in open():

base = sptalloc(8, PG_P | PG_RW, herc_base >> 12, 0);
	/* allocates 8 pages (32k page 0 memory) at physical address herc_base */

then the following some where:

	/* no range checking so be careful!! */
#define fpbyte(address)	(*(address - base))
#define spbyte(address, val)	(*(address - base) = val) 

Further gains may be eeked out by removing the gratuitous subtraction
required for address - base = offset computation, but this requires
source code mods.


Have fun kiddies.

-- 
David F. Carlson, Micropen, Inc.
...!{ames|harvard|rutgers|topaz|...}!rochester!ur-valhalla!micropen!dave

"The faster I go, the behinder I get." --Lewis Carroll