Path: utzoo!attcan!uunet!husc6!think!ames!amdahl!nsc!voder!apple!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: Millisecond timing on Mac II Message-ID: <16732@apple.Apple.COM> Date: 7 Sep 88 15:57:04 GMT References: <1325UD040164@NDSUVM1> <13946@agate.BERKELEY.EDU> <626@sdics.ucsd.EDU> <946@helios.ee.lbl.gov> <947@helios.ee.lbl.gov> Reply-To: lsr@apple.com.UUCP (Larry Rosenstein) Organization: Advanced Technology Group, Apple Computer Lines: 33 In article <947@helios.ee.lbl.gov> beard@ux1.lbl.gov (Patrick C Beard) writes: >By the way, you can use SetUpA5() and RestoreA5() if you aren't worried >about Multifinder compatibility. The reason these won't work under MF is Tech Note #208 warns about using these in some optimizing compilers. These routines push the old value of A5 on the stack, but some compilers (MPW 3.0 is sited) leave function parameters on the stack across multiple function calls, which breaks these routines. Instead they suggest using a couple of inline procedures that set A5 and return its old value. You simply save the old value in a local variable. FUNCTION SetCurrentA5: LONGINT; INLINE $2E8D, $2A78, $0904; { returns A5 and sets A5 from CurrentA5 } FUNCTION SetA5(newA5: LONGINT): LONGINT; INLINE $2F4F, $0004, $2A5F; { returns A5 and sets it based on the parameter } As you said you can't use th value of CurrentA5 under MultiFinder. Unfortunately, the TimeManager does not pass a poiner to your time request to the routine, so you must store your application's A5 value in with the code of your time manager routine. Then you can get the A5 value with a PC-relative reference and use SetA5 to set the register. Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr