home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / pascal / wwg-crt / break.p next >
Text File  |  1997-07-14  |  1KB  |  62 lines

  1. program readkey;
  2.  
  3. {$I "include:utils/crt.i" }
  4. {$I "Include:dos/dos.i" }
  5.  
  6. var
  7.    key   :  char;
  8.    i, j, tc, tb   :  byte;
  9.    x     :  integer;
  10.    ex    :  boolean;
  11.    
  12. procedure WriteHexChar(c : char);
  13. var
  14.    i     :  integer;
  15.    a, b  :  byte;
  16. begin
  17.    a := (ord(c) shr 4) and $0F;
  18.    b := ord(c) and $0F;
  19.    
  20.    for i := 0 to 1 do begin
  21.       if a < 10 then Write(char(ord('0') + a))
  22.       else Write(char(ord('A') + (a-10)));
  23.       
  24.       a := b;
  25.    end;
  26. end;
  27.  
  28. begin
  29.    ClrScr;
  30.    CursorOff;
  31.    
  32.    tc := GetTextColor;
  33.    TextColor(3);
  34.    Write("Break:");
  35.    TextColor(0);
  36.    tb := GetTextBackground;
  37.    TextBackground(3);
  38.    Write(" [ctrl c = Abbruch] > ");
  39.    
  40.    TextColor(tc);
  41.    TextBackground(tb);
  42.    
  43.    x := WhereX;
  44.    j := 0;
  45.  
  46.    repeat
  47.       Inc(j);
  48.       Write('·'); Delay(10);
  49.  
  50.       ex := Break;
  51.  
  52.       if ex = true then begin
  53.          GotoX(x);   WriteLn("** Abbruch!     ");
  54.       end;
  55.    until (j = 15) or (ex = true);
  56.  
  57.    if ex = false then begin
  58.       GotoX(x);   WriteLn("ok.            ");
  59.    end;
  60.    
  61.    CursorOn;
  62. end.