xLink Documentation

Table of Contents


History

The history of xLink
Version Dated Release notes
1.0 1 Oct. 96 First release (RGBDS)
1.01 3 Dec. 96
  • BANK() didn't work. Fixed.
  • Sections were quite often output in the wrong order. Fixed.
1.02 12 Feb. 97 -s switch and mapfile option added
1.03 23 Mar. 97
1.04 03 July 1997 First ASMotor release. Supports big-endian CPUs as well. Usage changed to allow for different output fileformats
1.05 20 July 1997
  • We can now do range checking on intermediate results in an expression. This is necessary to support different types of CPUs.
  • RGBLink DIDN’T know about the special PC symbol "@" so if you used it more than once per sourcefile in an expression the linker had to resolve, things would go horribly wrong.
1.06 21 September 1997
  • Smart linking and library support added
  • Program renamed to xLink

Usage

    xlink [options] linkfile

Options are preceded by a hyphen (-) and go as follows:

    h         : Short help text
    mmapfile  : Write a mapfile
    t         : Output target:
      tg      : Gameboy ROM image (default)
      ts      : Gameboy Small mode (32kB) ROM image
      tp      : Psion2 relocatable module
    zHX       : Set the byte value (hex format) used for uninitialised data (default is ? for random)

The Linkfile

A linkfile is used to tell xLink which objects to include and what the outputname should be. It is in plain ASCII-format.

    # Linkfile for foobar.gb
      
    [Objects]
    foo.obj
    bar.obj
      
    [Libraries]
    mylib.lib

    [Output]
    foobar.gb

A line starting with # is ignored.

If you use libraries they will only be included if one of the objects actually reference them. This works on a SECTION level and not on a module level. This means that when you write libraries you can put each subroutine in its own SECTION so only the relevant bits are included.

Operation for Gameboy (-tg)

Sections created with ROM0 in the assembler are placed in the GB bank #0 (the fixed bank $0000-$3FFF) in the order they are loaded from the objectfiles specified in the linkfile. So you want the first file in the linkfile to contain your header. ROMX sections are placed in any bank other than #0. This means you have absolutely no control over which sections goes where. This insures minimal slack (unused bytes) at the end of each bank in the image.

Currently the linker doesn't calculate the GB checksums. You must use RGBFix to do this.

Operation for Gameboy small mode (-ts)

Small mode forces all ROMX sections to be of type ROM0 and increases the ROM0 section size from 16kB to 32kB. This also means that ROM0/ROMX sections are written to the final image in the order you have specified on the command line.

Currently the linker doesn't calculate the GB checksums. You must use RGBFix to do this.


Last updated 08 October 1997 by Carsten Sorensen