Forgets the original text screen in pascal

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: Source in Pascal

Program: Rememobr.pas
File exe: Rememobr.exe
File ubuntu: Rememobr

The program first forgets the original screen at the point of a start. This is followed by writing out the text without a meaning. In the end it recreates the screen and returns it to the former state.
{ REMEMOBR.PAS              Copyright (c) TrSek alias Zdeno Sekerak }
{ Program si odpameta povodnu obrazovku pri svojom spusteni.        }
{ Vypise neaky nezmyselny text.                                     }
{ Po skonceni obnovi obrazovku a vrati do povodneho stavu.          }
{                                                                   }
{ Datum:11.11.1996                             http://www.trsek.com }
 
program vrat_obrazovku;
uses crt,dos;
 
var x,y:integer;
    reg:registers;
    text,color:array [1..80,1..24] of byte;
 
begin
  { zapamata si co je na obrazovke }
  for x:=1 to 80 do
    for y:=1 to 24 do begin
      gotoxy(x,y);
      reg.ah:=$08;
      reg.bh:=0;
      intr($10,reg);
      text[x,y]:=reg.al;
      color[x,y]:=reg.ah;
    end;
 
  clrscr;
  writeln('Povodny obsah textovej obrazovky mam v pameti.');
  writeln('Stlac klaves pre obnovenie.');
 
  { pocka na stlacenie klavesy }
  readkey;
 
  { obnovi obrazovku }
  for x:=1 to 80 do
    for y:=1 to 24 do begin
      gotoxy(x,y);
      reg.ah:=$09;
      reg.al:=text[x,y];
      reg.bh:=0;
      reg.bl:=color[x,y];
      reg.cx:=1;
      intr($10,reg);
    end;
end.