From: jonklipp AT freenet DOT edmonton DOT ab DOT ca () Newsgroups: comp.os.msdos.djgpp Subject: Re: locking video mem (DJGPP 2.0) Date: 14 Dec 1996 19:30:31 GMT Organization: Edmonton FreeNet, Edmonton, Alberta, Canada Lines: 51 Message-ID: <58uv8n$9iq$1@news.sas.ab.ca> References: <58t9jl$45k AT nr1 DOT ottawa DOT istar DOT net> NNTP-Posting-Host: fn2.freenet.edmonton.ab.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp hotpulp AT netidea DOT com wrote: : To access the video buffer, I declared a pointer : char *video; : and when I plot a pixel or blit double buffer I go like this : __djgpp_nearptr_enable(); : video = djgpp_conventional_base + 0xA0000 : video [y*320+x] = 6; /* plot a pixel */ : __djgpp_nearptr_disable(); : now, I was wondering if this method is the most efficient way to access : the video buffer (I don't care how dangerous it is)? What might be a bit faster is this: /* GLOBAL */ unsigned char *video_buffer = (unsigned char*)0xA0000; void putpixel(int x, int y, char color) { video_buffer[y*320+x]=color; } int main() { __djgpp_nearptr_enable(); video_buffer += __djgpp_conventional_base; putpixel(x,y,color); /*repeat your putpixels and other program stuff */ __djgpp_nearptr_disable(); } This would be slightly faster than your way because you are not enabling and disableing nearptrs for every pixel, and you aren't adding djgpp_conventional_base and 0xa0000 every time. The disadvantage is that you lose memory protection (i think), so it is quite easy to keep writing pixels past the end of the video mem and manage to freeze your computer. I've had lotsa experience with that :) Anyway, i'm using Allegro right now, which is much easier :) hope it helps, -jon -- jon klippenstein internet: klip AT cryogen DOT com uucp: alberta!ve6kik!dparrot!{root,klip} ham radio: ve6klp