Y2K compatible No-Slot-Clock for PC and XT - DS1216E Smartwatch

Last year around Christmas, I got hold of a Sanyo MBC-16 XT clone. The machine is nothing special, but it is the exact model my father had from the late 80s to the mid-90s and was most probably the first computer I sat in front of. Therefore, I couldn't resist when I saw one for sale. I will write about it in detail in an upcoming post.

One of the upgrades I installed was a No-Slot-Clock based on a Dallas DS1216E Smartwatch chip. This is the same that also works in the Apple II series. In contrast to other RTCs, DOS doesn't know about this chip. You use it with a program from 1986 called SMWCLOCK.COM, originally provided by Dallas Semiconductor themselves (some sources say Tandy, but the assembly file says Dallas). Depending on the parameter, this program sets the time and date in the chip or reads from the chip and writes them to DOS.

However, there is one problem with this program: It is not Y2K compatible, as most programs from this area. Nobody thought that it would be used fourteen years after its release, let alone in the year 2021! The problem is only there when calling the program without parameters, where it reads the date and time and prints them on the screen. The year 2021 is displayed incorrectly as "19C1". The rest of the program seems to work perfectly fine.

 Luckily, the sources are included in the package. This gave me a chance to do my very first work in x86 assembly. I think this is very fitting as it is intended to be used on the very first PC I worked on (read: played with). The problem was in the year part of the DISPLAY routine. The clock only saves the last two digits of the year in a BCD encoded format. The "19" part was hardcoded. The fix is very easy and involves checking if the year is greater than A0h (i.e. 2000). If so then "A0h" is subtracted and "20" and the new year part is printed.

The fix works great and is only seven lines of assembly code. The binary and sources are available from my GitHub account: https://github.com/freitz85/smwclock

Comments

Popular posts from this blog

Prebuilt AppleIISD V1.2.1 finally available

AppleIISd

How to prepare SD cards for the AppleIISd