home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / bbs / picssup.ark / COMPTIME.CLK < prev    next >
Encoding:
Text File  |  1986-10-18  |  2.4 KB  |  93 lines

  1. { PICS.CLK - Remote Operating System Clock Routines
  2.              Updated 8/24/86 for PICS compatibility by Les Archambault }
  3.  
  4. { File:        COMPTIME.CLK
  5.   Description: This driver set is designed to support the Computime ClockWatch
  6.                with factory default ports.
  7.   Date:        10/1/85
  8.   Author:      Larry Alex
  9.                MCI Mail 215-1551
  10. }
  11.  
  12. procedure GetTAD(var t: tad_array);
  13. { Return a 6 element integer array of the current system time in
  14.   seconds, minutes, hours, day, month, and year.  }
  15.  
  16.   const
  17.     CDatPort = $81;
  18.     CAddPort = $82;
  19.   var
  20.     i : integer;
  21.     j : integer;
  22.     Time : array [0..12] of byte;
  23.   begin
  24.     port[CDatPort] := 16;
  25.     Delay(1);
  26.     i := 0;
  27.       for j := 44 downto 32 do
  28.       begin
  29.         port[CAddPort] := j;
  30.         Time[i] := port[CAddPort];
  31.         i := i + 1;
  32.       end;
  33.     t[0] := Time[11] * 10 + Time[12];
  34.     t[1] := Time[9] * 10 + Time[10];
  35.     Time[7] := Time[7] - 8;
  36.     t[2] := Time[7] * 10 + Time[8];
  37.       if Time[4] > 3 then
  38.         Time[4] := Time[4] - 4;
  39.     t[3] := Time[4] * 10 + Time[5];
  40.     t[4] := Time[2] * 10 + Time[3];
  41.     t[5] := Time[0] * 10 + Time[1];
  42.     port[CDatPort] := 0;
  43.   end;
  44.  
  45. procedure SetTAD(var t: tad_array);
  46. { Set the system time using a 6 element integer array which contains
  47.   seconds, minutes, hours, day, month, and year. NOTE: ClockWatch seconds
  48.   must equal 0 in set routine.}
  49.   const
  50.     CDatPort = $81;
  51.     CAddPort = $82;
  52.   var
  53.     i : integer;
  54.     j : integer;
  55.     Time : array [0..12] of byte;
  56.   begin
  57.     Time[11] := 0;
  58.     Time[12] := 0;
  59.     Time[9] := t[1] div 10;
  60.     Time[10] := t[1] mod 10;
  61.     Time[7] := (t[2] div 10) + 8;
  62.     Time[8] := t[2] mod 10;
  63.     Time[4] := t[3] div 10;
  64.     Time[5] := t[3] mod 10;
  65.     Time[2] := t[4] div 10;
  66.     Time[3] := t[4] mod 10;
  67.     Time[0] := t[5] div 10;
  68.     Time[1] := t[5] mod 10;
  69.     port[CDatPort] := 16;
  70.     Delay(1);
  71.       i := 0;
  72.       for j:= 12 downto 0 do
  73.       begin
  74.         port[CAddPort] := j;
  75.         port[CDatPort] := Time[i] + 16;
  76.         port[CAddPort] := j + 16;
  77.         port[CaddPort] := j;
  78.         i := i + 1;
  79.       end;
  80.     port[CDatPort] := 0;
  81.   end;
  82.  
  83. {The following two procedures MUST remain here to maintain compatibility
  84.  with systems not using a clock. Please don't remove them.}
  85.  
  86. Procedure tick_a_min;
  87.   begin
  88.   end;
  89.  
  90. procedure tick_a_sec;
  91.   begin
  92.   end;
  93.