Board index » delphi » reading screen in textmode,dos

reading screen in textmode,dos

Quote
Matthias Steffens wrote:

> Does anyone know how I can read the parts of screen in textmode, TP7.0
> DOS in oder to write it to a file?

The screen is in the B000 (mono) or B800 (color) segment. It consists
of chars followed by the color attributes.

Type ScrChar = Record
                 C : Char;
                 A : Byte;
               End;
     TScreen = Array[0..24,0..79] of ScrChar;
or (sorry, I am too lazy now to think...)
     TScreen = Array[0..79,0..24] of ScrChar;

Var Screen : TScreen absolute $B800:0000;  for color modes.
:-)
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation
http://members.eunet.at/meg-glaser/    http://members.xoom.com/f_glaser/
http://www.geocities.com/~franzglaser/            http://start.at/bedarf

 

Re:reading screen in textmode,dos


JRS:  In article <38241162.84BDF...@eunet.at> of Sat, 6 Nov 1999
12:30:42 in news:comp.lang.pascal.misc, Ing. Franz Glaser <meg-

Quote
gla...@eunet.at> wrote:
>Matthias Steffens wrote:

>> Does anyone know how I can read the parts of screen in textmode, TP7.0
>> DOS in oder to write it to a file?

c.l.p.borland would be the right newsgroup.

If you want to write just text, you must access alternate locations; for
text+attributes, one can dump a screen at a time, first calculating
location and size.

Quote
>The screen is in the B000 (mono) or B800 (color) segment. It consists
>of chars followed by the color attributes.

>Type ScrChar = Record
>                 C : Char;
>                 A : Byte;
>               End;
>     TScreen = Array[0..24,0..79] of ScrChar;
>or (sorry, I am too lazy now to think...)
>     TScreen = Array[0..79,0..24] of ScrChar;

>Var Screen : TScreen absolute $B800:0000;  for color modes.

One should not assume that the screen is 80*25, Page 0.  On my newer PC,
I do all my DOS work in an 80*50 DOS box, and most programs recognise
this.

The actual width, height, and page can be read by interrupt, see Ralf
Brown's List.

One can, I suppose, assuming that the screen is no bigger than 132*60,
use

type Line = array [0..131] of ScrChar ;
PLine = ^Line ;
Var Screen : array [0..59] of PLine ;

and initialise the array Screen with calculated pointers, thus making
the screen characters accessible as Screen[Row]^[Col].C;

or write
        function ScrChr(const X, Y : byte) : char ;
        begin ScrChr := char(Mem[ScrBase:(Y*LineLen+X)*2]) end ;

--
? John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk   Turnpike v4.00   MIME. ?
 <URL: http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
 <URL: ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ;
 <URL: http://www.merlyn.demon.co.uk/clpb-faq.txt> Pedt Scragg: c.l.p.b. mFAQ.

Re:reading screen in textmode,dos


Quote
Dr John Stockton wrote:

> JRS:  In article <38241162.84BDF...@eunet.at> of Sat, 6 Nov 1999
> 12:30:42 in news:comp.lang.pascal.misc, Ing. Franz Glaser <meg-
> >The screen is in the B000 (mono) or B800 (color) segment. It consists
> >of chars followed by the color attributes.

> If you want to write just text, you must access alternate locations; for
> text+attributes, one can dump a screen at a time, first calculating
> location and size.

Of course you are right, John.

I wanted to give an initial firing hint only :-)

Kindest Regards,
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation
http://members.eunet.at/meg-glaser/    http://members.xoom.com/f_glaser/
http://www.geocities.com/~franzglaser/            http://start.at/bedarf

Other Threads