{$M 2048,0,0}
Uses Crt,Dos;
Const
      BufSize = 4000;
      Attr    = $07;
Var
    L1, L2 : Word;
   C, I, E : Word;
   Vector5, Vector1C : Pointer;
   VideoBuf : Array [ 1 .. BufSize ] of byte;
      X,Y : Byte;

Procedure SaveVideo;
 Begin
  For C := 1 to BufSize do VideoBuf[C] :=  Mem[$B800:C];
 End;

Procedure RestoreVideo;
 Begin
  For C := 1 to BufSize do Mem[$B800:C] := VideoBuf[C];
 End;

Procedure SaveCursor;
 Begin
  X := WhereX; Y := WhereY;
 End;

Procedure RestoreCursor;
 Begin
  GoToXY ( X,Y );
 End;

Procedure Slow; Interrupt;
 Begin
  For I := 1 to L1 do for E := 1 to L2 do ;
 End;

Procedure Change; Interrupt;
 Begin
   SaveCursor;
   Sound(1000);Delay(2000);NoSound;
   SaveVideo;
   For C := 2 to 79 do Mem[ $B800 : 2*C-2 ] := 205;
   For C := 81 to 159 do Mem[ $B800 : 2*C-2 ] := 32;
   For C := 162 to 239 do Mem[ $B800 : 2*C-2 ] := 205;
   Mem[ $B800 : 0 ] := 201;
   Mem[ $B800 : 158 ] := 187;
   Mem[ $B800 : 160 ] := 186;
   Mem[ $B800 : 318 ] := 186;
   Mem[ $B800 : 320 ] := 200;
   Mem[ $B800 : 478 ] := 188;
   For C := 1 to 240 do Mem[ $B800 : 2*C-1 ] := Attr;
   GoToXY( 2,2 );
   Write('Number = ',L2,' Enter the new number: ');
   Read(L2);
   RestoreVideo;
   RestoreCursor;
  If L2 = 0 then
                        begin
                         SetIntVec($1C,Vector1C);
                         SetIntVec($5  ,Vector5);
                        end;
 Sound(1000);Delay(200);NoSound;
 End;

Begin
 L1 := 10000;
 L2 := 1;
 GetIntVec($1C,Vector1C);
 GetIntVec(5,Vector5);
 SetIntVec($1C,@Slow);
 SetIntVec( 5 ,@Change);
 Keep(0);
End.
