Scor­pio News

  

July–September 1988 – Volume 2. Issue 3.











Page 15 of 39











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 addresswhere to put it
Entry addresswhere to run it from
File positionwhere in the file to find it
Lengthhow 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 Number16 bits absolute sector
Entry Address16 bits absolute address
Load Address Block 116 bits absolute address
Length of Block 17 bits sector count + flag
Load Address Block 216 bits absolute address
Length of Block 27 bits sector count + flag











Page 15 of 39