Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!apple!well!cbm From: cbm@well.sf.ca.us (Chris Muir) Newsgroups: comp.sys.mac.programmer Subject: Re: MIDI Manager/Think C/A5 Register Summary: Look in OSUtil.h Message-ID: <17249@well.sf.ca.us> Date: 14 Apr 90 20:28:49 GMT References: <9004121500.AA00697@canoe.cis.ohio-state.edu> Reply-To: cbm@well.UUCP (Chris Muir) Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 44 In message <9004121500.AA00697@canoe.cis.ohio-state.edu>, james_kent@CIS.OHIO-STATE.EDU writes: >I need a method of doing the following, using Think C : > >1) save the application's A5 value somewhere when the application starts > (Location X) >2) when the interrupt routine is called, save the current A5 value (Location Y) > and move the value from Location X into A5 >3) when the interrupt routine completes, move the value from Location Y back > into A5 before returning This is a little cryptic, but: /* From OSUtil.h */ /* access A5 from interrupt level (new way) */ pascal long SetCurrentA5(void) = { 0x2E8D, 0x2A78, 0x0904 }; /* MOVE.L A5,(A7) ;2E8D */ /* MOVEA.L CurrentA5,A5 ;2A78 0904 */ pascal long SetA5(long) = { 0x2F4D, 0x0004, 0x2A5F }; /* MOVE.L A5,$0004(A7) ;2F4D 0004 */ /* MOVEA.L (A7)+,A5 ;2A5F */ /* in your MIDI setup routine */ myMidiInputParams.refCon = SetCurrentA5(); /* stash the real A5 in refcon */ /* in your read hook (which gets passed the refcon) */ long oldA5; oldA5 = SetA5(myRefCon); /* set A5 to "my" A5 */ /* do stuff that needs globals */ oldA5 = SetA5(oldA5); /* set A5 to old A5 */ -- __________________________________________________________________________ Chris Muir | "There is no language in our cbm@well.sf.ca.us | lungs to tell the world just {hplabs,pacbell,ucbvax,apple}!well!cbm | how we feel" - A. Partridge