Mail Archives: djgpp/1997/01/16/22:51:54
>im trying to write to a 65k screen mode using djgpp. i managed this
>quite easily with the far pointer method, but it was slow so i decided
>to go for the nearptr method instead.
In my experience, nearptrs don't make very much difference with complex,
optimised drawing operations. Allegro is written entirely with far
pointers, but I once did a test of rewriting some of the functions with
the nearptr technique. It did help a bit with the simpler routines (the
putpixel went about 3% faster) but with anything of any complexity, like
blitting a 32x32 image to the screen, the difference was too small to
measure. To my mind the real benefit of nearptrs is ease of use, since
they can be treated as regular C pointers, not speed...
> videoptr[320+640*240+__djgpp_conventional_base] = 0xffff;
The videoptr is a pointer to a short (16 bits), so the array index is
multiplied by two in order to calculate the actual memory address. You
really don't want to do that to the __djgpp_conventional_base :-) Try
something along the lines of:
videoptr = (short *)(mi.address + __djgpp_conventional_base);
videoptr[320+640*240] = 0xffff;
/*
* Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
* Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
*/
- Raw text -