Path: utzoo!attcan!utgpu!watmath!att!mtuxo!mtgzz!drutx!druhi!boc
From: boc@druhi.ATT.COM (Ocinneide)
Newsgroups: comp.lang.pascal
Subject: Re: Saving screen images to disk, can you help?
Message-ID: <4487@druhi.ATT.COM>
Date: 11 Aug 89 03:31:16 GMT
References: <5425@decvax.dec.com>
Organization: AT&T, Denver, CO
Lines: 38

In article <5425@decvax.dec.com>, f0057@uafhp.uucp (James E. Ward) writes:
> 
> 
> A few days ago, I posted a brief request for help in this newsgroup.  I guess
> it was too brief!  What I need is techniques for saving screen images to disk
> files using Turbo Pascal 5.0!  I am doing a bit of graphics/animation and need
> to be able to save part of or all of the screen to disk.  Let me know if you
> can help, okay?
> 
> James E. Ward
> f0057@uafhp.uucp		Use this address or be bounced!

The Graphic Screen Ram on a PC or Compatible starts at segment $B800. Once your image is being displayed on the screen you need to copy the appropriate memory segments to your file. I believe for CGA 4-Color Graphics mode you need to copy 16K bytes starting at this segment. Something like this should do it...

procedure saveimage(image_filespec:string);
var outfile:file;
begin
assign(outfile,image_filespec);
rewrite(outfile,16384);
blockwrite(outfile,ptr($B800,0)^,1);
close(outfile);
end;

To display your saved image again...

procedure showimage(image_filespec:string);
var infile:file;
begin
assign(infile,image_filespec);
reset(infile,16384);
blockread(infile,ptr($B800,0)^,1);
close(infile);
end;

These routines save and show the entire screen. To display a portion of the saved image requires more complex processing. The continuous bytes you have saved in the file represent screen pixel lines 1,3,5,7..199 followed by screen pixel lines 2,4,6,8..198,200. To pull a portion of the screen image for display then requires somewhat more complicated routines.... but heck! thats the fun of programming!
Good Luck!

Breanndan (AT&T An Rogha Cheart!)