home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / USCX / TURBO-06.ZIP / INKEYGET.PAS < prev    next >
Pascal/Delphi Source File  |  1985-02-23  |  2KB  |  56 lines

  1. var
  2.    specialkey : boolean;
  3.    command    : char;
  4.  
  5. function inkey(var special : boolean; var keychar : char) : boolean;
  6.  
  7. var
  8.    dosrec : record ax,bx,cx,dx,bp,si,di,ds,es,flags : integer; end;
  9.  
  10. begin
  11.      if keypressed
  12.         then
  13.             begin
  14.                  dosrec.ax := $0800;
  15.                  msdos(dosrec);
  16.                  keychar := chr(lo(dosrec.ax));
  17.                  inkey := true;
  18.                  if ord(keychar) = 0
  19.                     then
  20.                         begin
  21.                              special := true;
  22.                              dosrec.ax := $0800;
  23.                              msdos(dosrec);
  24.                              keychar := chr(lo(dosrec.ax));
  25.                         end
  26.                         else special := false;
  27.             end
  28.             else
  29.                 begin
  30.                      inkey := false;
  31.                      special := false;
  32.                 end;
  33.             end;
  34.  
  35. begin
  36.      clrscr;
  37.      writeln('Press any key -- F10 to quit');
  38.      writeln;
  39.      command := #00;
  40.  
  41.      repeat
  42.            if inkey(specialkey,command)
  43.               then
  44.                   begin
  45.                        if specialkey
  46.                           then writeln('Special key -- ascii code is ',ord(command))
  47.                           else writeln('Regular key -- ascii code is ',ord(command));
  48.                        writeln;
  49.                        if command <> #68
  50.                           then writeln('Press any key -- F10 to quit.');
  51.                           writeln;
  52.                   end;
  53.               until command = #68;
  54. end.
  55.  
  56.