;
                                  T4GEN.COM                                   

             Size (recs) CRC   Version    Author/Latest Issue      Disk
               3k (19)   44A6  1.0        Ludo VanHemelryck 4/89   Z3COM9 

  1- Syntax  2- Notes                                                         


   T4GEN opens  an alternate  route  to  the generation  of Type-4 object code 
modules.   According  to Jay Sage  (TCJ #34),  the generation  of such modules 
necessitate either advanced utilities or a cumbersome DDT operation.   Using a
pair of Intel HEX format input files which can readily be produced in a number
of ways,  T4GEN directly outputs  a Type-4 module,  incorporating the required 
TYP4LDR header in the process.
:1


   Syntax:  <[du:|dir:]fn1> [du:|dir:][<fn2>]

    where.. fn1 = filename of input file pair:  <fn1>.HX0/<fn2>.HX1

            fn2 = filename of output file (optional)  
:2

T4GEN Notes:

   a.  A Type-4 object code module has three components:

       - The actual code, assembled to a defined origin of either 0 (SPR-type) 
         or 100h (PRL-type),

       followed by:

       - A  bit-map identifying the location sensitive bytes within  the code,

       and preceded with:

       - A loader  program  which inserts the  code  at the  desired location, 
         adjusting all location sensitive bytes in the process.   In  order to 
         enable it to interpret the relocation bit-map, this loader program is 
         informed both about the length  and the assembly origin of the actual 
         code.



T4GEN Notes (cont'd):

   b.  T4GEN obtains its actual code by loading a HEX file, assembled to 100h, 
       and determines the program length at that time.   T4GEN then inserts  a 
       relocation bit-map obtained by comparing the HEX file assembled at 100h 
       to an assembly at org 0 of the same source.   Finally,  T4GEN inserts a 
       PRL compatible loader header into the Type-4 module.

   c.  The input HEX files can be generated by assembling the same source file 
       twice,  with both a 0 and a 100h origin.  The source file may have only
       a  single absolute org statement,  all others being relative.   Similar 
       HEX files can  be generated  by linking the  same series of REL modules 
       to *.HEX, with both  a 0 and  a 100h origin.   T4GEN distinguishes both 
       input files  by their <type> extension of *.HX0 (0 org) and *.HX1 (100h 
       org), and it is necessary to rename the HEX files accordingly.



T4GEN Notes (cont'd):

   d.  The use of a pair of HEX files is debatable:  a similar procedure could 
       be devised using COM files.   Some  assemblers  will  not  generate COM 
       files directly,  and require  an additional LOAD conversion step.   The 
       HEX format provides exact code length  info,  which can only be defined 
       in terms of records for  a COM file.   The LOAD  conversion  is readily 
       built into T4GEN.

   e.  The source for a Type-4 program  must conform to  the ZCPR Type-3 or -4 
       format, particularly  with respect  to the  value at  offset 11.   (See 
       discussion  of the  value stored  at this  address  in TYP4LDR.Z80/.LIB 
       comments)
