,ll 6.6
,cs 10
,pl 66
,lm 0.2,0.5
,pn 1
,ju
,hd
,ce
OmegaSoft 6809 Cross Linking Loader (V1.0)
,,
,ft

,ce 1
11-##
,,
,ce
OmegaSoft 6809 Cross Linking Loader (V1.0)

,ce
LINKER

The OmegaSoft Linking Loader is a two pass loader which can accept relocatable object modules from the OmegaSoft Relocatable Assembler and the Pascal Compiler. On the first pass all external symbol values are defined, all object modules which are to be loaded from libraries are determined, and the size of each module is determined. At the start of pass two the information obtained during pass one is used to allocate each module into the final output load module and to resolve all inter-module references. All input files are then read again and this information used to produce the load module.

Up to 200 modules may be handled by this linker. The number of global symbols that can be handled is determined by the amount of memory available to the linker.

This linker has the capability of generating either a binary image object file or S records. To generate S records the command line S option must be enabled.

If no start commands are issued then the default is to start allocating code section at $0 and to start allocating data sections right past the end of the code sections. Varib section will start allocating at offset $0.

,ce
COMMANDS

Each command cannot exceed 80 characters. Pass one terminates when the OBJECT command is entered at which point all commands entered during pass one will be repeated and echoed by the linker until the OBJECT command is encountered the second time. At this point entry resumes from the input path for acceptance of the map command (if used) and the exit command. The number of commands that can be accepted up until the OBJECT command is determined by the length of each command, the buffer allows approximately 3000 characters.

All commands except for MAP and MAPOUT may be abbreviated to their first two letters. All commands may be entered in lower case if desired.

The align, start, and end commands may have an optional prefix that is used to specify what section the command is to operate on. For instance, using the start command, the following are possible :

start 1000        - start code section at location $1000
c.start 1000      - start code section at location $1000
d.start 1000      - start data section at location $1000
v.start 30        - start varib section at offset $30
,pg
,ce
COMMANDS

ALIGN - align module start location

syntax : [x.]ALIGN [[\]<hex number>]

This command modifies the current loader location counter. If the '\' is not specified then the location counter will be set to <hex number> + start section address. If the '\' is specified then future modules will be loaded at an even power of two relative to the start of the section. For example : ALIGN \100 will cause future modules to load at addresses xx00 and ALIGN \10 will cause future modules to load at addresses xxx0. This option remains in effect until another ALIGN command is encountered. Using the ALIGN command without an operand will essentially turn off module alignment from that point on. The '\' may be replaced by the '/' if desired.

DEFINE - loader symbol definition

syntax : DEFINE <name> <hex number>

This command defines a global symbol and inserts it into the global symbol table. The symbol is defined as absolute.

END - ending address

syntax : [x.]END <hex number>

This command sets the end load address of the section. If the actual module would be smaller, then the load module is padded with zeroes. The default for END is the last address loaded.

ERRORS : If the module exceeds the END address, then a 'END ADDRESS EXCEEDED' error message will result.

EXIT - exit linker

syntax : EXIT

This command terminates the linker.

HOLE - ship holes in ROM space

syntax : HOLE <start of hole> <end of hole>

This command tells the linker that ROM/EPROM space is not contiguous so that it will not allocate a module in the range of memory specified. The linker uses this information when it assigns the starting address of each module, it will not break up a module to avoid a hole. Up to 20 hole commands may be used in a link.

INIT - initialize binary file

syntax : INIT <byte value>

This command will initialize the binary file to the byte value specified. This is normally used when programming EPROMS where a value of FF would be used to speed programming. This command has no effect on S record output files.
,pg
,ce
COMMANDS

LIB - library search

syntax : LIB <file name1>{,<file nameN>}

This command directs the loader to load object modules in the specified files only if the object module satisfies an unresolved external reference from an object module previously loaded. The file names may be separated by spaces or commas.

ERRORS : A 'MULTIPLY DEFINED SYMBOL' error can result if the same name is defined in more than one loaded module. An 'UNDEFINED SYMBOL' error can result if there is no name definition to satisfy a reference.

LOAD - load file

syntax : LOAD <file name1>{,<file nameN>}

This command directs the linker to load the specified files. There can be one or more object modules in a file. The file names may be separated by spaces or commas.

ERRORS : A 'MULTIPLY DEFINED SYMBOL' error can result if the same name is defined in more than one loaded module. An 'UNDEFINED SYMBOL' error can result if there is no name definition to satisfy a reference.

MAP - print load map

syntax : MAP[U][S][M][D]
         MAPF

This command displays the current state of the modules loaded. The U option will list any undefined symbols. The S option will list the memory size of the modules loaded plus symbol table usage. The M option will list the starting load address of all modules loaded. The D option will list each loaded module along with the external definitions contained in that module. MAPF is equivalent to MAPUSMD.

MAPOUT - map output

syntax : MAPOUT <path>

This command over-rides the load map specification in the command line. Any path valid in the command line redirection is valid with this command.

OBJECT - produce load module

syntax : OBJECT <file name>

This command specifies the output load module produced by the linker. The OBJECT command terminates pass one of the linker, and consequently the start of pass two. The output file is filled during pass two and is closed upon executing the OBJECT command during pass two of the linker. The format of the object file will be determined by the command line S option.
,pg
,ce
COMMANDS

START - starting address

syntax : [x.]START <hex number>

This command sets the starting load address of the section.

VECTORS - vectors are at top of memory

syntax : VECTORS

Normally data section starts after the last module's code section. This is not acceptable when you have a vector file (which must load at the top of memory) since this would imply that data section would start at location zero.

To get around this problem the vectors command will instruct the linker to start data section after the second to the last module's code section, which should be the last non-vector file.

,ce
S RECORD FORMAT

The following is a description of the S record object format produced if the S command line option is enabled. The file is recorded as a text file where each byte of data is represented as two ascii-hex digits. The format of a record is :

+---+---+---+---+---+---+---+---+--/ /--+---+---+---+
|  type | count | addr  |       data        | cksum |
+---+---+---+---+---+---+---+---+--/ /--+---+---+---+

,in 1
,si -1
type   : two ascii bytes, either "S1" or "S9" that describe the type of record.

,si -1
count   : two ascii bytes representing one byte value that is the count of number of bytes in the address, data, and checksum fields.

,si -1
address : 2 ascii bytes representing one 16 bit value. If this is a S1 record this is the address where the data is to be loaded. If this is a S9 record this is the start execution address.

,si -1
data    : zero or more ascii bytes representing zero or more byte values.

,si -1
cksum   : two ascii bytes representing one byte value that is the 1's complement of the sum of the byte values of the count, address (each byte added separately), and data fields.

,in 0
S1 is a data type record. S9 is an execution record.

,ce
EXAMPLES

Using three assembly language modules two different sets of linker commands will be used and the result depicted pictorially.

Mod1 has code size = 452, data size = AE, varib size = 6
Mod2 has code size = 3A0, data size = 28, varib size = 8
Mod3 has code size = 404, data size = 64, varib size = 2
,pg
,ce
EXAMPLES

The commands :   load mod1 mod2 mod3
                 object mod

results in mod looking like :      variable section offsets :

  +-------------+ <- 0             +--------------+ <- 0
  |  mod1 code  |                  |  mod1 varib  |
  +-------------+ <- 452           +--------------+ <- 6
  |  mod2 code  |                  |  mod2 varib  |
  +-------------+ <- 7F2           +--------------+ <- E
  |  mod3 code  |                  |  mod3 varib  |
  +-------------+ <- BF6           +--------------+ <- F
  |  mod1 data  |
  +-------------+ <- CA4
  |  mod2 data  |
  +-------------+ <- CCC
  |  mod3 data  |
  +-------------+ <- D2F

The commands :   c.start 1000
                 d.start 2000
                 v.start 100
                 c.align \100
                 d.align \10
                 load mod1 mod2 mod3
                 object mod

results in mod looking like :      variable section offsets :

  +-------------+ <- 1000          +--------------+ <- 100
  |  mod1 code  |                  |  mod1 varib  |
  +-------------+ <- 1451          +--------------+ <- 106
  |   garbage   |                  |  mod2 varib  |
  +-------------+ <- 1500          +--------------+ <- 10E
  |  mod2 code  |                  |  mod3 varib  |
  +-------------+ <- 189F          +--------------+ <- 10F
  |   garbage   |
  +-------------+ <- 1900
  |  mod3 code  |
  +-------------+ <- 1D03
  |   garbage   |
  +-------------+ <- 2000
  |  mod1 data  |
  +-------------+ <- 20A9
  |   garbage   |
  +-------------+ <- 20B0
  |  mod2 data  |
  +-------------+ <- 20D7
  |   garbage   |
  +-------------+ <- 20E0
  |  mod3 data  |
  +-------------+ <- 2143

The areas marked with "garbage" will be whatever was in the linker buffers in the case of the binary image option unless the init command is used. If the S record option is used then those areas will not have records for them. The same applies to any areas that were allocated due to a RMB directive in the assembler.
,pg
,ce
EXAMPLES

Another use of the align option is to start a module at a certain address to make data fit correctly into EPROMS. Using the above modules, suppose you wanted to fit the code and data from each module into it's own 2K X 8 EPROM (2716 or similar). You could use commands such as :   
                    d.start 0
                    c.start 0
                    d.align 700
                    load mod1
                    c.align 800
                    d.align F00
                    load mod2
                    c.align 1000
                    d.align 1700
                    load mod3

You would then have :

     EPROM 1               EPROM 2               EPROM 3
     (0-7FF)              (800-FFF)            (1000-17FF)

+-----------+ <- 0    +-----------+ <- 0     +-----------+ <- 0
| mod1 code |         | mod2 code |          | mod3 code |
+-----------+ <- 451  +-----------+ <- 39F   +-----------+ <- 403
|  garbage  |         |  garbage  |          |  garbage  |
+-----------+ <- 700  +-----------+ <- 700   +-----------+ <- 700
| mod1 data |         | mod2 data |          | mod3 data |
+-----------+ <- 7A9  +-----------+ <- 727   +-----------+ <- 763
|  garbage  |         |  garbage  |          |  garbage  |
+-----------+ <- 7FF  +-----------+ <- 7FF   +-----------+ <- 7FF

The garbage areas should be initialized to FF's to speed programming using the init command.

In most instances your program will be too large to fit into one EPROM. If the EPROM memory space is contiguous this is not a problem, but if there are holes in the memory space then the linker must be instructed to skip those areas. This can occur if your decoding is setup for a larger EPROM than you can obtain or program. Lets assume that the decoding is setup for 16K * 8 EPROMS, all you have is 8K * 8 EPROMS, EPROM space starts at location $8000, and there is room for 2 EPROMS. You would then actually have EPROM space in the ranges :

 8000 - 9FFF  C000 - FFFF

To instruct the linker to skip the in between areas, you would need one hole command :

?hole a000 bfff

Using the same example, you will need to have a vector file (normally generated by the linkage creator). The vector file must load at the top of memory ($FFF0 - $FFFF) and so we use the VECTORS command to instruct the linker to start data section after to the second to the last module (normally the SE1 file). Example:
?start 8000
?v.start 10
?vect
?init ff
?hole a000 bfff
,ce
EXAMPLES

?load test.pa
?loadp test test1 test2 test3 test4
?lib /dd/xrl specialio
?align 5ff0
?load test.va
?obj test
?exit

Assuming code and data sizes of : FILE     CODE    DATA
                                  test.pa  003A    0000
                                  test     0A3F    0025
                                  test1    070E    0000
                                  test2    0883    0004
                                  test3    0644    0000
                                  test4    066F    0000

You would have :

  +-------------------+ <- 8000
  | test.pa - code    |
  +-------------------+ <- 803A
  | test - code       |
  +-------------------+ <- 8a79
  | test1 - code      |
  +-------------------+ <- 9187
  | test2 - code      |
  +-------------------+ <- 9a0a
  |   FF's            |
  +-------------------+ <- c000
  | test3 - code      |
  +-------------------+ <- c644
  | test4 - code      |
  +-------------------+ <- ccb3
  | test - data       |
  +-------------------+ <- ccd8
  | test2 - data      |
  +-------------------+ <- ccdc
  |   FF's            |
  +-------------------+ <- dff0 (same access as fff0)
  | test.va - vectors |
  +-------------------+

Note that the align instruction (which would normally be a 7ff0) we have used a 5ff0. This is done to keep the vectors within the constraints of a 8K eprom. The range c000 - dfff will also be accessed as e000 - ffff.
