• Please review our updated Terms and Rules here

Astclock y2k fix!

jakeh12

New Member
Joined
Mar 8, 2018
Messages
4
Hi,

I just bought my first IBM PC two weeks ago and got it all working, except the ASTCLOCK Y2K issue was really bothering me, even though it was only "visual" (see http://www.vcfed.org/forum/showthread.php?36527-AST-clock-software-question). I have decided to work on the "forever /99" year issue with ASTCLOCK.COM. This is my first disassembly reverse engineering project so feel free to share your comments and/or concerns.

1982 ASTCLOCK.COM AST SIXPAK PLUS Y2K ISSUE PATCH


I included the patched V?1.0? (1982, no version number) and V1.21 in the attachments. If you do not have a way to transfer data into your PC, you can patch it "by hand" using DEBUG and the instructions below.

PATCHED V1.0 (1982, no version number)
View attachment ASTCLOCK_V100-1982.zip

PATCHED V1.21 (newest)
View attachment ASTCLOCK_V121.zip



WARNING: This procedure was written for ASTCLOCK.COM from 1982. If you suspect you might be running a different version, see Notes below the DEBUG. Make sure to backup your ASTCLOCK.COM before attempting this. If you write over some other piece of code, it might cause the program not to function properly. Simply, COPY ASTCLOCK.COM ASTCLOCK.BAK.

Navigate to where your ASTCLOCK.COM is and run

Code:
DEBUG ASTCLOCK.COM
-E017A
1088:017A  B0.2C  63.64
-W
-Q

Note: After you enter -E017A, you need to enter 2C<spacebar>64<return>

Note: You can check the bytes of the ASTCLOCK.COM by using -D0100 option in DEBUG. If you do not see the bytes B0 63 at offset 017A, you might have a different version of ASTCLOCK.COM. Look for these two bytes and replace them with 2C 64.

Explanation:
AST programmer(s) programmed the ASTCLOCK.COM to force anything higher than 99 (3 digits long) not to show in the print out of the program. This might somewhat make sense because it was 1982 and there were only two places for two decimal digits. Internally, the RTC onboard AST SIXPAK PLUS works with Y2K. ASTCLOCK.COM also does system calls to DOS with Y2K date correctly. The only issue is the subroutine which coverts the time from the chip into a two digit print out.

I went through the code, disassembled it, and found the crucial place where the date gets checked against 99. AST decided to save the year in the RTC chips memory as a one byte of the year minus 80. To make sure the year fits in a byte, 1996 becomes 96-80=16 and 2018 becomes 118("rolls over 99")-80=38.

The way the code maps integer values to digits is as follows. Assume our year is 1996. The value stored in the RTC chip is therefore 16. The code adds 80. When it gets to the print out subroutine, the code checks if it's greater than 99 and then the value 96 gets divided by ten using the DIV instruction. The result of the division is stored in register AL and the remainder is stored in register AH. 96/10 = 9 remainder 6. Then the code adds ASCII offset for character 0 to these numbers and the numbers are now ASCII numbers. If we skipped the check for 99 and our year is 118 (2018), the following will happen. 118/10 = 11 remainder 8. So 11 gets added with ASCII offset for '0' to obtain the first character of the year and the 8 gets added with ASCII offset for '0' to obtain the second. The results in the following print out ";8". We crossed the ASCII '9' and went to ';' since the value is greater than 99. Therefore, it is necessary to subtract 100 from the value which will give us 118-100 = 18 and now 18/10 = 1 remainder 8 so the resulting characters in the print out are "18". If you are interested in more, see the attached disassembly.


The original line of code at offset 0x017A:

B0 63 ---> MOV AL, 63H ; force value to 99 if greater than 99

can be now replaced with

2C 64 ---> SUB AL, 64H ; subtract 100 from the value if greater than 99


This fixes the ASTCLOCK.COM Y2K issue.

Disassembly:
View attachment ASTCLOCK.TXT

Screenshot:
IMG_0473.JPG
 
Last edited:
Thank you for your feedback! I included patched executables of V1.0 (1982, no version number) and V1.21 in the original post if you do not want to patch "by hand".

This is the change in 1.21:

FROM: 02C6: B0 63 ---> MOV AL, 63H
TO: 02C6: 2C 64 ---> SUB AL, 64H
 
This is the change in 1.10:

From: 0237: B0 63 ---> MOV AL, 63H
To: 0237: 2C 64 ---> SUB AL, 64H

I write a patch to show date in dd/mm/yyyy format in the printout of ASTCLOCK.COM 1.10 Version (1984)
NOTE: it will works until year 2099, but it should be enough for me :D

Replace:
Code:
 06E4  BA 71 03     MOV  DX,0371    ;moved in 075F because I need more space
with:
Code:
 06E4  EB 58        JMP  073E       ;jump out of code, where is my patch
 06E6  90           NOP             ; that add 38 bytes to the program
then add:
Code:
 073E  A1 81 03     MOV  AX,[0381]  ;get <month> value from 'mm/dd' format,
 0741  87 06 84 03  XCHG AX,[0384]  ; exchange it with <day> value that then
 0745  A3 81 03     MOV  [0381],AX  ; put in 1st place to have 'dd/mm' format
 0748  A1 87 03     MOV  AX,[0387]  ;move forward the two digits of <year>
 074B  A3 89 03     MOV  [0389],AX  ; to have more space for 'yyyy' format,
 074E  B8 32 30     MOV  AX,3032    ; then add "20" in the first two places
 0751  A3 87 03     MOV  [0387],AX  ; to have 'dd/mm/20yy' format as required
 0754  B8 20 0D     MOV  AX,0D20    ;need to overwrite a useless "/$" with
 0757  A3 8B 03     MOV  [038B],AX  ; a space and a CR code, then
 075A  B0 0A        MOV  AL,0A      ; overwrite a useless " " with a LF.
 075C  A2 6D 03     MOV  [036D],AL  ; I like one more blank after the printout
 075F  BA 71 03     MOV  DX,0371    ;now execute the moved instruction, then
 0762  EB 83        JMP  06E7       ; return to the original code
 
Just wanted to drop in & say thanks for this - working perfect on my 5150! That '99 year at bootup was really gonna bug me!
 
When using the modified ASTCLOCK I'm still not able to set a date past 1999. IBM 5150 with AST SixPakPlus short card, dos 6.22. The manual only describes using /R to place the program into memory, so you can then change the date/time. However, it will not accept any input past 1999. Do I need to remove the battery for a bit and then reinstall it to wipe the SixPakPlus' info?
Any help would be appreciated!
 
When using the modified ASTCLOCK I'm still not able to set a date past 1999. IBM 5150 with AST SixPakPlus short card, dos 6.22. The manual only describes using /R to place the program into memory, so you can then change the date/time. However, it will not accept any input past 1999.
Welcome to these forums.

I have an AST SixPakPlus card (long version). I temporarily removed the battery from it for a while.

I then downloaded the patched V1.21 of ASTCLOCK.COM from post #1.
I then executed ASTCLOCK.COM, and observed that ASTCLOCK.COM reported a date of 01/01/80 and a time of 00:00:00
I then executed ASTCLOCK.COM using the /R command line switch to make it resident (i.e. "astclock /r"). I saw ASTCLOCK display, in amongst other things, "DATE & TIME processors loaded."
I then used the DATE and TIME commands of DOS to set the current date and time.
I then rebooted the computer.
I then executed ASTCLOCK.COM, and observed, as expected, that ASTCLOCK.COM reported the current date and time.

When you are using the DATE command of DOS, are you using a 4-digit year ?
 
Good morning!

Thank you for the detailed process! I have the short version card, and I had already done the steps listed in your comment (except for removing the battery - see below!) and was still having trouble with the date working correctly. I started using a 2 digit year, which didn't work for 2001 and up, then I tried the 4 digit year as well and it would not accept it. Discussing this with a friend I recalled that when I first got the card and installed the battery, the date was filled with impossible numbers, like 68/42/56. Who knows how long that old battery was dead! I ran ASTCLOCK.COM /R a couple times and rebooted the system, and finally it would accept 1999 as a date (entered as 99). Then I found out about the patched ASTCLOCK.COM and tried it, but it still wouldn't work. I'd been thinking about pulling that battery out and starting up the system, then shutting down and re-installing the battery to see if it would help on the next boot. This time, it accepted the correct 4 digit year!

Again, I really appreciate the help!
 
Thankyou for this - it worked perfectly on XT5160 - I had to mess about with astclock /r a few times to get time and date set.
you don't need "setclock.com" described in the ast manual.

I also had to learn how to live without "edit" in pc-dos 3.3 to make an autoexec.bat. I wont spoil it for you :)
(hint..section 5-5 in the 6pak manual).
 
Am I missing something here? astclock.com sets the date on the computer to the card. But one needs to use setclock.com to set the date from the card to the computer, correct? I'm finding that while I can use astclock.com to set the right date to the card, the version of setclock.com I have sets the date to 1999, suggesting we need patched versions of both of these files? Or am I missing something?


Yes, I was missing something. Documentation I read referred to the 2 commands. But reading over this thread I saw reference to running the astclock command with a /r. So I tried it. astclock /r sets the computer time to the time on the card, while astclock without the /r sets the time on the card. Only 1 file needed.

This patch is great. Thanks.
 
Last edited:
Am I missing something here? astclock.com sets the date on the computer to the card. But one needs to use setclock.com to set the date from the card to the computer, correct? I'm finding that while I can use astclock.com to set the right date to the card, the version of setclock.com I have sets the date to 1999, suggesting we need patched versions of both of these files? Or am I missing something?

Yes, I was missing something. Documentation I read referred to the 2 commands. But reading over this thread I saw reference to running the astclock command with a /r. So I tried it. astclock /r sets the computer time to the time on the card, while astclock without the /r sets the time on the card. Only 1 file needed.

For completeness:

---------------------------------------------------------------------------------------------------------------------------------------------
In early versions of AST's SuperPak software, supplied was SETCLOCK.COM and ASTCLOCK.COM

• SETCLOCK.COM - Sets the RTC clock on the SixPakPlus card.
• ASTCLOCK.COM - Run at computer power-on time (usually via AUTOEXEC.BAT) to copy the RTC clock from the SixPakPlus card into the DOS clock.

( In SuperPak 4.2, SETCLOCK.COM is supplied, but it is discovered that ASTCLOCK.COM with the /R option can be used instead of SETCLOCK.COM - see below. )

---------------------------------------------------------------------------------------------------------------------------------------------

In later versions of AST's SuperPak software, supplied was only ASTCLOCK.COM

• To set the RTC clock in the SixPakPlus card, run ASTCLOCK with the /R option. Then use the DATE and TIME commands of DOS, i.e. setting the DOS clock. ASTCLOCK (which is running in the background) will then automatically copy the DOS clock into the RTC clock on the SixPakPlus card.

• Use ASTCLOCK with no /R option to copy the RTC clock from the SixPakPlus card into the DOS clock. Usually run at computer power-on time, via AUTOEXEC.BAT

---------------------------------------------------------------------------------------------------------------------------------------------
 
I did a video on patching v1.21 of ASTCLOCK.COM from this topic - Thanks!:
 
Thankyou for this - it worked perfectly on XT5160 - I had to mess about with astclock /r a few times to get time and date set.
you don't need "setclock.com" described in the ast manual.

I also had to learn how to live without "edit" in pc-dos 3.3 to make an autoexec.bat. I wont spoil it for you :)
(hint..section 5-5 in the 6pak manual).
Edit from win98 is an individual program. It doesn't need basic to run and should function on any Dos based system.
 
Back
Top