80-Bus News


Summer 1985, Volume 4, Issue 2

Page 7 of 31

with programs 3, 4, & 5 to create an overlay demo. If you assemble progs 2,3,4 &5. and then enter.


The demo will create itself. It only outputs messages and will not win any prizes but it proves it works.

Program 6 is an overlay loader written in ‘C’. This is the one I use for my GSX tester. It uses ‘C’s pointers to functions that allow you to call things like overlays at absolute addresses and pass parameters to them if necessary. Don’t worry if it all seems like gibberish as ‘C’ can sometimes confuse, it performs in the same manner as the assembler version.

Using L80 to create overlays

There is to my knowledge no facility for creating overlay systems from within L80. it can be done but is somewhat complex and should be avoided. You have to hack the code around a lot in memory and I don’t like having to admit that I have done it this way on occasion.

The basic principle used here is that you load the root module into memory, and then you load an overlay in at a predetermined address. All global references will now have been resolved. You now exit L80 having saved the program. Using Gemdebug, ZSID or DDT you take the program file and move the overlay code down to 100H and SAVE it as a separate file. Messy but it works. May I suggest at this juncture that while you are messing about with the overlay, you create overlays that are compatible with the LINK format (see previous for details).

Using the sample assembler programs lets create the programs using L80.

1. Assemble all programs to REL format.

2. Enter the following: L80 <RET> Run L80

ROOT, OVLAY<RET> Load root module and overlay loader

At this point you will see where the top of the root module is by looking at the Data readout from L80 (in this case it is 01BE). We have to decide where the overlay base is to be. Lets put it at 200H and keep things nice and simple. To do this enter:

/P:200<RET> Meaning load next bit at 200H. OVICRET> and load in the 1st overlay.

ROOT/N/E Save ROOT.COM and exit.

Now we have to create the overlay from the COM file using a debugger. I have used Gemdebug to create LINK lookalike overlay files. This is how it is done:


F100, 1FF,0 Fill 256 byte header with 0’s

Now move the overlay section down to 200H using the M command. In this case we have been lucky as the overlay was originally loaded into 200. If it had started at 0760H for example we would have to enter:

M760, 800 , 200<RET>

assuming that the overlay code finished at 800.

To maintain LINK compatibility we now have to insert the information concerning the length of code and the base address. To do this use the ‘S’ (set) command to insert the details. Our overlay is 12 bytes long and its base is at 200H. We set 101 and 102 to 12 and 00, then 107 & 108 to 00 and 02.

We now have a .OVL file in memory and we are ready to save it, enter:

SAVE 2 0V1.0VL

and the process is complete. Repeat this for OV2.

Now create the economy version of the COM file by entering:


and its all ready to go.

Not very pleasant is it? It involves a lot of effort and no mean amount of Hex arithmetic to calculate the sizes of the files for the move and save commands. As all this is done for you by the LINK program may I suggest again that you go out and get it and avoid the above.

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 7 of 31