This text file contains code you can add to the Dialogue 128 terminal program
to set its time display.  This also doubles as a general demonstration of how
to read the time from RTC (real time clock) equipped CMD devices.

First are lines you can add if you have a CMD mouse (and I presume the CMD
SmartTrack works the same way).  Just add them however way you can to the
Dialogue boot file, "Dialogue".  You'll also need to copy one file from your
Smartmouse disk to your Dialogue boot disk (see line 482).

A few things of note.  This code sets the time *exactly* as it gets it from
the device, right down to within one second.  It corrects for the TOD bug in
the CIA chip regarding the 12 o'clock TOD setting.  And it avoids setting a
bogus time if your mouse is not inserted.

Your mouse must be set for AM/PM mode, not 24 hour mode.  So just run the new
boot file, and the time will be set.


470 rem place clock card/chip handling code here
480 rem dialogue uses cia#2 registers $dd08-$dd0b for tod clock
481 :
482 bload"mtsm($1a80).obj",u(u):rem load clock read rtn.s (for cmd mouse)
483 :
484 poke 251,188:poke 252,27:rem point to memory area 7100
485 sys dec("1a80"):rem read clock
486 : if (peek(7100)and128)=0 then poke sa+5,0:rem clock accessable & ticking
487 rem
488 : hours =peek(7102)and127 : if hours and 32 then hours=hours+128
489 :   if (hours and 31) =dec("12") then hours =xor(128,hours)
490 : poke dec("dd0b"),hours:
491 : poke dec("dd0a"), peek(7101):rem set tod minutes
492 : poke dec("dd09"), peek(7100):rem set tod seconds
493 : poke dec("dd08"), 5:rem start clock
494 rem tod clock now set
495 :


And here are lines you can add with a CMD HD (I presume all CMD drives work 
the same way).  Same notes as above.  It sets the time as it receives it from
the HD.  And it is presumed that the drive you are booting DLG from is the one
with the RTC.

You can merge the lines, type them, or whatever.  I also included a file
"DLGtimeHD.prg".  This is simply my current Dialogue boot file, if you wanted
to use that instead.  It is a program file.  It has the same lines as below,
only if you use it, then you'll be stuck with my DLG settings.

- Adam Vardy


460 poke sa+5,0:rem change to 0 to disable tod clearing
470 rem place clock card/chip handling code here
480 rem dialogue uses cia#2 registers $dd08-$dd0b for tod clock
481 :
482 open 15,u,15:rem u is device of rtc equipped drive
483 print#15,"t-rb"
484 get#15,a$,a$,a$,a$ : rem toss out date
485 get#15,a$:hours=asc(a$)
486 get#15,a$:mins=asc(a$)
487 get#15,a$:secs=asc(a$)
488 get#15,a$:pm=asc(a$) and 4
489 get#15,a$:close15
490 : if pm then hours=hours+128
491 :   if (hours and 31) =dec("12") then hours =xor(128,hours)
492 :
493 : poke dec("dd0b"),hours:
494 : poke dec("dd0a"), mins      :rem set tod minutes
495 : poke dec("dd09"), secs      :rem set tod seconds
496 : poke dec("dd08"), 5:rem start clock
497 rem tod clock now set
498 :
