PAST1991.DOC January 29, 1989 For the AT&T PC6300. A solution to the problem of operation with dates beyond 12/31/1991. [For AT&T/MS-DOS 3.2 rel 1.02] The AT&T PC6300 uses a MM58174 clock/calendar chip as the basis for its real time clock and calendar. When using AT&T's release of MS-DOS (or some shareware/PD patches for generic MS-DOS or PC-DOS) this chip provides the date and time information upon boot, for file date/time stamping and for other software programs. The MM58174 chip does have several limitations. The most notable is it keeps track of the years with a 3 binary bit counter. This means that the clock chip is useful over a range of 8 years. The end result is that the standard AT&T PC6300 with AT&T's MS-DOS has been able to support dates in the range of 1/1/84 through 12/31/91. An attempt to set the system DATE outside this range will fail. This note will present a solution to this problem for AT&T's MS-DOS 3.2 (rel 1.02). The effect of the solution is to shift the permitted 8 year range to 1/1/88 through 12/31/95. The following actions will accomplish this. It involves changing 2 bytes in the file IBMBIO.COM, one of the "system hidden" files that load at boot and control operation of the PC. These results have been tested and found to work (report the correct day/date) in response to the DOS DATE command, GWBASIC DATE$ function and command, TURBO BASIC DATE$ function and Command, Word Perfect 4.2's Shift-F5, 1 date command, files saved from WordPerfect 4.2, file creation with DOS Interrupt 21h Functions 3Ch and 5Bh, get and set date with DOS Interrupt 21h Functions 2Ah and 2Bh, DOS DIR command, files created by DOS's COPY CON "FileName" method of file creation, Borland's REFLEX, Leading Edge Word Processing, QUATTRO, and SuperCalc 4 among others. (It will not solve the date issue with software that goes directly to the hardware or ROM BIOS routine for the date, but little real stuff appears to do this.) WARNING: THESE ACTIONS HAVE BEEN TESTED ON A PC6300 USING AT&T'S MS-DOS 3.2, REL 1.02. THEY MAY NOT WORK WITH OTHER RELEASES OR VERSIONS. DO NOT APPLY THEM TO YOUR ORIGINAL SOFTWARE DISTRIBUTION DISKS, ONLY DO IT TO A COPY. BACK UP YOUR HARD DISK DATA FILES FIRST. USE THIS AT YOUR OWN RISK. IF you get different results with the DEBUG commands you did something wrong or this procedure may not work on your system. Proceed cautiously at your own risk. Note also that this patch might cause a problem with some virus detection schemes which depend on testing the sum of bytes in the system files. However the principles discussed in this paper can help an adventurous person reasonably knowledgeable about PC's and ASM patch other releases. THE STEP-BY-STEP: Note: Text enclosed in quotes ("") is intended to be entered at the keyboard, do not type the quotes, just what is in them. Text in <> refers to a key on the keyboard. 1. Back-up your hard disk(s). 2. Format a floppy diskette with the /s switch to make it a bootable disk with the system files on it. Also, copy SYS.COM from your DOS files directory or disk to this floppy. 3. If you have a byte editor like NORTON UTILITIES or PCTOOLS that will let you do low level byte editing of disk files, including hidden and system files skip to paragraph 16 below. ---------------------------------------------- If NO NORTON UTILITIES or PCTOOLS: 4. Copy DEBUG.COM and CHMOD.COM from your DOS files disks or directory. (They are among the files on your distribution disks for MS-DOS.) 5. Note: while using DEBUG you can quit at any time by selecting "Q" at the debug prompt. Things are not final until you write the results to disk with the "W" command. 6. Place the floppy in drive A:, change to drive A: and at the A:> prompt type "CHMOD IBMBIO.COM -R -S -H" followed by pressing the key. (This makes it possible to edit the system file.) 7. Now load the file for editing by typing "DEBUG IBMBIO.COM" at the DOS prompt, followed by the key. You should soon see the DEBUG PROMPT, - (a dash). Note: in the following steps be sure to use the Zero key, not the oh key. 8. At the DEBUG prompt type in "RCX" followed by key. You should get a report of the contents of register CX, which is the length of the IBMBIO.COM file, in hex notation. For my DOS 3.2 rel 1.02 it was 43FA. Write this down and then press with out pressing any other keys. (If you press another key it will change the value in CX, you do not want this!) 9. At the DEBUG prompt type in "S 100 L 43FA B5 05" followed by pressing the key. This will report the location of the byte sequence B5 05 in the file. For 3.2 rel 1.02 it gives 4 locations: xxxx:0FEC xxxx:108A xxxx:2ABD xxxx:2EB1 Write down the first 2 locations. (Note, the xxxx will be four digits, all should be the same, you need not record these.) 10. Now we will patch the first two locations. At the DEBUG prompt type in "E 0FEC" followed by the key. The line will become: -E 0FEC B5. TYPE in "6A" and press the . The line will continue: -0FEC B5.6A 05. Type in "0B" and press key. This will return you to the DEBUG prompt. 11. At the DEBUG prompt type in "E 108A" followed by the key. The line will continue: -E 108A B5. Type in "6A" and press the . This line will continue: -E 108A B5.6A 05. Type in "0B" and press the key. This will return you to the DEBUG prompt. 12. This concludes the patch, now save the modified file by typing at the DEBUG prompt "W" and pressing the key. The computer will write the modified file to the disk drive and report writing 43FA bytes to you and then return to the DEBUG prompt. 13. At the DEBUG prompt type in "Q" and press to return to DOS. 14. At the DOS prompt type in "CHMOD IBMBIO.COM +R +S +H" followed by the key to restore the hidden, system, read only attributes of the file. 15. Now Jump to paragraph 20 below. ---------------------------------------------- Users with NORTON UTILITIES or PCTOOLS: 16. Using your byte level editor, such as NORTON UTILITIES or PCTOOLS, (The following script is based on NORTON UTILITIES). select the file IBMBIO.COM from disk drive A:. 17. Search for the byte string B5 05 in the file. It should appear in 4 locations, at offset 3820 (EECh), offset 3978 (F8Ah), offset 10685 (29BDh), and offset 11697 (2DB1h) in the file. Write these locations for reference. 18. Restart the Search (of byte string B5 05), but this time change the first B5 05 to 6A 0B at offset 3820 (and write the change to file). Also, change the next B5 05 (at offset 3978) to 6A 0B and save that. (Do NOT change the remaining locations.) 19. Exit the program. 20. Now if you are sure you followed the above script correctly, reboot your system from the floppy disk. The DATE function of DOS should report a day exactly 4 years in the future. (If today is 1/29/91 and your date was set for this before the change you should now get 1/29/95.) Set the correct date. 21. Put the new file on your hard disk USING THE SYS COMMAND: A:SYS C:\ (Not the COPY command -- the copy command does not handle the Read Only-Hidden-Sys file attribute, and it is possible that the files will wind up at the wrong place on the disk. (IBMBIO.COM and IBMDOS.COM must be in the first sectors of the disk) Also, put the updated system file on all your boot diskettes. Any disk without a patched date version of IBMBIO.COM will report the incorrect date (off by 4 years) in response to calls for the system date. (However the DOS DIR command will still report file creation dates correctly.) WHY DOES THIS WORK? First some background. Per the MS-DOS ENCYCLOPEDIA (By Microsoft Press), MS- DOS supports an internal real time date range of 1980 through 2099. This is implemented in a variety of ways in hardware, depending on your system. However within the MS-DOS function and Interrupt schemes the year of the date will appear in one of several ways: As the number of days measured from a base date. (This is the value returned in register CX by INTERRUPT 1Ah on the AT&T PC6300. The IBM PC BIOS used INT 1Ah differently.) As the number of years from 1980. (This is the value of the five most significant bits in file date stored on disk and used by function 57h to INTERRUPT 21H to get/set file date.) As a binary number in the range 1980 through 2099. (This is used by functions 2Ah and 2Bh to INTERRUPT 21h, to get/set system date.) The clock/calendar chip in the PC6300 provides it's date information as BCD (binary coded decimal) data read from the 16 registers of the chip. For example the year is read as the low three bytes of port 7Fh, the months is read in two parts. The tens from the least significant bit of port 7Ch and the units as the least significant 4 bits from port 7Bh. Although is possible to read the clock chip directly this is not usually done. In "well behaved" applications the MS-DOS functions are use to get date/time information to assure portability of the application from one hardware system to another. In the PC6300 this portability is achieved through a two step process. First the ROM BIOS (current version is 1.43) includes routines that set and read the clock chip. In the AT&T PC6300 the ROM BIOS routine (INT 1Ah) accepts date input as an offset in days, the number of days measured from January 1 of leap year (any leap year) and converts this into the year/month/day information needed to set the clock. It also reverses the process, converting the BCD information read from the clock into the number of days from the base leap year. Note that this can only cover a range of 8 years from the base leap year. This offset from 1/1 of the base leap year is then converted to the appropriate date by the operating system software, MS-DOS. To simplify things a bit - the MS-DOS operating system is composed of 3 files, COMMAND.COM, (the command interpreter that converts things we type at the DOS prompt into computer actions), IBMBIO.COM, and IBMDOS.COM. These last two are "hidden system files" that do much of the work. IBMBIO.COM provides the communications between the BIOS (and hardware) and is tailored by the computer manufacturer to provide an I/O bridge between his system and standard DOS kernel. IBMDOS.COM in turn provides the DOS kernel and applications manager functions. Now, recall we said that Microsoft's MS-DOS operates dates based on 1980 as the beginning of time, that the PC6300 clock/calendar and ROM BIOS use a leap year as the base for an 8 year span of computable time, and that the PC6300 with AT&T's MS-DOS operated over the interval 1984-1991. It is the system program/file IBMBIO.COM that selects the base leap year for the AT&T PC6300 as 1984 and performs the date conversions. In this case adding (or subtracting) the 4 year offset from the AT&T base date of 1984 to convert to the MS-DOS base of 1980 and back. The IBMBIO.COM file reads the PC6300 clock/calendar chip using INTERRUPT 1A and receives the date as the number of days from 1/1 of the base leap year. It then adds the number of days from 1/1/80 to 1/1 of the base leap year and turns this number over to the rest of the software for additional computations. By changing the 4 year offset to 8 years in the AT&T PC operating system we would have a date range of 1988 to 1995. The above brief patch script does just that, changing the 1984 base date (05B5h days from 1/1/80) to 1988 (0B6Ah days from 1/1/80). Once we reach 1992 (the next leap year) we can repatch with 111Fh (that is 0B6Ah + 05B5h) for the range 1/1/92 through 12/31/99 - may our machines live that long! -----------Donald Palomaki 7014 Ebbtide Ln Burke, VA 22015