DEFINITION MODULE Srecord;
(* Creates Motorola S-records of program:        *)
(*    S0 = header record,                        *)
(*    S2 = code/data records (24 bit address),   *)
(*    S8 = termination record (24 bit address).  *)

   FROM FileSystem IMPORT
      File;

   FROM LongNumbers IMPORT
      LONG;


   EXPORT QUALIFIED
      StartSrec, WriteSrecLine, EndSrec;


   PROCEDURE StartSrec (VAR f : File; SourceFN : ARRAY OF CHAR);
   (* Writes S0 record (HEADER) and initializes *)

   PROCEDURE WriteSrecLine (VAR f : File; 
                            AddrCnt, ObjOp, ObjSrc, ObjDest : LONG;
                               nA,     nO,    nS,     nD    : CARDINAL);
   (* Collects Object Code -- Writes an S2 record to file if line is full *)

   PROCEDURE EndSrec (VAR f : File);
   (* Finishes off any left-over (Partial) S2 line, *)
   (* and then writes S8 record (TRAILER)           *)

END Srecord.
