[comp.sys.apple] Need help with P8 GET_TIME, protecting hires screen

mackay@iisat.uucp (Daniel MacKay) (12/06/89)

Hello!

I have an old ProDOS 8 AppleSloth program which uses a thermistor
attached to the //c game port to read the temperature and put it up
on a horizontally- scrolling single-hires graph- just like a chart
recorder.  It displays the time and temperature at the bottom of the
mixed display, and each minute scrolls the screen left and plots
a dot where the new temperature is.

When I wrote it a few years ago, I couldn't figure out how to get
AppleSloth to get the time from ProDOS, (who gets it from the Applied
Engineering clock driver) so I just opened and closed a dummy file on the
/RAM volume every few seconds, which caused ProDOS to get the time in the
process, and pop the hours and minutes into $BF93 and $BF92.

When I ran the application the other day, someone was walking on my hires
screen with each open and close of the /RAM file!  I assume it's ProDOS
himself, but I don't know why he does it now when in a previous version  he
didn't- but my ramdisk driver and clock driver have been upgraded, too, so
I don't really know whose fault it is. 

So I need help with one of two things: either instructions on protecting 
my hires screen from ProDOS (I tried setting all the bits in the memory 
bitmap for the hires screen, $BF5C-F, but it didn't help- still got 
walked on), or calling GET_TIME (P8 $82) somehow, which is really a more 
correct solution.

My _BASIC Programming With ProDOS_ book mentions this great vector to
the routine DATETIME, at $BF06, but when called from AppleSloth, (or
the monitor, for that matter) it doesn't do what I expect, namely
drop the time into the appropriate date & time bytes, $BF90-2.  In
fact, it crashes in unusual and unpleasant ways. 

Any help with this hires problem, or time problem, would be appreciated. 
Thanks in advance.   -daniel
--
+---------+				IIS Public Usenet
|    _    |	From the 		Halifax, Nova Scotia
|   (_)===|	disk of ...		mackay@iisat.UUCP
|         |	daniel		...{utai,uunet,watmath}!dalcs!iisat!mackay
+---------+				MACKAY@DALAC.BITNET


-- 

jerryk@pro-tcc.cts.com (Jerry E. Kindall) (12/09/89)

In-Reply-To: message from mackay@iisat.uucp

A better way to get the time (other than issuing a dummy open and close eveey
(every) few seconds) would just be to use FLUSH, as in PRINT CHR$(4);"FLUSH"
followed by the PEEKs to read the time.  This was suggested in an issue of
A2-Central or Open-Apple a while back.

If your hi-res screen is being trashed, it may be because of the file being
opened on the RAM disk, IF you're using double hi-res graphics.  If you're
not, and are using just single hi-res, the trouble is probably in the clock
driver itself.

The $BF06 vector cannot be called from BASIC.  It points to a routine within
ProDOS's language card (bank switched memory) area.  If you try to call it
from Applesoft it will call a routine in the Applesoft ROM instead.  It's
called by ProDOS only when the language card is active.

I think the FLUSH command is your best bet.
   _____
  ||___||  Jerry Kindall               |  Internet: jerryk@pro-tcc.cts.com
  |  o  |  2612 Queensway Drive        |  UUCP:     nosc!crash!pro-tcc!jerryk
  |__O__|  Grove City, OH  43123-3347  |  GEnie: A2.JERRY     ALine: A2 Jerry

matthew@sunpix.UUCP ( Sun Visualization Products) (12/10/89)

In article <1989Dec5.184730.18783@iisat.uucp> mackay@iisat.uucp (Daniel MacKay) writes:
}Hello!
}
} [Article about getting ProDOS8 time from AppleSoft program. shortened.]
}
}So I need help with one of two things: either instructions on protecting 
}my hires screen from ProDOS (I tried setting all the bits in the memory 
}bitmap for the hires screen, $BF5C-F, but it didn't help- still got 
}walked on), or calling GET_TIME (P8 $82) somehow, which is really a more 
}correct solution.
}
}My _BASIC Programming With ProDOS_ book mentions this great vector to
}the routine DATETIME, at $BF06, but when called from AppleSloth, (or
}the monitor, for that matter) it doesn't do what I expect, namely
}drop the time into the appropriate date & time bytes, $BF90-2.  In
}fact, it crashes in unusual and unpleasant ways. 
}
}Any help with this hires problem, or time problem, would be appreciated. 
}Thanks in advance.   -daniel
}--


There is a jmp vector within the ProDOS global page for calling the clock
driver, but it is for the kernels use only.

The correct way to do it from AppleSoft, is to poke the following 6 byte 
machine language route into memory, and call it when needed.  This is the
MLI call needed to read the clock, and update the ProDOS global page.

	0300: 20 00 BF  JSR $BF00
	0303: 82        DFB $82
	0304: 00 00     DW  $0000
	0305: 60        RTS





-- 
Matthew Lee Stier                            |
Sun Microsystems ---  RTP, NC  27709-3447    |     "Wisconsin   Escapee"
uucp:  sun!mstier or mcnc!rti!sunpix!matthew |
phone: (919) 469-8300 fax: (919) 460-8355    |