Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I read the time from a iie/ProDOS8 program running on a IIGS?

27 views
Skip to first unread message

datajerk

unread,
Nov 11, 2009, 12:44:23 PM11/11/09
to
Subject says it all. I have a number of ][+/iie programs that use the
Thunderclock card to get the time. I'd like to run the same programs
modified on Sweet16.

Thanks.

John B. Matthews

unread,
Nov 11, 2009, 1:11:57 PM11/11/09
to
In article
<2b3d1fe5-84ea-4bb5...@a39g2000pre.googlegroups.com>,
datajerk <data...@gmail.com> wrote:

You should be able to use the MLI GET_TIME ($82) call described in the
"ProDOS 8 Technical Reference Manual":

<http://www.scribd.com/doc/2430108/ProDOS-8-Technical-Reference-Manual>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

datajerk

unread,
Nov 11, 2009, 1:30:03 PM11/11/09
to
On Nov 11, 11:11 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <2b3d1fe5-84ea-4bb5-84f4-972d515b9...@a39g2000pre.googlegroups.com>,

>
>  datajerk <dataj...@gmail.com> wrote:
> > Subject says it all.  I have a number of ][+/iie programs that use the
> > Thunderclock card to get the time.  I'd like to run the same programs
> > modified on Sweet16.
>
> You should be able to use the MLI GET_TIME ($82) call described in the
> "ProDOS 8 Technical Reference Manual":
>
> <http://www.scribd.com/doc/2430108/ProDOS-8-Technical-Reference-Manual>
>
> --
> John B. Matthews
> trashgod at gmail dot com
> <http://sites.google.com/site/drjohnbmatthews>

Thanks. However, I cannot get seconds. Any way to get seconds?

Thanks again.

D Finnigan

unread,
Nov 11, 2009, 2:32:43 PM11/11/09
to
datajerkwrote:

>
> Thanks. However, I cannot get seconds. Any way to get seconds?
>

Not easily. The ProDOS time does not have that high of resolution. Even file
modify/create dates do not go down to the seconds.

Michael J. Mahon

unread,
Nov 12, 2009, 12:32:14 PM11/12/09
to

The Thunderclock ROM driver reads the time into a work area on page 2,
and the seconds are there after the ROM routine runs. Check the
Thunderclock manual for details. (I don't recall whether the ProDOS
Thunderclock driver reads the seconds into page 2 or not.)

All Apple II clocks maintain seconds (otherwise they couldn'd keep the
time!), but ProDOS doesn't store anything beyond minutes. A few clocks
even allow a millisecond counter to be read out.

For clocks that don't provide a way to read the millisecond counter
directly, a simple hack can recover it. Just poll for the seconds to
change in a timed loop to discover how many miliseconds until a change.
The millisecond counter at the time of entry was 1000-<elapsed ms until
seconds change>. The downside is that it can take as long as a second
to "read milliseconds".

-michael

NadaNet and AppleCrate II: parallel computing for Apple II computers!
Home page: http://home.comcast.net/~mjmahon

"The wastebasket is our most important design
tool--and it's seriously underused."

datajerk

unread,
Nov 12, 2009, 2:11:43 PM11/12/09
to

I have no problem getting the seconds from a Thunderclock on a //e.
But what does the iigs use for a clock? If the iigs emulates a
thunderclock, then what slot would it be in?

Thanks.

Charlie

unread,
Nov 12, 2009, 4:04:58 PM11/12/09
to

"datajerk" <data...@gmail.com> wrote in message
news:c2bf9275-272f-462f...@f18g2000prf.googlegroups.com...

> snip <

> I have no problem getting the seconds from a Thunderclock on a
> //e.
> But what does the iigs use for a clock? If the iigs emulates a
> thunderclock, then what slot would it be in?

In the IIgs you can use toolbox routines to read/write to the clock.
There are three calls in the miscellaneous tool set.

name of routine tool number/set

ReadTimeHex $0D03 returns current time in hex
WriteTimeHex $0E03 sets current time in hex
ReadAsciiTime $0F03 returns elapsed time since 00:00:00,
Jan 1, 1904 in ASCII format

All three routines use seconds.

If you are calling these routines from ProDOS 8 you will probably
have to switch to native mode (16 bit) first and then you are
supposed to start the dependent toolsets (Tool locator & Memory
Manager)and then the Miscellaneous Tool Set. You are supposed to
shut them down when finished. You switch back to emulator mode
before returning to your ProDOS 8 program.
Nearly all machine language toolbox calls are made by a JSL $E10000
with the tool number and set in the X register. You push parameters
and space for returned information on the stack before the call and
pull the data (time information in this case) off the stack after
the call. If there is an error the carry is set and the A-register
contains the error code. Whether all this is worth it is your call
and there may be other (easier) ways to access the clock from ProDOS
8. I just thought since no one else had offered a solution I'd give
you something to go on. It's likely though that someone has already
written a routine to do what you want but finding it may not be
easy.


Disclaimer:
It's been a long time since I did any of this stuff and my memory
"ain't so good anymore" :-)

Charlie

David Empson

unread,
Nov 12, 2009, 6:06:09 PM11/12/09
to
datajerk <data...@gmail.com> wrote:

> I have no problem getting the seconds from a Thunderclock on a //e.
> But what does the iigs use for a clock? If the iigs emulates a
> thunderclock, then what slot would it be in?

The IIgs uses a dedicated clock and parameter RAM chip which Apple also
used in early Macintosh models.

Applications are not supposed to directly access it in hardware, and I'm
not aware of any reasonable excuse for wanting to do that.

Apple have provided a set of calls in the Apple IIgs Toolbox for reading
or writing the time. When running on a IIgs, ProDOS-8 1.2 and later use
a IIgs-specific clock driver which makes the necessary calls to get the
time down to the one minute resolution required by ProDOS. That driver
is installed in place of the Thunderclock driver, within the same 126
byte area in ProDOS.

I don't have documentation on hand to look up the details, but I see
Charlie has given the background on the toolbox calls.

One approach might be to copy the IIgs clock driver out of ProDOS and
modify it slightly to also return the seconds somewhere. It will be
doing all the necessary steps to get into the right mode, start up and
shut down tool sets, etc.

The IIgs Toolbox functions don't provide access to the time at a higher
resolution than one second, but there are other techniques which can be
used to derive a reasonably accurate fractional second counter, e.g. the
IIgs has a one second interrupt which is generated by the clock as the
seconds change.

--
David Empson
dem...@actrix.gen.nz

Toinet

unread,
Nov 12, 2009, 6:25:27 PM11/12/09
to

Hi datajerk,

First of all: check you are on a IIgs
SEC
JSR $FE1F
BCC iigs
RTS

Then: get the time from the Miscellaneous tool
iigs:
save the machine's current state
switch to 16-bit mode (CLC XCE)
call ReadTimeHex
restore the state register
unstack seconds/minutes/hours/year/day
Check the year range (*)
switch back to 8-bit mode (SEC XCE)
RTS

I cannot do more.

(*) Please read Apple 2 technote #28.

Antoine Vignau
Brutal Deluxe Software

0 new messages