Path: utzoo!attcan!uunet!cs.utexas.edu!yale!husc6!unix!mxmora From: mxmora@unix.SRI.COM (Matt Mora) Newsgroups: comp.sys.mac.programmer Subject: Re: Questions on INITS Message-ID: <15232@unix.SRI.COM> Date: 15 Aug 90 16:17:56 GMT References: <1850@mountn.dec.com> Reply-To: mxmora@unix.UUCP (Matt Mora) Organization: SRI International, Menlo Park, CA Lines: 42 In article <1850@mountn.dec.com> domenikos@emass1.enet.dec.com (George Domenikos) writes: >Hi there, > >I am having an INIT writen in Pascal that crashes whenever is trying to do >anything that calls the OS or the Toolbox such as EventAvail, GetNextEvent, >etc. Are you trying to call those routines or trying to patch those routines? You moust use some inline asm or asm glue to make it work in pascal. You need to save/restore the registers because pascal will be sure to trash them. >Has anyone run into the same problem before? >Does anyone have a working example of an INIT written in a highlevel language? I have some code that uses the jGNEFilter approach. Its kinda working. I can make it not crash but then it doesn't do what its supposed to or I can make it do its job them it will crash. I guess I still have a few bugs to work out :-) (but then I could always just put a Microsoft label on it and let it go at that. :-)) ( Just kidding Microsoft) What I think I have to do to get it working is to write an asm shell that saves the registers calls my pascal code ,gets the return value,restores the registers and the sets D0 to the value returned. You can look at the shell of this code in the UMPG on page 241 or there abouts (the page numbers aren't quite exact yet). The article is called "how to write an Init in pascal" There is also another article on the subject in chapter 2 page 39. This one patches a trap. >Does anyone know how to specify an INIT to run before or after another INIT? Name it so that it is alphabetically before the other one. :-) -- ___________________________________________________________ Matthew Mora | my Mac Matt_Mora@sri.com SRI International | my unix mxmora@unix.sri.com ___________________________________________________________