home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / bix / common.inc < prev    next >
Text File  |  1986-08-04  |  3KB  |  120 lines

  1.   {  The following code fragments are a series of procedures and
  2.      functions that I commonly include in Turbo Pascal programs.
  3.  
  4.      The Type definitions I've found to be especially useful.  }
  5.  
  6.  
  7. Type
  8.  
  9.    Regs8088 = record
  10.      Case Integer of
  11.        0: (ax, bx, cx, dx, bp, si, di, ds, es, Flags : Integer );
  12.        1: (al, ah, bl, bh, cl, ch, dl, dh            : Byte    );
  13.        End;
  14.  
  15.    DOSRegs  = record
  16.      Case Integer of
  17.        0: (ax, bx, cx, dx, bp, si, di, ds, es, Flags : Integer);
  18.        1: (al, ah, bl, bh, cl, ch, dl, dh            : Byte   );
  19.        End;
  20.  
  21.    Str3        =  String[03];
  22.    Str8        =  String[08];
  23.    Str10       =  String[10];
  24.    Str14       =  String[14];
  25.    Str80       =  String[80];
  26.    Str255      =  String[255];
  27.    AnyString   =  String[255];
  28.  
  29.    DateTp      =  record
  30.       Yr       :  Byte;
  31.       Mo       :  Byte;
  32.       Day      :  Byte;
  33.       End;
  34.  
  35.    ScreenCharacter = Record
  36.       DisplayByte  : Char;
  37.       DisplayAttr  : Char;
  38.       End;
  39.  
  40.    ScreenImage = array [1..25, 1..80] of ScreenCharacter;
  41.  
  42.  
  43. {***************************************************************}
  44.  
  45. Function LoggedDisk : Char;
  46. Var
  47.   Registers : DOSRegs;                {record for MsDos call}
  48. Begin
  49.   With Registers do
  50.        Begin
  51.          LoggedDisk := 'A';    {set up default}
  52.          ah := $19;
  53.          MSDOS(Registers);
  54.          Case al of
  55.            0 : LoggedDisk := 'A';
  56.            1 : LoggedDisk := 'B';
  57.            2 : LoggedDisk := 'C';
  58.            End;
  59.  
  60.          End;
  61.   End;
  62.  
  63.  
  64.  
  65.  
  66. Procedure GetDate (Var DtRec : DateTp;  Var StrDt : Str10 );
  67. Var
  68.   Registers   : DOSRegs;                {record for MsDos call}
  69.   TheMonth    : string[2];
  70.   TheDay      : string[2];
  71.   TheYear     : string[4];
  72.  
  73. Begin
  74.   with Registers do
  75.        begin
  76.          ah := $2a;
  77.          MsDos(Registers);                      { call function }
  78.          cx       := cx - 1900;
  79.          DtRec.Yr := cx;
  80.          DtRec.Mo := dh;
  81.          DtRec.Day:= dl;
  82.          str(cx : 2, TheYear);        {convert to string}
  83.          str(dl : 2, TheDay);                { " }
  84.          str(dh : 2, TheMonth);              { " }
  85.          End;
  86.  
  87.   StrDt := TheMonth + '/' + TheDay + '/' + TheYear;
  88.  
  89.   End;
  90.  
  91.  
  92. Procedure Beep;    { for invalid keypresses, etc. }
  93.  Begin
  94.    NoSound;
  95.    Sound(440);   Delay(100);   NoSound;
  96.    End;
  97.  
  98.  
  99. Procedure BigCursor;
  100. Var
  101.   Regs  : Regs8088;
  102. Begin
  103.   Regs.ah := 1;       { set cursor type }
  104.   Regs.ch := 00;
  105.   Regs.cl := 07;
  106.   Intr ($10, Regs);
  107.   End;
  108.  
  109.  
  110. Procedure SmallCursor;
  111. Var
  112.   Regs  : Regs8088;
  113. Begin
  114.   Regs.ah := 1;       { set cursor type }
  115.   Regs.ch := 07;
  116.   Regs.cl := 07;
  117.  
  118.   Intr ($10, Regs);
  119.   End;
  120.