Number 210 - November 2000
Modifying TODAY in SuperCalc 4
by Bob Thomson, Tacoma Open Group for Microcomputers
    Good news for you old-timers who still use SuperCalc as your spreadsheet of choice. In particular, this is for those of us--yes, me too--who have many MACRO-driven spreadsheets that use the TODAY function, and which became partially disabled with the advent of Y2K. I'll tell you how I learned to modify my mid '80s version to allow the TODAY function to work until the year 2100.

    First of all, credit goes to Erich Wagner (ew_ctl@compuserve.com) who gave me detailed instructions on what to do. I ran across his name at a web site dedicated to the SuperCalc TODAY problem. His version of SC4 is an earlier one than mine but his instructions were enough to let me find the solution.

    Here are his comments:
"June 16, 2000 10:37 AM
TODAY Function in SuperCalc
"SuperCalc and Dates:
    SC4 is able to process date values from 1 (1st March 1900) to 73049 (28th February 2100) and values outside this range are invalid. So it can happily work after 1.1.2000 and only the TODAY function stops working correctly after then.
"Y2K Bug:
    When SC4 reads the system date (by issuing a standard Int21 request to DOS) it performs a simple sanity check to see if the date is plausible; months outside the range 1-12 are an error, as are days outside the range 1-31. Unfortunately the year range used is 1900-1999 and so the TODAY function returns an erroneous date now.

    "There is nothing that leads me to believe that this is anything more than merely short-sighted programming and that it can't be easily fixed without nasty consequences.
"The Fix:
    "My fix is to modify the machine code of SC4.COM where the system date is read and checked and change the upper limit from 2000 to 2100. The DOS utility DEBUG allows one to edit and rewrite program code. Before doing this please make a safety copy of SC4.com, for example do this at the DOS prompt in the directory with SC4:copy sc4.com sc4.old

    "Later on you can always recover the old program by renaming sc4.old as sc4.com. The next step is to check that the version of SC4 is the same as mine (sc4 ver 1.0) type this:
debug sc4.com
-u f1 e 1
    "You should see a screen like this:
13A9:F1E1  B42A      MOV  AH,2A

13A9:F1E3 CD21 INT 21
13A9:F1E5 81F96C07 CMP CX,076C
13A9:F1E9 722F JB F21A (upper
13A9:F1EB 81F9D007 CMP CX,07D0 <-(year
13A9:F1EF 7329 JNB F21 (compare
13A9:F1F1 FECE DEC DH
13A9:F1F3 7825 JS F21A
13A9:F1F5 80FE0C CMP DH,0C
13A9:F1F8 7320 JNB F21A
13A9:F1FA FEC6 INC DH
13A9:F1FC FECA DEC DL
13A9:F1FE 781A JS F21A
13A9:F200 80FE1F CMP DH,1F
-
    "(note the 4 digits before the colon on the left column (13A9) will probably be different--it's what's after them that counts). If you see something different then quit debug by typing q and email me. Your version of SC4 is different and I can email you details of how to try to fix it.

    "Otherwise, if you see something very like my screen we can proceed to change the year limit from 700 (=2000) to 834 (=2100) and then rewrite the file SC4.COM and then quit to DOS so you can check if SC4 runs correctly. Type these commands exactly:

e f1 ed 34 08 (use your address instead of f1 ed)
n sc4.com
w 100
q

    "I have done this to mine and one other copy of SC4 without any problems. Please let me know how you get on. If there is a demand I think I could make an automated fixer program to do all the above steps.
    "Erich Wagner, London, UK"

    I tried this but my version of SC4 was later than his and my printout was not the same and, in particular, did not include the CMP CX,07D0 line which is where the date is compared to the upper limit date.

    So he sent me a further suggestion:

    "Try this:
DEBUG SC4.COM
S CS:0 FFF0 2A CD 21

    (with any luck it will display a pair of nos. like 12AA:56E4)
U (that pair of nos. with a colon between them)

    "Send me a screen dump of what you find, please, and I will try to advise. Alternatively you could e-mail me your sc4.com as a file attachment."

    Following this advice yielded a screen dump that indeed did contain the CMP CX,07D0 line as:

119D:CB23 81F9D007 CMP CX,07D0

    So I made a backup copy of SC4.COM, indexed CB23 by 2, and changed the value from 700hex to 834hex as follows:

e CB25 34 08 - there's a space between 34 and 08
n SC4.COM
w 100
q

    When I loaded the modified SC4 and entered the word TODAY in a cell in the blank spreadsheet, today's (year 2000) date was displayed. Yay!! Now all those MACROs using the TODAY function should work until the year 2100. That oughta be long enough!
  Number 210 - November 2000