correct return system into the main machine code routines. This obviously requires
knowledge of the compiler’s workings, but it means the code can be jumped to (using
JP (HL) for instance) which is considerably simpler than calling. An alternative
would be to call a fixed address which is known to contain a JP (HL) instruction.
There will almost certainly be one somewhere in the runtimes. In Pascal this
might look something like:
So how do we actually go about loading sections from our overlay file? First we must
define a structure whereby the various code sections in the overlay can be identified.
It would be highly inappropriate to enforce a standard length or standard positions
for the sections, so it will clearly be necessary for the file to contain a reference table
giving the relevant data on the sections. We will probably need the following :
Load address | – | where to put it |
Entry address | – | where to run it from |
File position | – | where in the file to find it |
Length | – | how much to load |
Often it will be useful to have a section of code broken down into several segments
which load at different memory addresses. Obviously there is no reason why these
should not occur contiguously in the file, so we should only need one file position
reference. Load address and entry address cannot really be standardised because
we may well have both major program sections (such as the editor) in the same file
with small re-entrant routines (such as delete line). A possible table structure (the
one I actually used for my PCB package) would consist of:
First Sector Number | – | 16 bits absolute sector |
Entry Address | – | 16 bits absolute address |
Load Address Block 1 | – | 16 bits absolute address |
Length of Block 1 | – | 7 bits sector count + flag |
Load Address Block 2 | – | 16 bits absolute address |
Length of Block 2 | – | 7 bits sector count + flag |