Path: utzoo!utgpu!attcan!uunet!lll-winken!ncis!helios.ee.lbl.gov!pasteur!agate!bionet!csd4.milw.wisc.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: Help With VBL Tasks Keywords: VBL task; post itself; BOMB Message-ID: <445@internal.Apple.COM> Date: 19 Jan 89 17:33:47 GMT References: <8343@orstcs.CS.ORST.EDU> Organization: Advanced Technology Group, Apple Computer Lines: 40 In article <8343@orstcs.CS.ORST.EDU> borcelf@jacobs.cs.orst.edu (Fernando Borcel) writes: >Here's what I wrote: > > procedure myVbl; > var > VBLTask : QElemPtr; > begin > SetUpA5; > > FlashMenuBar(0); {my "TASK"} > > new(VBLTask); > VBLTask^ := myVBLTask^; > if vInstall(VBLTask) <> NoErr then {Enqueue for Next VBL task} > exitToShell; > > RestoreA5; > end; There are a couple of problems here: (1) A VBL task runs at interrupt level, and can't call any routins that allocate memory. FlashMenuBar does allocate memory (it's listed in the chart in Inside Mac). I suspect that New could also. (2) The technique you use to set up the task to be executed again is not right. You don't need to creata new task block. Instead you shouldsimply reset the vbl counter in the existing task block. A pointer to the task block is passed in A0 when your VBL code is called. There are various ways to get this register in Pascal, depending on the development system. Your initial installation code looks OK to me. -- Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr