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

  1. { PICS.CLK - Remote Operating System Clock Routines
  2.              Updated 8/24/86 for PICS compatibility by Les Archambault }
  3.  
  4. { File:        LEGACY.CLK
  5.   Description: This driver set is designed to support the Legacy clock for
  6.                a Kaypro 10 (should work with other Kaypro machines as well).
  7.   Date:        5/4/85
  8.   Author:      Chris DeBracy
  9.  
  10.   Description: Comment update and code cleanup.
  11.   Date:        9/7/85
  12.   Author:      Steve Fox
  13. }
  14.  
  15. procedure GetTAD(var t: tad_array);
  16. { Return a 6 element integer array of the current system time in
  17.   seconds, minutes, hours, day, month, and year. }
  18.   const
  19.     z1 = $79;
  20.     z2 = $7B;
  21.   var
  22.     i: integer;
  23.     temp: array[0..4] of integer;
  24.     tar: array[0..12] of integer;
  25.   begin
  26.     for i := 0 to 12 do
  27.       begin
  28.         port[z1] := 0;
  29.         port[z2] := $CF;
  30.         port[z2] := 0;
  31.         port[z1] := i;
  32.         port[z1] := i + 128;
  33.         port[z1] := i;
  34.         port[z1] := $20;                    { set input mode }
  35.         port[z2] := $CF;
  36.         port[z2] := $0F;
  37.         port[z1] := $20;
  38.         tar[i] := port[z1] and $0F          { read data }
  39.       end;
  40.     val(chr(tar[1] + 48) + chr(tar[0] + 48), temp[0], i);
  41.     val(chr(tar[3] + 48) + chr(tar[2] + 48), temp[1], i);
  42.     val(chr(tar[5] + 48) + chr(tar[4] + 48), temp[2], i);
  43.     val(chr(tar[8] + 48) + chr(tar[7] + 48), temp[3], i);
  44.     val(chr(tar[10] + 48) + chr(tar[9] + 48), temp[4], i);
  45.     for i := 0 to 4 do
  46.       t[i] := temp[i];
  47.     t[5] := 85
  48.   end;
  49.  
  50. procedure SetTAD(var t: tad_array);
  51. { Set the system time using a 6 element integer array which contains
  52.   seconds, minutes, hours, day, month, and year. }
  53. begin
  54.   mem[$FF7C] := t[0];
  55.   mem[$FF7D] := t[1];
  56.   mem[$FF7E] := t[2];
  57.   mem[$FF7F] := pred(t[3]);
  58.   mem[$FF80] := pred(t[4]);
  59.   mem[$FF81] := t[5]
  60. end;
  61.  
  62. {The following two procedures MUST remain here to maintain compatibility
  63.  with systems not using a clock. Please don't remove them.}
  64.  
  65. Procedure tick_a_min;
  66.   begin
  67.   end;
  68.  
  69. procedure tick_a_sec;
  70.   begin
  71.   end;
  72.