[comp.lang.pascal] Re clock address

kirsch@braggvax.arpa (David Kirschbaum) (12/12/88)

Andy Perrin (cdp\!ipis) asks how to access the clock register in Turbo Pascal
3.1 to get an integer seed for a random sequence generator.

Well, I'd suggest using the DOS master clock count, stored at 0000:046C (hex).
It's stored as two 2-byte words .. actually a long integer.  Being a long,
the low word is at 46C, and the high word at 46E.  Just define a typed variable:
VAR
  tick : INTEGER Absolute $0000:$046C;
and you got it!  Be warned:  it only changes every 18th of a second.  And
I seem to recall some ATs didn't properly update it or something?

I believe the ATs have a realtime clock somewhere you can access .. but I don't
have any data immediately at hand on that.  (Something about the CMOS?)
I know I have some code on that .. but maybe the DOS clock tick will do for you.

Regards,
David Kirschbaum
Toad Hall
kirsch@braggvax.ARPA