Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to put a pixel via memory, on page!=0?

Status
Not open for further replies.

Theherod

Programmer
Jun 28, 2007
6
Hello,
I'm writing a program that shows some animations (mode 13), but during the animation, the screen is blinking. I thought to write the new frame to the next page, and then switch to it.
In text mode, the written page is the first digit of the offset (b500:0000 page 0, b500:1000 page 1 etc). Does anyone know how does it work in mode 13? there are 64000 bytes in each page, so one segment address is to small for two pages...

Thanks a lot!

Regards,
Gal.
 
This is a very complicated (but quite rewarding) subject. Basically the VGA memory is accessed via one segment, which limits it to 64k, but it needs a lot more than that for the 640*480 16 colour screen, so in fact there are 4 planes of pixels available at each byte. Set up correctly, any byte you send to VGA memory is actually panned out over 4 bytes hidden behind one another... In 16-colour modes the planes correspond to the three colours and intensity, and each byte writes 8 pixels. Incidentally, the screen memory starts at 0A000h in all graphic modes.

In the 256colour modes, the VGA pretends that 3 of these bytes don't exist, so as to make a contiguous memory map. You can, however, turn them back on again, which gives you a much larger memory to play with, but a need to do in's and out's to control the VGA hardware. This is variously called "Mode X" or non-chain-4 mode and various variants on it.

The result is that you can have two (or more) pages in all modes except the high-resolution 16-colour graphics. But even here, you can have 2 pages provided you use the split screen feature where the bottom of the screen is cut off as a "score-bar" area that is only represented once in memory.

There's loads of stuff on internet about this. My standard advice is do some searching for M. Abrash, or for VGA hardware.

You might not need to do paging, depending on your animation. It might be enough to coordinate the drawing with the cathode ray beam's refresh; this is much easier. But you'll still need to understand something of the VGA's hardware to find when the refresh is taking place.
 
Thanks a lot!

Sorry for the late answer, I were in a vacation without access to the internet...
I didn't fully understand your whole message, but I know what to search for now:p
I guess you don't have a simple source-code which I could look at (it's not critical anyhow, I could search for it), do you...?

Thanks again:)

Regards,
Gal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top