Authors
Publication
Pub Details
Date
Pages
Enhancements to PRO/FILE that are written in machine code can present a problem in deciding where in memory you should keep it. A long addition like Q-SAVE or FASTLOAD will usually be placed either above RAMTOP or somewhere in the 8-16K area of RAM if you have it to use. The biggest drawback to keeping code in these areas is that to place it there conveniently, you must LOAD 2 or even more separate programs before you have PRO/FILE up and running.
With a long enhancement, particularly one that speeds loading time, the extra hassle is justified. But what do you do with a short machine code routine that is indispensable but so short that it hardly seems worthwhile to go through a separate LOAD procedure for just 10 or 20 bytes of machine code?
One place to put it is right in with all your files in the D$ array. Any code you have there will get loaded right along with the program and files. This procedure causes ZX PRO/FILE’s search, add, and edit routines to ignore the first 256 bytes of D$. This makes it possible to safely store machine code there without the risk of accidentally deleting it just by running the program.
Break into the listing by typing SHIFT 1, STOP, and ENTER when the Main ZX menu is on the TV screen. Then type in the immediate mode:
POKE 166701,1 and ENTER
Change line 18 so that instead of printing SPACE OPEN equal to LEN D$-P, it prints LEN D$-255-P.
You also need to change line 504 to:
504 LET L=262+PEEK 16400+256*PEEK 16401
If you run PRO/FILE with 16K of RAM, you will need to reduce file capacity before you can edit line 18. Follow the procedures given on page 40 of the manual or the file reduction method published in UPDATE: Vol. 1, No. 1. Always be sure to free up enough space for any extra BASIC lines you may wish to add.
Then in the immediate mode type:
LET D$(257 TO 277)="*SEARCH IS COMPLETE*"
The computer now starts searching from the 257th character of D$. Machine code that you place in the first 256 characters is safe from being overwritten by data, and it LOADS as part of the program.
Before you make this modification, be sure to take a note of what you have stored in the first 277 characters of D$ because they are forgotten by the computer.
These first few files must be added back to the data base. Also, it is likely that the 278th character of D$ will be somewhere in the middle of a file rather than conveniently at the beginning of one so you’ll need to restore the first file to its original form after the array changes have been made.
Program operation is not affected by this mod. Searching, Editing, and Deleting functions are the same as before. The only indication you have of reserved space is: that SPACE OPEN is less than the original.
Now you can ask, “Why should I go to the trouble of reserving space in DS for machine code enhancements?
Following is one very very good reason.