How do I save a part of the screen (VGA) into the disk as a file very fast (like BSAVE of QBASIC) and load it very fast (like BLOAD of the same)?
How do I save a part of the screen (VGA) into the disk as a file very fast (like BSAVE of QBASIC) and load it very fast (like BLOAD of the same)?
Depends on the OS and depends on the compiler.
you can save screen in terms of array of bytes. Screen memory starts from 0xB800.
Each pixel contains 2 bytes. First byte contains character and second contains it's appearace just like its color.
For example if you want to save first line of your screen having 640x480 resolution. You have to pick 640*2 = 1280 bytes from address 0xB800.
Chintan R Naik
For VGA mode 13h (320 x 200 x 256 colors), the memory address is 0xA0000 (A000:0000 in segment : offset), and each pixel is only 1 byte. So, it also depends on which video mode you are using.
Last edited by JasonD; 06-28-2003 at 08:59 AM.
Also, you're not guaranteed to even be ABLE to directly read/write video memory in most modern operating systems; that violates the driver model.
What platform/OS? Under Windows, you can use GDI functions. You could even use DirectX if you want to be really fancy.