LINKZ80(1)                                                          LINKZ80(1)



NAME
       linkz80 - ALDS Z80 linker

SYNOPSIS
       linkz80 options filename[.ext]


DESCRIPTION
       The linker reads filename.rel or filename.cmd and creates object output
       filename.hex (absolute object) filename.map.  The linker may  create  a
       globals file filename.gbl if there are global symbols in the link.

OPTIONS
       -x  causes the linker to output a cross reference of addresses into the
       map file.

       -s causes the linker to output a symbol  table  listing  into  the  map
       file.

       -m causes the linker to output a psect table listing into the map file.

       -l re-directs stdout/stderr output to a file filename.log,  which  con-
       tains pass complete messages and each line with an error.

       -p directs the listing file, if produced, to be printed upon completion
       of the link.

       -d will delete the listing file, if produced and printed, after  print-
       ing is complete.

       -e  will  print  the listing file ONLY if errors were not produced. The
       use of the -e flag automatically elects the -p flag.

       -f will cause ALL symbols, referenced or unreferenced to be printed  in
       the cross reference.

       -i  will cause the linker to 'mail' an appropriate message upon comple-
       tion or termination of the link.

       -t will cause the linker to format it's map output for 80 column print-
       ers.

       -z  will cause the linker to output xenix format object code which con-
       sists of just pure binary, no headers, defs' filled with zeros.


ENVIRONMENT
       The setenv variable may be used with the linker allowing the  files  to
       be  INCLUDEd or LOADed by a one word environment variable.  As an exam-
       ple, you may have a directory (say /x/y/z) in which you  have  normally
       included  files.  Then  in  your .cshrc or .login file, you may wish to
       place

             setenv EQU '/x/y/z'

       Once done and it becomes part of your environment,  you  can  state  in
       your linker command file:

            INCLUDE   'EQU:file'

       The  linker  will  pick  up  the  "EQU"  variable  and  expand  it into
       "/x/y/z/file".


Linker Command File
       The linker command file is set up to issue commands to the linker as to
       what  files to link, as well as some commands to execute.  Each command
       must appear on a line by itself.  File names must be enclosed in single
       quote marks.  The following link commands are supported:


CODE
ORG
       Set  the  current program counter to the code/org address.  The address
       may be a simple hexadecimal value, label, or a complex expression.  The
       expression evaluator is set to handle:
       +    addition
       -    subtraction
       *    multiplication
       /    division
       $    current program count
       <    shift left
       >    shift right
       |    arithmetic or
       ^    arithmetic xor
       &    arithmetic and
       ()   parenthetical expression

       The  expression  evaluator  can lookup previously defined PUBLIC labels
       and use the value in the expression.  For example,

            CODE OVERLAY+(5*2)

       is perfectly acceptable as long as OVERLAY has been previously defined,
       either from a previously read in relocatable or global file.



INCLUDE ''
       This  is  used  to include a GLOBAL file and put it's contents into the
       symbol table.



LOAD ''
       This is used to include a relocatable file for linking.


DPAGE 
       Causes the linker to put the program counter on the next modulo 
       boundary.   may be the letter 'P' for next 256 byte boundary, or
       it may be a complex expression.


DEFINE 
       Used to define a label and it's value.  This is  quite  useful  if  you
       wish  to  define  a  buffer  at the end of a program link or define the
       value(s) of some variable(s). An example would be:

            DEFINE    BUFFER    $
            DEFINE    BUFFER1   $+10

       which would define the variable BUFFER at whatever the current  program
       counter  is,  BUFFER1  at  the current pc plus 16 bytes.  Using DEFINE,
       there is NO WAY to alter or add to the program counter.



FILL 
       Instructs the linker to  fill  define  storages  (defs)  with  .
        may be any expression.



END [transfer address]
       Tells  the  linker  that  we  are at the end of the link.  The optional
       transfer address may be a simple value, label, or complex expression.
NOTES
       The linker will attempt two opens of a file.  If  unsuccessful  on  the
       first  attempt,  it will alter the upper/lower case of the file name to
       its counter part and attempt a second open.

       The linker will attempt to open any .gbl file with the file name speci-
       fied.  Should the attempt fail, the linker will attempt another open of
       the same file with /usr/include/ prefixed to the filename.


LINKER DEFAULTS
       -    object code produced
       -    no psect map
       -    no symbol table listing
       -    no cross reference listing
       -    warnings and error messages to stdout


FILES
       *.rel                Z80 alds relocatable files
       *.hex                Absolute object output file
       *.map                Listing output file
       *.gbl                Global output file
       *.log                Log output file
       /usr/local/linkz80   Actual linker program

SEE ALSO
       For a description of the language, see the Model II ALDS Manual.

       svcnum (3)           Globals file of SVC numbers
       sysgbl (3)           Globals file of system equates

AUTHOR
       Ron Light, Tandy Systems Design

BUGS
       The expression evaluator used in the linker forces all  numeric  values
       to be hexadecimal.



                              Version 15 Jan 1986                   LINKZ80(1)