[comp.lang.pascal] EGA/VGA Screen dump problem

tran@peora.sdc.ccur.com (Nhan Tran) (01/28/91)

  I want to dump a graphic screen to a file and read the file back for
quick graphic display.

  The graphic mode I used (Turbo Pascal) is EGAHi (for EGA) or VGAMed (for VGA)
(graphic mode 0x10).  The resolution of this mode is 640 x 350, 16 colors.

  The memory of graphic pages starts at 0xA000.  Since this graphic mode uses
4 bit planes,  I thought that I just dump out the 4 bit planes memory to file
and read them back in order and got back the orginal image.  

     var  bitplane0 : byte absolute $A000:000;
          bitplane1 : byte absolute $A001:000;
          bitplane2 : byte absolute $A800:000;
          bitplane3 : byte absolute $A800:000;

          { each bit plane in this mode takes 28,000 bytes }

    Dump out the graphic screen:

          assign(f, file_name);
	  rewrite(f, 1);
	  blockwrite(f, bitplane0, 28000);
	  blockwrite(f, bitplane1, 28000);
	  blockwrite(f, bitplane2, 28000);
	  blockwrite(f, bitplane3, 28000);

    Retrieve the image:

          assign(f, file_name);
	  reset(f, 1);
	  blockread(f, bitplane0, 28000);
	  blockread(f, bitplane1, 28000);
	  blockread(f, bitplane2, 28000);
	  blockread(f, bitplane3, 28000);

    The problem is when I retrieve the image, the shape of the image (ex: a
    bunch of color filled circles) is still there, but all color are 
    converted to either black or white.

    I suspect that my declaration of bitplane address is not correct or
    something else I don't know about.  Please help!!

Nhan Tran
Email: tran@peora.sdc.ccur.com