Path: utzoo!attcan!utgpu!watmath!iuvax!mailrus!cwjcc!neoucom!sam From: sam@neoucom.UUCP (Scott A. Mason) Newsgroups: comp.sys.mac.programmer Subject: Re: VBL Question/Code Plea Message-ID: <1707@neoucom.UUCP> Date: 31 Aug 89 02:33:56 GMT References: <604@mit-amt.MEDIA.MIT.EDU> Reply-To: sam@neoucom.UUCP (Scott A. Mason) Organization: Northeastern Ohio Universities College of Medicine Lines: 42 In article <604@mit-amt.MEDIA.MIT.EDU> adam@mit-amt.MEDIA.MIT.EDU (Adam Glass) writes: >I've been having the darndest time trying to make a program to do a VInstall. >I can't seem to be able to get the pascal variant records/C unions to work. >Could some kind soul mail me a procedure/quickie program to do it? You could >also post it, as I'm sure other people will find it interesting. Ok, here's a snippet of my code written in LSC. (It doesn't do much, but should help a lot of people getting things to work.) #include VBLTask vblTask; void VBL_Routine () { SetUpA5(); /* set up for globals */ vblTask.vblCount = 30; /* reset the count so we run next time */ /* your code to do something real goes here */ RestoreA5(); /* reset the globals stuff */ } /* This routine installs the given VBLTask */ Set_Interrupts (vblTask) VBLTask *vblTask; { OSErr err; vblTask->qType = vType; vblTask->vblAddr = (ProcPtr) VBL_Routine; vblTask->vblCount = 30; vblTask->vblPhase = 0; err = VInstall ( vblTask ); } Well, there it is in all its simplicity. I must say it was difficult the first time for me as well. The implementation of VBL tasks is not very clear in IM. Hope this helps. -- -------------------------------------------------------------------------------- "If it ain't broke, don't fix it," and certainly don't blame me. UUCP: {pitt,scooter,hal,cwjcc,aablue}!neoucom!sam INTERNET: sam@neoucom.UUCP Scott A. Mason, Coordinator of Systems Operations, NEOUCOM