Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!zephyr.ens.tek.com!tektronix!reed!chaffee From: chaffee@reed.bitnet (Alex Chaffee,(259),,2369505) Newsgroups: comp.sys.mac.programmer Subject: Re: converting tail patches to head patches... Message-ID: <13636@reed.UUCP> Date: 28 Nov 89 23:41:59 GMT References: <63359@tiger.oxy.edu> <9099@hoptoad.uucp> Sender: news@reed.UUCP Reply-To: chaffee@shiva.JPL.NASA.GOV (Alex Chaffee) Organization: Reed College, Portland, OR Lines: 53 Summary: Shouldn't it go like this? In article <9099@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: > myPatch() > { > doMyStuff(); > asm{ > unlk a6 > Lea @1,A0 ; @1 is a dc.l that has the old trap stashed > Move.L (A0),A0 > Jmp (A0) > } > } What is the syntax one should use for setting up a dc.l from within Think C? With scoping as I understand it, the @1 would have to refer to somewhere _within_ the function, and you haven't declared it... So shouldn't it go something like this: long OldTrap; /* global - some initialization routine sets this */ myPatch() { doMyStuff(); asm { br.s @2 @1 dc.l @2 move.L OldTrap, @1 unlk A6 move.L @1, A0 move.L (A0), A0 jmp (A0) } } I'm sure there are a dozen things wrong with the syntax (and it would be very educational to be corrected), but how's the idea? By the way, if this works, I will use it instead of my old method, which is asm { move.l OldTrap, A0 ; or A1, for some traps unlk A6 jmp (A0) } (if I remember correctly). "Nor is it a consequence of my bed's being covered with leaves that I am not hallucinating that it is." - Barry Stroud ____________________ -- Alex Chaffee chaffee@reed.UUCP ____________________