Overlays using .SPR files

The DRI utility LINK.COM1 supports the generation of overlay files2, but the linker tells the lack of two labels, namely ?ovlay und ?ovla0. These are two entry points belonging to the PL/I run time library. An alternative source was represented in the public domain, SIG/M Vol. 2363. (Later on I obtained the PLILIB.IRL library, containing the missing module4).

Starting with CP/M I didn't know the SIG/M source and the manner, which parameters are passing to the PL/I module. Therefore I was looking for another solution. I decided to use the PRL respectively the SPR format as created by LINK.COM. For the implementation I utilized SPR modules, created by the command “LINK file [OS]”.

I wrote two utilities and the actual load routine used for loading the required module from an overlay file.

Description of the utilities and the load module:

NameInvocationDescription
PRL2OVR PRL2OVR prl_file [ovm_file] This utility reduces the header of an .SPR file. The size of the header is originally 256 bytes und containes the length of the program code only. PRL2OVR copies the first 128 bytes of the header and appends the program code.
OVLBLDPR OVLBLDPR [-] ovr_file list_of_ovm_files This utility builds the entire overlay appending overlay modules. Furthermore it creates a text file holding the length and the start record of each module. This file may be inserted into the main file (e.g. by INCLUDE). The option “–” disables the creation.
LDPRL Divers parameters The main program calls this routine to load an overlay module into memory. Within the assembler source the symbol LODOVL must be declared EXTERN. The parameters will be discussed more detailed beneath.

Description of parameters transferred to the module LDPRL:

Invocation
ParameterTransfer in registerDescription
Start record L Defines the record starts with in the overlay of the module to be loaded
Length of module H Defines the length of the module to be loaded in the overlay
External table ^BC Address of a table which allows access to external routines
Load address and FCB ^DE Address of a parameter block holding
  1. Pointer to the File Control Block of the overlay
  2. First free memory address for loading the module
Return
ParameterRegister/Carry flagDescription
Result Carry If an error occurs the C flag will be set
Load address ^HL Real load address, starting at a page boundary (0xPP00)
End address ^DE First free address after module code

Structure of an overlay module:

The first byte of the overlay module defines whether external routines will be used or not:

No external routinesUse external routinesDescription
       NOP
       JP   START
       JP   EXT_1
       JP   EXT_2
        ...
       JP   EXT_n
       NOP
START:..........
  1. A NOP as first instruction indicates that the following code may be loaded directly.
  2. If the first instruction is a “JP addr” then all following JP instructions will be treated as external jumps until a NOP will be found. The addresses of the JP instructions are relative ones concerning the external table passed in register BC.


1. The manual describes the function of LINK.COM in detail
2. Appendix E describes the creation of overlay files on detail
3. SIG/M (Special Interest Group/Microcomputers), a part of the Amateur Computer Club of New Jersey, used to compile public-domain software into disk volumes for regular release. The SIG/M disk set was started in 1980 and volumes 000 up to 310 may be found here.
4. The PL/I package consists of pli80_13 (contains PLILIB.IRL) and plm80x80 (contains PLMLANG.DOC (PL/M-80 Language Summary)). I disassembled the load module which will be found here.

Werner Cirsovius 1989, compiled August 2009, upgraded November 2012