EOS DATE STAMPING
by Alan Neeley
The ability to stamp the date on files being stored in a computer is a very useful feature. It provides the user with a method of going back and determining when a file was created or the last time it was edited. The latest versions of TDOS have this feature (besides keeping track of the DATE and TIME when the file was created, TDOS also keeps track of when it was last accessed). The ADAM's EOS also has date stamping capabilities. Most ADAM owners know little about them or how they can be made use of. This article is for those readers who want to learn more about date stamping and how it can be made use of in the EOS.
Even though the provisions for EOS date stamping have always been there, Coleco never took advantage of them in their programs. Any application program that makes use of the EOS file saving routines in a conventional manner could take advantage of this feature if only a method of setting the current date had been provided. Coleco could have easily introduced a program that would allow for setting the current date (or SYSTEM DATE) and then boot any other application program - but they didn't.
There are a couple of commercial programs available that can provide the function of setting the system date and then booting another program. AJM's Hard Disk program can do this and so can Trisyd Video Game's SmartClock software. It takes a program such as FILEMANAGER (another AJM product) in order to read the date that has been stamped in each file entry.
Each file stored in a standard EOS environment has a 21 byte entry in the EOS directory. The last three bytes of each entry is reserved for date stamping purposes (for more information on this type of directory, see my article on the ADAM EOS directory presented way back in issue #2 of this publication). There is also a 3 byte address reserved In EOS memory used specifically for date stamping. The three addresses are 64992, 64993, and 64994. The EOS file saving routines are designed to take the data found in the reserved addresses and insert them into the last three bytes of the current file entry being stored in the directory.
EOS date stamping is rather limited (especially compared to the date stamping features offered through TDOS). There are only 3 bytes reserved to store the information to. This allows room for only the day, month, and year to be stamped Into a file entry.
The way the date is arranged in the three reserved bytes in memory is not critical. The programmer/user could start with the month in the first byte, the day in the second, and the year in the third, or any other pattern that they desire. Another thing that must be decided is which base system should be used to represent the date info: hexadecimal or decimal. AJM's hard disk and Filemanager programs use a hexadecimal format with the year in the first byte, the month in the second, and the day in the third.
DATE STAMPING WITH SMARTBASIC
SmartBASIC can take advantage of EOS date stamping with the help of a couple of BASIC programs (or the commercial programs previously mentioned). Any file that is created using the SAVE or BSAVE commands will have the current system date added to its file entry in the directory. Unfortunately, The OS commands used to create sequential or random access files in basic will not have the system date stamped in their file entry (See the SmartBASIC WorkSHOP on Random Access files in Issue #17 for an idea on how the date can be stamped on these kind of files).
Before starting to make a BASIC program to take advantage of the EOS date stamping features, the programmer must decide what type of format they are going to use. The program I've put together for this workshop will use the same format used by the AJM programs in order to keep things standardized.
Being that SmartBASIC works under the decimal number system, some routines are needed for converting back and forth between the hexadecimal and decimal number systems. The following two small programs demonstrate how this is done.
Now let's take the routines we have above and work it into a program that will set and read the system date. This program is simple yet it provides a great example of how to make use of date stamping in SmartBASIC. Try modifying the program to your own liking. A nice addition would be to add the capability of having a hardware clock set the System Date automatically.
The program requires that you enter only the last two numbers for the year (91 not 1991) and that numbers be used to represent the month (2 not FEBRUARY).
One thing the above program listing does not do is read the date that is actually stamped to each file entry In the directory. It would take a considerable amount of programming to accomplish this feat. I will try to work on it and possibly will include it in a future issue. For now, I would recommend using a program such as FILEMANAGER for reading the dates in each file entry.
From the Jan-Jul 1991 issue of The ADAM Informant, SmartBASIC Workshop (Intermediate Programming Level), p. 9-10. OCRed and spellchecked by Scott Gordon. Republished with permission by The ADAM Resource.