2 ProDOS 8 ThunderClock Driver Patch UtilityP Written by Greg Branche Copyright (c) 1991, Apple Computer, Inc. All Rights Reserved: This program allows a user to modify the table of year values stored within the' ThunderClock driver, thereby allowingQ the driver to calculate the correct{  value based on month, day, and day-  of-week. The table consists of seven  entrys, with each entry corresponding  to the year in which January 1st falls,  on the day-of-the-week for that table9  entry.? :m  Instructions and background information  are contained within the program. They  are displayed to the user at the beginning  of the program. : d(21):: turn off 80-col card6 n cu() = cumulative # of days in yearB xCU(12)j fill array with # of days in year CU(1)0: January I212 X CU(I)CU(I1)X I : DN$() = Names for days of week DN$(7) fill array with names of days of week I17( DN$(I)/ I5 :Y  yt() is the year table valuesd YT(7)j ": , Save original prefix 6(4)"Prefix" @PFX$ J: TMOD7(X)(((X7)(X7))7.5) ^: h Display some instructions r |A$ A$""İ900:1000 A$3 (37)21İ900:< 380B :o  Finds position of / within date string X0:On exit, contains position of /, or 0 if none found *I13 4(DAY$,I,1)"/"XI:I3 >I H R: Pause between screenfuls of informationI24:4:" to continue, to exit";:A$_A$(27)ġ:5000yA$(13)ĺ(7):900: get the user's input and convert"Please enter today's date (mm/dd/yy)""-> ";DAY$800: find slash separatorX01080R"Invalid date entered. Please try again.";(7)\$1010. Convert month value to numeric variable8MO((DAY$,1,X1))BDAY$(DAY$,X1)LMO1MO121050:Range check the month value V800:Parse out the current day`X01050Gj Convert day string into numeric value_tDA((DAY$,1,X1))t~DAY$(DAY$,X1)DA1DA311050:Range check the day value Convert year string into numeric valueYR(DAY$)YR0YR991050:Only allow 0-995YR39YRYR1900:40-99 must be 1940-1999cYR40YRYR2000:0-39 must be 2000-2039i:"Please enter the day of the week""(e.g. Wed) -> ";DOW$(DOW$)31270:Must be at least 3 characters"Invalid day of week. Please try again.";(7):12308(DOW$)3DOW$(DOW$,3)i Shift any lower case letters to upper cases B$""~I13A$(DOW$,I,1)((A$)("a")(A$)("z")A$((A$)(("a")("A")))2B$B$A$<IFDOW$B$$P Now convert day-of-week string to numeric value.ZDOW09dI17TnDOW$DN$(I)DOWI:I7[xIkDOW01260q: Calculate the number of days so far this yearDYSDACU(MO) Must account for extra day in leap year(YR4)(YR4)MO2DYSDYS1:H Now calculate the index to use to fill in the tableaIDXDOWMOD7(DYS)1sIDX(IDX10)IDX7IDXIDX7: Now we can fill in the year tableI17XYR1900X100XX100 "YT(IDX)X: store the year into table,IDXIDX1+6IDX1IDX7W@(YR4)(YR4)1660: not a leap yearpJII1: update indexTI71670: if entire array done, exit^YT(IDX)X: duplicate entry for leap yearhIDXIDX1rIDX1IDX7|YRYR1I:$I17:Poke table into memory5767I,YT(I)<I` Now that the table is set up, we can modify the file(s)6:1"You may now insert the disk containing":"the ProDOS file to be modified, then":"enter the location of the disk. You""can enter the location either as the":"volume name of the disk, or by its":"slot and drive location (ESC to exit):""-> ";12:4:958 A$A$"/"2100: input volume name A$"S"A$"s"2200: slot/drive input %(A$)275000: ESC pressed, exitO*(7);:2060:None of the above, try againU2:u3Read volume name from user4A$;:"";PTH$>PTH$"/"PTH$: build full pathnameHI2(PTH$)R(PTH$,I,1)"/"2160:Ensure only volume name is included0\"Please supply only the volume name.";(7)Gf12:4:868:2060NpI_z13:1:958(4)"Prefix "PTH$:Set ProDOS prefix2300:then go modify the ProDOS file:Read volume name from disk in specified drive"S";A$ SL(A$)HSL1SL7ĺ:"Slot number 1-7 only.";(7);:12:5:2210\SL;",D";:958dA$qDR(A$)DR1DR2ĺ:"Driver number 1 or 2 only.";(7):12:8:2250DR:958(4)"Prefix,S"SL",D"DR"  Prefix is now set to the proper volumeN (4)"Bload ProDOS,tsys,a$310,l$3,b$1b": Read P8 2.0 versionX A$""c$ I13r& X(783I)( X127XX128. A$A$(X)8 IB (A$)22400: it's not version 2.0L ADRS3958: location of table within imageV 2600: go write the new tableD` (4)"Bload ProDOS,tsys,a$310,l$3,b$651"Nj A$""Yt I13hv X(783I){x X127XX128~ A$A$(X) I (A$)1.92500: it's version 1.9 "Only ProDOS versions 1.9 and 2.0 may":"be patched by this program."+ "Would you like to try again? ";A$M (A$,1)"Y"(A$,1)"y"2050W 5000 ADRS12918: location of table within 1.9& :' Write the new table out to the file( (4),"BSave ProDOS,tsys,a$300,l7,b"ADRS2 2050(4)"Prefix"PFX$2"Quit to (B)ASIC or (P)roDOS program"G"launcher? ";A$o(A$,1)"P"(A$,1)"p"ĺ(4)"Bye"(A$,1)"B"(A$,1)"b"ė:(7);:5020_:` # of days in each monthj 31,28,31,30,31,30,31,31,30,31,30t Names of days of week*~ SUN,MON,TUE,WED,THU,FRI,SATT Informational text and instructions "This utility allows you to patch an" "internal table used by the ProDOS" "ThunderClock driver. This table is" "used to calculate the current year"+ "for date-stamping files on ProDOS"V "disks, since the ThunderClock does" "not return this information to ProDOS." "The table only holds seven values, one" "for each day of the week. There must"! "be at least one year duplicated within"=! "the table to account for the inter-"g! "vening leap year. Therefore, the"! "table must be updated at least every"! "six years to keep it current. This"! "utility will ask you to enter the""( "current date and day of the week. It"G"2 "will use this information to calculate"t"< "the entries to place into the table.""F "Next, it will ask you to insert a disk""P "containing the ProDOS file to be""Z "modified, and ask you to specify the"##d "location of the disk. The ProDOS"N#n "file must be either version 1.9 or"x#x "version 2.0. The location may be"# "specified as either the volume name"# "of the disk, or as its slot and drive"# "location. The utility will then"&$ "proceed to write out the new table"R$ "entries to the file. When the file"}$ "has been updated, the utility will"$ "again ask you to insert a disk and"$ "specify its location. This can be"$ "continued for every disk that you")% "wish to update. When you have com-"U% "pleted all of your disks, press the"z% "ESC key to exit the utility."% ""