[comp.sys.atari.st] DCLOCK & IKBD functions

JEMCCABE@MTUS5.BITNET (11/30/87)

Date:    30 November 1987, 00:47:09 EST
From:    Jim McCabe                                JEMCCABE at MTUS5
To:      INFO-ATARI16 at SCORE.STANFORD.EDU
Subject: DCLOCK & IKBD functions

[ sigh ]

To the kind person who sent me DCLOCK (no need to name names,
especially since I misplaced it anyway... :) -- it does NOT
use the IKBD time functions.  Thanks anyway...  It looks like
a nice program, I'll try it out on a friend's ST soon (mine
is mono.)

Can someone PLEASE post to the net about how to use the IKBD
functions?  The Abacus ST Internals book tempts me with very specific
descriptions of the keyboard packet structures and IKBD commands,
but never mentions how to get them from the processor!
I was glancing through ST Peek's and Pokes (in a bookstore) and
it said that the time is returned in addresses 3584 through 3589.
I tested this out, and it didn't seem to work.  Hmm...

There must be someone out there who understands how this works.
All I want to do is read the keyboard time (it's nicer than
GEMDOS's two-second clock.)

And also, please make sure any programs you might send
actually use the IKBD commands before I spend an hour or
so downloading/UUDECODing/unARCing them....

Thanks in advance!


                                                Jim McCabe
                                                jemccabe @ m - c, if y7 

jwt@atari.UUCP (Jim Tittsler) (12/01/87)

In article <8711300600.AA16603@ucbvax.Berkeley.EDU>, JEMCCABE@MTUS5.BITNET writes:
> Can someone PLEASE post to the net about how to use the IKBD
> functions?  The Abacus ST Internals book tempts me with very specific
> descriptions of the keyboard packet structures and IKBD commands,
> but never mentions how to get them from the processor!

The easiest way to get the time/date from the ikbd is to use the xbios to
do it for you.  The LONG Gettime() function (xbios(23), and the associated
settime() xbios(22)) calls will take care of handling all of the
communications with the keyboard for you.  The Gettime() call will return
the time in the low word with the date in the high word.  The time and date
will be in TOS format.

If you REALLY want to know the least significant bit of the seconds counter
you can replace the clockvec pointer that is in the structure returned by
the Kbdvbase() (xbios(34)) call.  When the "clockvec" code gets control, A0
will be pointing the the ikbd TIME-OF-DAY packet.  Your routine should end
with an RTS.  Once you have installed your routine, the ikbd can be forced
to send the time by sending it the INTERROGATE TIME-OF-DAY CLOCK command
(0x1c).  The easiest way to do that is probably to do Bconout(4,0x1c) bios
call, where the 4 refers to the output only KBD device.  Be sure to restore
the original "clockvec" before your program exits.

> I was glancing through ST Peek's and Pokes (in a bookstore) and
> it said that the time is returned in addresses 3584 through 3589.
> I tested this out, and it didn't seem to work.  Hmm...

I REALLY would not recommend using those addresses as they will change from
one system release to another.

(If what you want is a relative timer with more than 2 second accuracy,
you might consider using the LONG _hz_200 counter that is incremented at a
200 Hz rate and IS located in "defined" system variable space.)

Jim Tittsler, Atari Corp.	  {ames, portal}!atari!jwt