Path: utzoo!attcan!uunet!husc6!mailrus!csd4.milw.wisc.edu!uxc!tank!nucsrl!accuvax.nwu.edu!bob From: bob@accuvax.nwu.edu (Bob Hablutzel) Newsgroups: comp.sys.mac Subject: Re: Programming INITs Message-ID: <10330119@accuvax.nwu.edu> Date: 23 Jan 89 00:41:56 GMT References: <7238@batcomputer.tn.cornell.edu> Organization: Northwestern U, Evanston IL, USA Lines: 22 > I've written a couple of INITs using Lightspeed Pascal, and they work > okay, but now I'm really interested in going further. How do you write > an INIT that hangs around in memory AFTER startup? Screen savers, and > so forth, are obviously still running in the background, paying attention > to various things. How do I get my program to do that? When I've tried > to put the program into a loop, it just doesn't give control to the next > INIT, and if the program doesn't loop, it just ends. It takes more than just an INIT to hang around after boot time. You have to get some code into the system heap (one way is to have the INIT load a resource marked as SysHeap, Locked, and detach the resource from the resource file), and have that code called periodically. The ways to do this are almost legion, but basically consist of either VBL tasks (problem: called at interrupt time, no memory manager calls), drivers (Problem: you have to write a driver. Not so bad, really), trap patches (called whenever specific traps are called, usually highly specialized INITs, and jGNEFilter routines (Problem: like all lo-mem, this is marked for removal, and Apple specifically warns against filter procs.) I realize that this is quite sketchy, but if you want more information, drop me a line. Bob Hablutzel Wildwood Software BOB@NUACC.ACNS.NWU.EDU