NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: ThatGuy22 on December 08, 2010, 10:12:45 PM

Title: How do I change the video memory pointer?
Post by: ThatGuy22 on December 08, 2010, 10:12:45 PM
How do I change the video memory pointer? I have read that it is fastest to swap the video memory pointer for the graphics card rather than buffering the screen. So how would I do this, and also set the dimensions of it if possible?
Title: Re: How do I change the video memory pointer?
Post by: Frank Kotler on December 09, 2010, 05:34:40 AM
In 16-bit code? int 10h/5

http://www.ctyme.com/intr/rb-0091.htm

In 32-bit code... you're in for a world of hurt, I think! This file might help?

http://www.programmersheaven.com/download/1866/ZipFileList.aspx

It actually deals with switching to mode 13h, but using ports rather than int 10h. Also check out "ports.lst", part of the RBIL package. I think it may be port 3CEh (and 3CFh?) that you want, but I'm not sure...

Unless you've determined that buffering the screen is really too slow, I'd go with that. Reading from video memory is very slow. If your "new pixel" depends on the "old pixel", work in a buffer (probably two buffers) - copy video memory to a buffer once, if you must, work in the buffer(s), and copy the buffer back to screen memory when you're done. "rep movsd" is pretty fast, but you can use wider registers for even more speed(?) if you need to...

Best,
Frank

Title: Re: How do I change the video memory pointer?
Post by: ThatGuy22 on December 09, 2010, 01:49:04 PM
If I were to make It faster I would use larger registers, thanks.