Reading Screen Contents in BP7 under DOS?

In article <4hlbrv$> (Damian Haslam) writes:
>I'm confident that if I for example do this:
>then call some function like:
>c := getscrnval(4,1);
>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.

>please help me!

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

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

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

  TextScreen : PScreen;

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

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

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

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

  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.}

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

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

Scott F. Earnest             |0100100001000001010010010100110000100000|   |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!