Commodore 128 Alive!

Commodore 128 => Herdware => Topic started by: MIRKOSOFT on September 13, 2010, 08:17 AM

Title: How to read/write RTC from these devices (in topic)
Post by: MIRKOSOFT on September 13, 2010, 08:17 AM
Hi!

I want to know how to READ/WRITE RTC from:

CMD SmartMouse
CMD SmartTrack
1541Ultimate-II
IDE64
Chameleon64

also

exists only one version of VIC FinalExpansion? If more, from which version is RTC included?

Thank you for all replies!

Miro
Title: Re: How to read/write RTC from these devices (in topic)
Post by: RobertB on September 14, 2010, 11:57 AM
Quote from: MIRKOSOFT on September 13, 2010, 08:17 AM
I want to know how to READ/WRITE RTC from:

CMD SmartMouse
CMD SmartTrack
1541Ultimate-II
IDE64
Chameleon64
Chameleon has not been released yet.

          Truly,
          Robert Bernardo
          Fresno Commodore User Group
          http://videocam.net.au/fcug (http://videocam.net.au/fcug)
          The Other Group of Amigoids
          http://www.calweb.com/~rabel1/ (http://www.calweb.com/~rabel1/)
          Southern California Commodore & Amiga Network
          http://www.sccaners.org (http://www.sccaners.org)
Title: Re: How to read/write RTC from these devices (in topic)
Post by: pearsoe on September 25, 2010, 05:44 AM
If you look on the SmartMouse disk CMD provided a driver that had to be loaded before you could set or read the RTC.  I believe it is the same driver used with the SmartTrack.  It looks like the source code is included on the disk.
Title: Re: How to read/write RTC from these devices (in topic)
Post by: Wagner on September 30, 2010, 11:41 PM
Reading or writing the time in the SmartMouse is straightforward.  Using the CMD SmartMouse driver as provided on the utilities disk and loaded in at $1300, the third jump in the driver jump table reads the 8 bytes of the clock.  First set up a pointer in $fb-$fc to where you want the 8 bytes to be stored, then call rdclk at $1306...

      lda #$a7
      ldx #$02
      sta $fb
      stx $fc
      jsr $1306


Memory locations $2a7-$2ae now contain the time.  Examining the BCD bytes with a machine language monitor we may have something like this...12 16 88 30 09 05 10 80, which are, left to right, seconds, minutes, hours, date, month, day, year, and write-protect.  This means that the time when read was 08:16:12 am September 30 2010, a Thursday (day 5).  The high bit of the write-protect bit is set (the $80).  The high bit of the hours in this example is also set (the $88) because the hours are in 12-hour mode.  If that bit had been cleared, the hours would be in 24-hour mode.

Writing to the SmartMouse is just as easy.  Set the time the way you want it, stored in some memory location, setup the pointer in $fb-$fc again, and call wrclk, the fourth jump in the driver's jump table.

      lda #$a7
      ldx #$02
      sta $fb
      stx $fc
      jsr $1309


There are also other features in the SmartMouse driver, such as reading/writing the 24 byte scratchpad data storage in the SmartMouse, reading/writing a single byte of the clock or scratchpad, and setting or clearing the write-protect.  The DS1202 timekeeping chip (which is what the SmartMouse contains) can also be put into a low power state, halting the clock, when you set the high bit of the seconds to 1.
Title: Re: How to read/write RTC from these devices (in topic)
Post by: BigDumbDinosaur on October 01, 2010, 01:57 AM
Quote from: Wagner on September 30, 2010, 11:41 PMThe DS1202 timekeeping chip (which is what the SmartMouse contains) can also be put into a low power state, halting the clock, when you set the high bit of the seconds to 1.
What setting bit 7 of the seconds does is stop the oscillator.  If the oscillator isn't running timekeeping is halted.
EhPortal 1.34 © 2025, WebDev