(*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (* procedures for record header and record data manipulation *) (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) unit Rekord; interface uses Common, Print; procedure r_fix_mneix(ix: byte); procedure r_fix_first_itno(itno: byte); procedure r_fix_len(lino: byte); procedure r_fix_sts(sts:byte); procedure r_fix_fa(fa: byte); procedure r_copy_rot(var frm: Teleframe); procedure r_inc_rot(d: integer); procedure r_fix_un_rot; procedure r_copy_rectime(time: tlm_tim); procedure r_copy_frtime(var frm: Teleframe); procedure r_inc_frtime(d: integer); procedure r_fix_un_time; (* undefined time *) procedure r_print_data(off,n : byte; var frm: Teleframe); (* copy from frame to line, sends line *) procedure r_print_v_err(off: byte; var frm: Teleframe); (* copy frame hdr and err data (with VDP mneix) from the offset to the end of frame, sends line *) procedure r_print_m_err(off: byte; var frm: Teleframe); (* copy frame hdr and err data (with MON mneix) from the offset to the end of frame, sends line *) procedure r_print_v_header(time: tlm_tim; src: byte; cnt: word; var frm: Teleframe); procedure r_print_m_header(time: tlm_tim; src: byte; cnt: word; var frm: Teleframe); (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) implementation var Line: DataLine; Header: HeaderLine; procedure r_fix_mneix(ix: byte); begin Line.MneIx:= ix end; procedure r_fix_first_itno(itno: byte); begin Line.FiNo:= itno; end; procedure r_fix_len(lino: byte); begin Line.Len:= lino-Line.FiNo+12; end; procedure r_fix_sts(sts:byte); begin Line.Sts:= sts; end; procedure r_fix_fa(fa: byte); begin Line.Fa:= fa; end; procedure r_copy_rot(var frm: Teleframe); begin Line.Rt:= frm.rt; end; procedure r_inc_rot(d: integer); begin if d<0 then d:= d+128; d:= d+ Line.Rt; if d>255 then d:= d-256; Line.Rt:= d; end; procedure r_fix_un_rot; (* undefined rotation *) begin Line.Rt:= UnRt; end; procedure r_copy_rectime(time: tlm_tim); begin Line.RecTime:= time; end; procedure r_copy_frtime(var frm: Teleframe); begin Line.FrTime:= frm.frtime; end; procedure r_inc_frtime(d: integer); var m, n : integer; begin with Line do begin if d<0 then d:=d+128; n:= FrTime[3]; n:=n+ round(d*ConFaTime); if n<256 then FrTime[3]:= n else begin m:= n div 256; FrTime[3]:= n mod 256; n:= FrTime[2]; n:= n+m; if n<256 then FrTime[2]:= n else begin m:= n div 256; FrTime[2]:= n mod 256; FrTime[1]:= (FrTime[1]+m) mod 256; end; end; end; end; procedure r_fix_un_time; (* undefined time *) begin Line.FrTime:= UnTime; end; procedure r_print_data(off,n : byte; var frm: Teleframe); (* copy from frame to line, sends line *) var i, ix : byte; up: integer; begin ix:= 7; if off=6 then begin Line.Data[ix]:= frm.off; ix:= ix+1; off:= off+1 end; up:= off+n; if up>Over then up:= Over; for i:= off to up do begin Line.Data[ix]:= frm.data[i]; ix:= ix+1 end; print_line(Line); end; procedure r_print_err(off: byte; var frm: Teleframe); (* copy frame hdr without mneix and err data from offset to the end of frame, sends line *) var i: byte; begin with Line do begin Sts:= frm.sts; Fa:= frm.frfa; Rt:= frm.rt; FrTime:= frm.frtime; end; r_fix_first_itno(off); r_fix_len(119); r_print_data(off,Over-off,frm); end; procedure r_print_v_err(off: byte; var frm: Teleframe); (* copy frame hdr and err data from offset to the end of frame, sends line *) begin r_fix_mneix(vMneOff+vErrIx); r_print_err(off,frm); end; (* r_print_v_err *) procedure r_print_m_err(off: byte; var frm: Teleframe); (* copy frame hdr and err data from offset to the end of frame, sends line *) begin r_fix_mneix(mMneOff+mErrIx); r_print_err(off,frm); end; (* r_print_m_err *) procedure r_print_header(time: tlm_tim; src: byte; cnt: word; var frm: Teleframe); begin with Header do begin Len:= 13; RecTime:= time; Sts:= frm.sts; Fa:= frm.frfa; Rt:= frm.rt; FrTime:= frm.frtime; Source:= src; Count:= cnt; end; print_header(Header); end; procedure r_print_v_header(time: tlm_tim; src: byte; cnt: word; var frm: Teleframe); begin Header.MneIx:= vHdrIx; r_print_header(time,src,cnt,frm); end; (* r_print_v_header *) procedure r_print_m_header(time: tlm_tim; src: byte; cnt: word; var frm: Teleframe); begin Header.MneIx:= mHdrIx; r_print_header(time,src,cnt,frm); end; (* r_print_m_header *) begin end. (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)