program Taminst;

uses Dos,TpCrt,TpEdit,Unit_sup,Unit_fil;

type SysRecType=record
        NumberOfUses:integer;
        InstallDay:word;
        InstallMonth:word;
        InstallYear:word;
        CodeAsf:array[1..10] of integer;
        BiosDateID:string[8];
 end;

const SysFileNm='FLTAML.DAT';

var   SysFile:File of SysRecType;
      SysRec:SysRecType;
      Year,Month,Day,Week:word;
      BiosDate:string[8];


procedure Get_ROM_date;
var j:integer;

begin
 for J:=0 to 7 do
  begin
    BiosDate[J+1]:=Chr(Mem[$F000:$FFF5+J]);
    BiosDate[0]:=Chr(8);
  end;
end;


procedure CreateSysFile;

var SysRecNum:LongInt;
    begin
       clrscr;
          Get_ROM_Date;
{$I-}
          Assign(SysFile,SysFileNm);
          reset(SysFile);
          if IOResult<>0 then  __SetAtFil(SysFileNm,$00,Day);
          Close(SysFile);
          Rewrite(SysFile);
            for SysRecNum:=0 to 25 do
                begin
                     seek(SysFile,SysRecNum);
                     write(SysFile,SysRec);
                end;

                with SysRec do
                     begin
                        NumberOfUses:=400;
                        GetDate(Year,Month,Day,Week);
                        InstallDay:=Day;
                        InstallMonth:=6;
                        InstallYear:=Year;
                        CodeAsf[1]:=8;
                        CodeAsf[2]:=9;
                        CodeAsf[3]:=3;
                        CodeAsf[4]:=1;
                        CodeAsf[5]:=1;
                        CodeAsf[6]:=2;
                        CodeAsf[7]:=7;
                        CodeAsf[8]:=5;
                        CodeAsf[9]:=2;
                        CodeAsf[10]:=8;
                        BiosDateID:=BiosDate;
                      end;
           seek(SysFile,13);
           write(SysFile,SysRec);
           Close(Sysfile);
end;


begin

     CreateSysFile;
     __SetAtFil(SysFileNm,$03,Day);
end.