[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date and time not updating in Applesoft BASIC program?



On Jan 30, 10:06 pm, mspangler <mspang...@gemsi.com> wrote:
> On Jan 30, 5:38 pm, "Michael J. Mahon" <mjma...@aol.com> wrote:
>
> > DMn2004404 wrote:
> > > Here's the scenario: I have written an Applesoft BASIC program that
> > > uses a No-Slot Clock in my Enhanced Apple //e. I have RUN the program
> > > and had it execute a routine that displays the system date and time.
> > > When the program reaches this routine at, let's say, 6:32 PM, it says
> > > the time is 6:32 PM. So far, it appears the date and time routine is
> > > working properly. But, let's say I've had this same program running
> > > continuously for, say, two minutes, and the time is now 6:34 PM, but
> > > when I send the computer back to the date and time routine, the
> > > program says the time is still 6:32 PM. What's the deal here, and is
> > > there any way to rectify it?
>
> If you just want to tickle the time; this note from way back will
> work;"
>
> ProDOS doesn't read the clock continuously.  It reads the clock
> whenever it
> gets asked to do something for which a time might be necessary.
>
> You can force ProDOS to read the clock and update the time locations
> by
> calling the MLI routine GET_TIME from machine language:
>      JSR $BF00     ;Call ProDOS MLI
>      DFB $82        ;$82 = GET_TIME
>      DW  $0000     ;GET_TIME doesn't use a parameter list
>      ...           ;Your code continues here
>
> Thus, to read the clock from BASIC, first POKE the following machine
> language routine into memory (put it anywhere you have a few free
> bytes--it's
> relocatable):
>      32,0,191,130,0,0,96
>
> Then, whenever you need to read the time, CALL the machine language
> routine, and PEEK the time out of the ProDOS global page. "
>
> This is what I use. It works on a GS too.  If you search this
> newsgroup for Get-time you'll find the source of the above code.

Searching the group for "GET_TIME" directed me to a thread called
"Clock, BASIC, and IIgs." I tried the code in my BASIC program, and it
worked. Thanks for the help.

Brandon