Board index » delphi » Clearing the screen in pascal

Clearing the screen in pascal

Hi people, I forgot how to clear the screen in TP7.0
I think you have to declare a var? and what is the command ? Thanks
 

Re:Clearing the screen in pascal


"Martin Rowley" <mrow...@videotron.ca> schreef in bericht
news:A5oV9.45493$vR3.683988@weber.videotron.net...

Quote
> Hi people, I forgot how to clear the screen in TP7.0
> I think you have to declare a var? and what is the command ? Thanks

ClrScr;

in the crt unit.

--
Femme

Re:Clearing the screen in pascal


Quote
Femme Verbeek <fv[at]{*word*104}jet[dot]nl> wrote:
> "Martin Rowley" <mrow...@videotron.ca> schreef in bericht
> > Hi people, I forgot how to clear the screen in TP7.0
> ClrScr;
> in the crt unit.

Then there also is

 117) How can I clear the screen without the Crt unit?

 165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

Re:Clearing the screen in pascal


JRS:  In article <A5oV9.45493$vR3.683...@weber.videotron.net>, seen in
news:comp.lang.pascal.borland, Martin Rowley <mrow...@videotron.ca>
posted at Wed, 15 Jan 2003 20:40:51 :-

Quote
>Hi people, I forgot how to clear the screen in TP7.0
>I think you have to declare a var? and what is the command ? Thanks

        for J := 1 to 50 do Writeln ;

is effective and will increase your code size only slightly.

--
? John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk   Turnpike v4.00   MIME. ?
 Web  <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
 For news:borland.*, use their server newsgroups.borland.com ; but first read
 Guidelines <URL:http://www.borland.com/newsgroups/guide.html> ff. with care.

Re:Clearing the screen in pascal


Quote
In article <9Uez5ZB0btJ+E...@merlyn.demon.co.uk>, Dr John Stockton wrote:
> JRS:  In article <A5oV9.45493$vR3.683...@weber.videotron.net>, seen in
> news:comp.lang.pascal.borland, Martin Rowley <mrow...@videotron.ca>
> posted at Wed, 15 Jan 2003 20:40:51 :-
>>Hi people, I forgot how to clear the screen in TP7.0
>>I think you have to declare a var? and what is the command ? Thanks

>         for J := 1 to 50 do Writeln ;

Make that sixty. 60 is still a resolution that exists.

Re:Clearing the screen in pascal


Dr John Stockton <s...@merlyn.demon.co.uk> wrote:

Quote
> JRS:  In article <A5oV9.45493$vR3.683...@weber.videotron.net>, seen in
> news:comp.lang.pascal.borland, Martin Rowley <mrow...@videotron.ca>
> posted at Wed, 15 Jan 2003 20:40:51 :-
>>Hi people, I forgot how to clear the screen in TP7.0
>>I think you have to declare a var? and what is the command ? Thanks

>         for J := 1 to 50 do Writeln ;

Could take a few milliseconds, but sure much more portable than clrscr.
Quote

> is effective and will increase your code size only slightly.

Re:Clearing the screen in pascal


Quote
"Mr. XXXX" wrote:

> Dr John Stockton <s...@merlyn.demon.co.uk> wrote:

> > JRS:  In article <A5oV9.45493$vR3.683...@weber.videotron.net>, seen in
> > news:comp.lang.pascal.borland, Martin Rowley <mrow...@videotron.ca>
> > posted at Wed, 15 Jan 2003 20:40:51 :-
> >>Hi people, I forgot how to clear the screen in TP7.0
> >>I think you have to declare a var? and what is the command ? Thanks

> >         for J := 1 to 50 do Writeln ;

> Could take a few milliseconds, but sure much more portable than clrscr.

> > is effective and will increase your code size only slightly.

page(output)

Works in general Pascal, not sure about Borland.

Re:Clearing the screen in pascal


JRS:  In article <Xns9308F066EA4Dmrx...@195.228.240.20>, seen in
news:comp.lang.pascal.borland, Mr. XXXX <random....@kcw.invalid.com>
posted at Sun, 19 Jan 2003 00:27:02 :-

Quote
>Dr John Stockton <s...@merlyn.demon.co.uk> wrote:

>> JRS:  In article <A5oV9.45493$vR3.683...@weber.videotron.net>, seen in
>> news:comp.lang.pascal.borland, Martin Rowley <mrow...@videotron.ca>
>> posted at Wed, 15 Jan 2003 20:40:51 :-
>>>Hi people, I forgot how to clear the screen in TP7.0
>>>I think you have to declare a var? and what is the command ? Thanks

>>         for J := 1 to 50 do Writeln ;

>Could take a few milliseconds, but sure much more portable than clrscr.

I tested it on a machine dating from 1988, which I believe to be nearly
one thousand times slower than a modern machine.  It was sufficiently
fast there.

OP should note that is annoying if an application which is not
intrinsically a full-screen application clears the screen.

A thoughtful full-screen application will use a different video page, so
that when it exits the original page is unchanged; the IDE does that, in
that or another way.

--
? 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:http://www.merlyn.demon.co.uk/clpb-faq.txt> Pedt Scragg: c.l.p.b. mFAQ;
  <URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.

Re:Clearing the screen in pascal


Dr John Stockton <s...@merlyn.demon.co.uk> wrote:

Quote
> JRS:  In article <Xns9308F066EA4Dmrx...@195.228.240.20>, seen in
> news:comp.lang.pascal.borland, Mr. XXXX <random....@kcw.invalid.com>
> posted at Sun, 19 Jan 2003 00:27:02 :-
>>Dr John Stockton <s...@merlyn.demon.co.uk> wrote:

>>> JRS:  In article <A5oV9.45493$vR3.683...@weber.videotron.net>, seen in
>>> news:comp.lang.pascal.borland, Martin Rowley <mrow...@videotron.ca>
>>> posted at Wed, 15 Jan 2003 20:40:51 :-
>>>>Hi people, I forgot how to clear the screen in TP7.0
>>>>I think you have to declare a var? and what is the command ? Thanks

>>>         for J := 1 to 50 do Writeln ;

>>Could take a few milliseconds, but sure much more portable than clrscr.

> I tested it on a machine dating from 1988, which I believe to be nearly
> one thousand times slower than a modern machine.  It was sufficiently
> fast there.

It also depends on the speed of the 'standard I/O' functions of the system.
The differences between a DOS *COMMAND LINE*, a DOS *WINDOW*, and a
terminal or complicated shell system could be extreme.

- Show quoted text -

Quote
> OP should note that is annoying if an application which is not
> intrinsically a full-screen application clears the screen.

> A thoughtful full-screen application will use a different video page, so
> that when it exits the original page is unchanged; the IDE does that, in
> that or another way.

Re:Clearing the screen in pascal


t...@UWasa.Fi (Timo Salmi) took the time on, 15 Jan 2003, to amuse us all by
posting to comp.lang.pascal.borland: news:b05gvg$sjj@poiju.uwasa.fi:

Quote
> Femme Verbeek <fv[at]{*word*104}jet[dot]nl> wrote:
>> "Martin Rowley" <mrow...@videotron.ca> schreef in bericht
>> > Hi people, I forgot how to clear the screen in TP7.0
>> ClrScr;
>> in the crt unit.

> Then there also is

>  117) How can I clear the screen without the Crt unit?

>  165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
>  tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked

>    All the best, Timo

Well, here's a neat and very fast way to do it.  This is also fun to play
with and you can do many neat things in text mode with it, such as popup
windows, shadows, screen captures, etc...

If you are interested, I could explain how it works.

-----

Function Screen_Address:word;
begin
  if (mem[0000:1040] and 48)<>48 then
    Screen_Address:=$B800 {Color}
      else
        Screen_Address:=$B000; {Monochrome}
end;

procedure ClearScreen;
var I:integer;
begin
  for I:=0 to 3999 do
    mem[Screen_Address:I]:=0;
end;

-----

--
The pool on the roof must have sprung a leak.

Re:Clearing the screen in pascal


Quote
Elmware  <DontS...@nowhere.com> wrote:
> t...@UWasa.Fi (Timo Salmi) took the time on, 15 Jan 2003, to amuse us all by
> >  117) How can I clear the screen without the Crt unit?
> >  165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
> >  tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked
> Well, here's a neat and very fast way to do it.  This is also fun to play

Covered in the said FAQ as

 A2: The alternative below writes by direct screen writing a null
character to the ordinary 80 x 25 screen and drawing black on black.
  (* Clear the 80 x 25 screen without the Crt unit *)
  procedure ClrScreen;
  type ScreenType = array [0..1999] of array [0..1] of byte;
  var ColorScreen : ScreenType Absolute $B800:$0000;
  begin
    FillChar (ColorScreen, SizeOf(ColorScreen), 0);
  end;

Quote
> procedure ClearScreen;

But an additional version never hurts.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

Re:Clearing the screen in pascal


t...@UWasa.Fi (Timo Salmi) took the time on, 20 Jan 2003, to amuse us all
by posting to comp.lang.pascal.borland:
news:b0ipm0$noh@majakka.uwasa.fi:

Quote
> Elmware  <DontS...@nowhere.com> wrote:
>> t...@UWasa.Fi (Timo Salmi) took the time on, 15 Jan 2003, to amuse us
>> all by
>> >  117) How can I clear the screen without the Crt unit?
>> >  165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
>> >  tsfaqp.zip Common Turbo Pascal Questions and Timo's answers,
>> >  linked

>> Well, here's a neat and very fast way to do it.  This is also fun to
>> play

> Covered in the said FAQ as

>  A2: The alternative below writes by direct screen writing a null
> character to the ordinary 80 x 25 screen and drawing black on black.
>   (* Clear the 80 x 25 screen without the Crt unit *)
>   procedure ClrScreen;
>   type ScreenType = array [0..1999] of array [0..1] of byte;
>   var ColorScreen : ScreenType Absolute $B800:$0000;
>   begin
>     FillChar (ColorScreen, SizeOf(ColorScreen), 0);
>   end;

>> procedure ClearScreen;

> But an additional version never hurts.

>    All the best, Timo

Interesting.  Your version seems to only change the text color and
background color to black.  The one I posted lets you change the character
as well.  It alternates between the colors and characters.  Colors are
bitmapped like so:
7: blinking text.
4-6:background color. (0 to 7)
0-3:text color. (0 to 15)
eg:
var TextColor, TextBackground:byte;

TextColor:=14;
TextBackground:=1;
mem[$B800:0000]:=ord('A');
mem[$B800:0001]:=TextBackground * 16 + TextColor;

To calculate the co-ordinates for the offset, just change the :0001 to
:(Y*160+X*2)+1
The only problem is that unlike using gotoxy(1,1), or wherex, and wherey,
the top left corner is 0,0.

--
The pool on the roof must have sprung a leak.

Re:Clearing the screen in pascal


Quote
> Interesting.  Your version seems to only change the text color and
> background color to black.  The one I posted lets you change the character
> as well.  It alternates between the colors and characters.  Colors are
> bitmapped like so:
> 7: blinking text.
> 4-6:background color. (0 to 7)
> 0-3:text color. (0 to 15)
> eg:
> var TextColor, TextBackground:byte;

> TextColor:=14;
> TextBackground:=1;
> mem[$B800:0000]:=ord('A');
> mem[$B800:0001]:=TextBackground * 16 + TextColor;

> To calculate the co-ordinates for the offset, just change the :0001 to
>:(Y*160+X*2)+1
> The only problem is that unlike using gotoxy(1,1), or wherex, and wherey,
> the top left corner is 0,0.

Both assume 80x25, which is bad IMHO.

Re:Clearing the screen in pascal


Quote
In article <Xns9309F044F65C6mrx...@195.228.240.20>, Mr. XXXX wrote:
> Dr John Stockton <s...@merlyn.demon.co.uk> wrote:

>> I tested it on a machine dating from 1988, which I believe to be nearly
>> one thousand times slower than a modern machine.  It was sufficiently
>> fast there.

> It also depends on the speed of the 'standard I/O' functions of the system.
> The differences between a DOS *COMMAND LINE*, a DOS *WINDOW*, and a
> terminal or complicated shell system could be extreme.

A classical example is Desqview(/X). Programs that do DSW's have problems
sometimes (or you have to start a maddening slow emulation).

This is one of the reasons why nearly all BBS stuff doesn't use DSW, also
because on some BBS'es you can get a remote shell (and the BBS software
can't redirect the DSWs, but can redirect the interrupt calls to output to the modem)

Re:Clearing the screen in pascal


[snip]

Quote

> Both assume 80x25, which is bad IMHO.

But could easily be fixed, because the X and Y-sizes are stored
somewhere in the BIOS data area at $0040...

Greetings

Markus

Go to page: [1] [2]

Other Threads