Classic Computer Magazine Archive ANTIC VOL. 4, NO. 12 / APRIL 1986

VERSION SAVER

TRACK ALL YOUR PROGRAM REVISIONS AUTOMATICALLY


BY DONALD WAHL



For those BASIC programmers who can't keep track of which version of code they're working on, we present V-Saver. Append V-Saver to any BASIC program In progress. Each modified version of your program will be saved with an incremented version number added to the filename, and the date and time will be included in the code. Works on any 8-bit Atari, with disk or cassette.


Most programmers develop a habit of SAVEing intermediate versions of a program under development. Making copies of your program every half-hour or so could prevent immense frustration and wasted time if a power failure or similar mishap occurs.
   But with all these different SAVEs, it's hard to keep track of which version you are working on, or what filename to use next. Using the same name over and over is no good because sometimes it is necessary to go back to a previous version and start again.
   The solution: Let your computer do the work. V-Saver will keep a record of which version of your program is active, and decide what filename to use next. It will also, optionally, put a date and time stamp in the program.

TYPING THE PROGRAM
Type LISTING 1, VSAVER.LST, check it with TYPO II, then LIST a copy to disk by typing LIST "D:VSAVER.LST". Because V-Saver will modify itself each time it is RUN, be sure you have a disk copy before trying it out.

USING THE PROGRAM
After you have begun to create a new program, merge V-Saver to it by typing ENTER "D:VSAVER.LST". This will append a 12-line BASIC program to your own program in lines 31499 to 31600. As long as you don't use any line numbers in this range it will not interfere with your own program.
   When you are ready to save a copy of your program type GOTO 31500 [RETURN] in the immediate mode (no line number). You will be prompted for a date and time in the following format: 09/13/85 06:00. You may also choose not to type in this information.
   Press [RETURN] and V-Saver will modify itself to include the new date/time (if you added it) and a version number. It will then save itself, along with your program, under a new filename.
   V-Saver is set up to create files called, TESTPROG.VS#, where # starts at 0 and increases by 1 each time your program is SAVEd. After 9 is reached, V-Saver will reset the version number to 0. To see the current filename and date, type LIST 31570,31575 [RETURN] from immediate mode.
   The V-Saver program only needs to be ENTERed once and it will remain in your program until removed. It can be removed at any time by typing GOTO 31590 [RETURN] from immediate mode. When the final version of your program is ready, type GOTO 31590 [RETURN] then SAVE your program under its final name.

PROGRAM TAKE-APART
The normal mode of operation for Graphics Mode 0 is for the editor device (E:) to read from the keyboard and write to the screen using IOCBO.
   By changing bit 0 of IAUXl in IOCBO we can force the editor to read from the screen. The net result is the same as the result of repeatedly pressing the [RETURN] key. This is often referred to as "forced read mode." VSaver modifies itself by printing the new lines on the screen, then entering the forced read mode.
   Line 31499-Protects your own program from falling through to V-Saver.
   Line 31500-Establishes a Graphics 0 screen.
   Line 31510-Gets date and time from user and prints it on the screen. If you don't want a date/time stamp, leave this line out. The line also clears all strings and variables which could cause problems during debugging. If you want to examine your variables after a trial run you'll have to do it before RUNning V-Saver.
   Line 31520-LISTs the current file name from line 31570 on screen and positions the cursor over the version number. Changing the POSITION 26,3 statement will allow different file name lengths. If you use 3 fewer characters in the file name, then change 26 to 23.
   Line 31530-Determines the character under the cursor held in address 93, and checks whether it is numeric. The values in the range check, 16 to 25, are the internal codes for the numbers 0 to 9. You can change these to allow any range of single character numbers or letters to be used.
   Line 31540-Increments the version number and stores it in the cursor save location. Resets the number to minimum value if maximum is met. If you changed the internal codes in line 31530 then put your high and low values here also.
   Line 31550-Sets up forced read mode to input new lines 31570 and 31575 and starts it with POKE 842,13.
   Line 31560-Stops forced read mode.
   Line 31570-Saves file under new file name.
   Line 31575-Date and time.
   Line 31590-Establishes a Graphics 0 screen and prints the line numbers needed to delete V-Saver
   Line 31600-Prints the last line numbers and POKE 842,12 to stop the forced read mode then starts a forced read mode to actually delete V-Saver.

RENUMBER UTILITIES
If you use a renumber utility, LIST lines 31570 and 31575 to disk (LIST "D:VLINES",31570,31575). Then delete VSAVER by typing GOTO 31590. Renumber your program. Finally, reenter VSAVER (ENTER"D:VSAVER. LST) and lines 31570 and 31575 (ENTER"D :VLINES).

Donald Wahl of Dunkirk, Maryland is making his first appearance in Antic.

Listing 1   VSAVER.LST Download / View