Page 1 of 3

Dallas RTC drivers (beta)

Posted: 08 Oct 2020 20:33
by agranlund
I've made a driver for older ROM based Dallas RTCs and I'd love some feedback if someone finds it useful and if it works on their machine or not :)
RTCX.zip

It supports DS1216E/F and DS1315 in ROM mode and it can be located in the cartridge port or any of the TOS ROM sockets.
A1 is assumed to be the data input, and /WE should be either A2 or A3
Tested on a 520STM with a "Forget Me Clock 2" cartridge under TOS2.06 and EmuTOS1.0. Your milage may vary, this is beta so use at your own risk, etc etc :)

To use it just put DALLAS1.PRG in the AUTO folder. If it's running you should have an 'RTCx' cookie with the address where the chip was found.
It's designed to work seamlessly with TOS so you'll set time and date using XControl as usual.

Using any other clock driver, Y2K type fixes or 3rd party Dallas applications at the same time may cause interference - especially those that still rely on the IKBD and work by adjusting the year back and forth.


It comes with sourcecode and is made as an extendible system with a common core, and separate hardware drivers.
The idea was that it should be easy to create additional drivers for other RTCs without having to worry about all the TOS boilerplate and just focus on the hardware specifics.
At the moment it's just that one Dallas driver though, and a dummy template to use when making a driver for some other RTC hardware.

Big thanks to @troed of SYNC fame for code example on how to talk to the DS1216!

Re: Dallas RTC drivers (beta)

Posted: 08 Oct 2020 21:21
by troed
agranlund wrote: 08 Oct 2020 20:33 I've made a driver for older ROM based Dallas RTCs and I'd love some feedback if someone finds it useful and if it works on their machine or not :)

To use it just put DALLAS1.PRG in the AUTO folder. If it's running you should have an 'RTCx' cookie with the address where the chip was found.
It's designed to work seamlessly with TOS so you'll set time and date using XControl as usual.
Love your solution replacing the TOS code solving the Y2K problem properly! Will definitely install this on my own machines.

/Troed

Re: Dallas RTC drivers (beta)

Posted: 08 Oct 2020 21:30
by exxos
Sounds great! Now wheres @rubber_jonnie ....

Re: Dallas RTC drivers (beta)

Posted: 08 Oct 2020 22:00
by kodak80
Looking forward to testing this on the weekend on my H4s. :D

Re: Dallas RTC drivers (beta)

Posted: 08 Oct 2020 22:42
by rubber_jonnie
exxos wrote: 08 Oct 2020 21:30 Sounds great! Now wheres @rubber_jonnie ....
I suppose I'd better try it at some point!

Re: Dallas RTC drivers (beta)

Posted: 08 Oct 2020 22:46
by agranlund
kodak80 wrote: 08 Oct 2020 22:00 Looking forward to testing this on the weekend on my H4s. :D
Oh, I would be interested in knowing if there are any issues with it and the H4 - it has a DS1315 on it right?

Re: Dallas RTC drivers (beta)

Posted: 08 Oct 2020 22:59
by agranlund
troed wrote: 08 Oct 2020 21:21 Love your solution replacing the TOS code solving the Y2K problem properly! Will definitely install this on my own machines.
Thanks! Yeah that naive idea did work in the end.
The sourcecode will probably make a demo coder like yourself throw up a little though :)
I was pretty fluent in Z80 assembly way back when but I'm only now trying out 68k some 20 odd years after and haven't fully gotten my head around all those fancy addressing modes and instructions :lol:

But it sure is fun to sit on the actual ST with Devpac3.

Ultimately I plan on fitting some kind of RTC on one of my custom boards but I'm not sure which one yet, so I made it easy to write additional drivers for other hardware.

Re: Dallas RTC drivers (beta)

Posted: 08 Oct 2020 23:31
by bj_kock
Great work!

Tested and works perfectly on my STE 4MB with "Forget Me Clock 2" cartridge under both TOS 1.62 and 2.06 :D

Re: Dallas RTC drivers (beta)

Posted: 09 Oct 2020 01:02
by PaulJ
Just tried it on the H4 with 2.06 and EmuTOS .9.1.2 and it works with both. Nice.... Real pleasure not needing to adj. the clock when changing os's. Nice job.

Re: Dallas RTC drivers (beta)

Posted: 09 Oct 2020 03:50
by kodak80
Couldn't wait until the weekend, so powered up an H4 with a Gotek boot floppy and this worked fine with the DS1315 chip. Initially, it read the date from the Dallas chip which was set previously with the FMII fixed PRG solution and the date was incorrect but once I set it in XControl with this new driver, the date was then correct from that point forward. Testing was with EmuTOS 1.0 and TOS 1.04. I have now updated my hard disk AUTO folder to use this new driver.