;
                                M2Z3INS.COM                                   

             Size (recs) CRC   Version    Author/Latest Issue      Disk
              19k (150)  5AF6  1.0        Ed Jackson 10/87         Z3COM6

  1- Usage  2- Notes                                                          

   M2Z3INS  "installs" Turbo Modula2 programs which have been linked into .COM
files in a ZCPR3 environment, ZCPR3.3 environment,  or CP/M environment.  This
is accomplished by patching the GetEnv procedure which MUST be included in the
root  segment of the TM2 .COM file.   A subsequent call to this procedure will 
return the address of the resident environment descriptor or, for CP/M,  a NIL 
address and  a string of  up  to 16 characters.   The string is intended to be 
used as a file name for TCAP information but can be used for any other purpose
desired.

   M2Z3INS  is written in Turbo Modula2.   The basic approach was suggested by 
Steven Cohen.
:1


   Usage:

   To use  the installation  program  you MUST include the GetEnv procedure in 
your TM2 code.  Compile  the code and link it  into  a  .COM file.   After the 
installation  process, a  call  to  GetEnv  will  return  the  address  of the 
environment descriptor and the 16 char string.
:2

M2Z3INS Notes:

   a. In ZCPR3.3 systems  the  TM2  program becomes self adapting...  that is,
      after  installing it  with the M2Z3INS  program  it can  be moved to any 
      ZCPR3.3 system and it will correctly find the environment descriptor.
      In a ZCPR3.3 environment the address of the environment descriptor is 
      placed in register HL by the loader after loading the .COM file.  The 
      .COM file is patched by this installation program so that register HL is
      saved in the GetEnv procedure.

   b. In  ZCPR3.0  systems the TM2 program  must  be  reinstalled if  moved to
      another  computer  to   guarantee  that   it  will  correctly  find  the
      environment descriptor.  In  a  ZCPR3.0 environment  the address  of the 
      environment descriptor is obtained from the  *.ENV file that is peculiar
      to the target system.


M2Z3INS Notes (continued):

   c. In CP/M systems there is,  of course,  no environment descriptor but the 
      installation  program  permits installing  a 16 char string  in the  TM2  
      program.   M2Z3INS patches the environment descriptor address to NIL and 
      the  16 char string to the value specified  at installation  time.   The 
      intended use  of the  string is to install the name of a file containing
      system environment info (TCAP?),  but its use is not restricted.   Where 
      an environment descriptor is available, the 16 char string is empty.

   d. The system works  by searching the  TM2 .COM file 1 char at a time for a 
      unique marker (don't  be surprised if  it  takes rather  a long time  on 
      floppy  disks!).   Just  after the marker,  the .COM file  is patched to 
      insert the address of  the resident environment descriptor and a 16 char
      array.

   e. Since many ZCPR systems place the environmen descriptor at  0FE00h, this 
      is used as the default value in GetEnv.
