A&B Computing
1st December 1988Categories: Description: Utility
Author: J. Rawlinson
Published in A&B Computing 5.12
Another useful utility - enabling Beeb owners to partially load files
Partload
If you write programs in neat modular blocks, one of the benefits you will appreciate is that bits of one program can be used in others; saving time and effort re-writing.
However, a frequent problem, is that you are left with a program in memory that requires a group of lines from another program inserting at a specific point in it.
The official way around this, is to SAVE your program, LOAD the other program, delete the bits you don't want, then *SPOOL it to disc, LOAD back in the first program and *EXEC the spool file.
This all takes quite a lot of time, and, of course, only works if you have got the line numbers right; any lines with the same numbers as those in the spool file will be replaced.
So if you also want to keep your programs looking neat, you must also renumber the program.
Partsave and Merge commands have been written which remove the need for spooling and execing. However, they do nothing about the need to get the line numbers correct. In the accompanying listing, I present my solution to the problem. This is the new OS command *PLOAD with the syntax:
*PLOAD [line no 1] [file name] [[line no 2]] [[line no 3]]
This will take lines from [line no 2] to [line no 3] from the file [file name] and insert them into the program in memory at the point [line no 1]. The final two parameters are optional and will default to the first and last lines in the file.
Running the program in the listing will save the necessary machine code program in the file PLOAD, this can then be called up by typing *PLOAD with the necessary parameters.
The code is assembled to load just under HIMEM; this means that you should produce your PLOAD file in the screen Mode that you usually use for editing programs. The program could be very easily converted to run elsewhere in memory or from Sideways RAM/ROM. PLOAD gives error messages if you get the syntax of the parameters wrong, give an incorrect file name or run out of memory.
After using PLOAD, you can end up with a program in which all the lines are not in order. This is no great problem, and can be quickly fixed with a renumber command. Notice that this renumber is much much simpler than the renumbering that a merge command will require you to do.
This article was converted to a web page from the following pages of A&B Computing 5.12.