Next Previous Contents

5. Building a GEOS VLIR overlay application

Large GEOS applications typically don't fit in one piece in their designated memory area. They are therefore split into overlays which are loaded into memory on demand. The individual overlays are stored as records of a VLIR (Variable Length Index Record) file. When GEOS starts a VLIR overlay appliation it loads record number 0 which is supposed to contain the main program. The record numbers starting with 1 are to be used for the actual overlays.

In "cc65/samples/geos" there's a VLIR overlay demo application consisting of the files "overlay-demo.c" and "overlay-demores.grc".

5.1 Building the GEOS overlay application using cl65

This is a simple one step process:

cl65 -t geos-cbm -O -o overlay-demo.cvt -m overlay-demo.map overlay-demores.grc overlay-demo.c
Always place the .grc file as first input file on the command-line in order to make sure that the generated .h file is available when it is needed for inclusion by a .c file.

You will almost certainly want to generate a map file that shows (beside a lot of other infos) how large your individual overlays are. This info is necessary to tune the distribution of code into the overlays and to optimize the memory area reserved for the overlays.

5.2 Building the GEOS overlay application without cl65

First step -- compiling the overlay resources

grc65 -t geos-cbm overlay-demores.grc

Second step -- assembling the overlay application header

ca65 -t geos-cbm overlay-demores.s

Third step -- compiling the overlay code

cc65 -t geos-cbm -O overlay-demo.c
ca65 -t geos-cbm overlay-demo.s

Fourth and last step -- linking the overlay application

ld65 -t geos-cbm -o overlay-demo.cvt -m overlay-demo.map overlay-demores.o overlay-demo.o geos-cbm.lib


Next Previous Contents