Reading Screen Contents in BP7 under DOS?

Quote
In article <4hlbrv$...@csc.canberra.edu.au> u913...@student.canberra.edu.au (Damian Haslam) writes:
>I'm confident that if I for example do this:
>gotoxy(1,1);
>writeln('oooh!');
>then call some function like:
>c := getscrnval(4,1);
>writeln(c);
>c would have 'h' in it.. what is the "getscrnval" real name, and can't
>you specify some kind of rectangle, and fill a 2d array of words with the
>screen data? (one byte for colour info, the other for the char value?)

"getscrnval" doesn't have a real name, because there's no similar function
in the Pascal library.  It's whatever you want to call it.

Quote
>please help me!

It's not too difficult, and can be done with a couple structures:

type
  TCAInfo = record
    ch : char; {ASCII value}
    at : byte; {color attribute}
  end;

  TScreen = array[1..50,1..80] of TCAInfo; {enough for an 80x50 screen}
  PScreen = ^TScreen;

var
  TextScreen : PScreen;

function getscreenchar (x, y : byte; screen : PScreen) : char;

begin
  getscreenchar := screen^[y,x].ch;  
end;

function getscreenattr (x, y : byte; screen : PScreen) : byte;

begin
  getscreenattr := screen^[y,x].at;
end;

begin
  TextScreen := ptr(SegB800,0);
  {Note 1:  For earlier than TP7, use ptr($B800,0) instead.}
  {Note 2:  Pointers don't *have* to point to the heap!}
  writeln (getscreenchar(4,1,Screen),' ',getscreenattr(4,1,Screen));
  {writes the character and attribute at x=4, y=1.}
end;

Not compiled and tested, but this ought to work well.  :-)

Quote
>Email would be most fantastic, I shall post a summary if anyone is
>interested.
>cheers  - damian
>--
>= Damian J. K. Haslam === dam...@air.net.au =============================
>Ver Estatis ubera; illi mens est misera, qui nec vivit,
>nec lascivit sub Estatis dextera. - "Carmina Burana"
>=========================================================================

--
Scott F. Earnest             |0100100001000001010010010100110000100000|
sc...@whiplash.res.cmu.edu   |0100010101010010010010010101001100100001|
Head Pope, Non-Extant Temple of Afrodite, Goddess of Funky 70's Hairdos -><-
      YOU'VE BEEN LIED TO:  Possession is only one tenth of the law.
                The other nine tenths is really STUPIDITY!