Author Topic: How do I change the video memory pointer?  (Read 17554 times)

Offline ThatGuy22

  • Jr. Member
  • *
  • Posts: 40
How do I change the video memory pointer?
« 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?
« Last Edit: December 08, 2010, 11:08:24 PM by ThatGuy22 »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: How do I change the video memory pointer?
« Reply #1 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


Offline ThatGuy22

  • Jr. Member
  • *
  • Posts: 40
Re: How do I change the video memory pointer?
« Reply #2 on: December 09, 2010, 01:49:04 PM »
If I were to make It faster I would use larger registers, thanks.