Classic Computer Magazine Archive COMPUTE! ISSUE 92 / JANUARY 1988 / PAGE 20

Date Stamping ProDOS Files

I do not have a clock on my Apple IIe, so my files are never dated properly when saved to disk. I often have two different versions of the same file with the same date on separate disks. It would be handy if I could tell which file was the most up to date. Could you develop a program which allows me to manually set the date of ProDOS files?

Leslie Gene Hunter

The program below allows you to set the system date on the Apple IIe or Apple IIc without the use of a hardware clock. (The Apple IIGS does not need such a program because it comes with a built-in clock.)

10 HOME : PRINT "SET DATE (ENTER TWO-DIGIT NUMBERS ONLY)" : PRINT
20 INPUT "MONTH : " ;M % : IF M % < 1 OR M % > 12
   THEN PRINT "ILLEGAL MONTH" CHR$ (7) : GOTO 20
30 FOR I = 3 TO 0 STEP - 1 : M % (I) = M % / 2 ^ I :
   M % = M % - 2 ^ I * (M % > = 2 ^ I) : NEXT
40 INPUT "DAY : " : D % : IF D % < 1 OR D % > 31
   THEN PRINT "ILLEGAL DAY" CHR$ (7) : GOTO 40
50 FOR I = 0 TO 2 : D % = D % + 2 ^ (I + 5) * M % (I) : NEXT
60 INPUT "YEAR : " ; Y % : IF Y % > 99
   THEN PRINT "ILLEGAL YEAR" CHR$ (7) : GOTO 60
70 FOR I = 6 TO 0 STEP - l : Y % (I
    ) = Y% / 2 ^ I : Y% = Y % - 2 ^
    I * (Y% > = 2 ^ I) : NEXT
80 FOR I = 0 TO 6 : Y% = Y% + 2 ^
   (I + 1) * Y% (I) : NEXT : Y% =
   Y% + M% (3)
90 POKE 49040, D% : POKE 49041, Y%
   : PRINT : PRINT "DATE SET"

You must run this program every time you boot your computer. If you wish, you may include this code as part of your startup program.

When run, you are asked to enter the month, day, and year using two-digit numbers. To set the date to November 20,1988, for example, enter to numbers 11, 20, and 88. If you make a mistake, simply rerun the program. After the program has been run, ProDOS automatically stamps all newly created or updated files with the appropriate date.