How to read/write RTC from these devices (in topic)

Started by MIRKOSOFT, September 13, 2010, 08:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MIRKOSOFT

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
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

RobertB

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
          The Other Group of Amigoids
          http://www.calweb.com/~rabel1/
          Southern California Commodore & Amiga Network
          http://www.sccaners.org

pearsoe

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.
My rig: C-128 w/JD SCPU, uIEC/SD, CMD-HD (500 MB), CMD-HD ZIP drive, CMD RAMLink, 1750XL 2 MB REU, FD-2000, 1581, Turbo232

Wagner

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.

BigDumbDinosaur

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.
x86?  We ain't got no x86.  We don't need no stinking x86!