[comp.sys.mac.programmer] VBL Question/Code Plea

adam@mit-amt.MEDIA.MIT.EDU (Adam Glass) (08/26/89)

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.

While we're on the subject, how can I tell LSC to compile my code as
one code resource? Whenver I tell it to compile it as an INIT, it complains
that there are too many code resources or segments or something like that
(it's been a while since I've tried... I no longer remember the exact output,
though it was something like that).

Adam
--
"What?! He didn't fall? Inconceivable!"  (email: adam@media-lab.media.mit.edu)
"You keep using that word... I do not think it means what you think it means."
(All stolen quotes taken from The Princess Bride) Hmm... 18 spaces left. Moof!

sam@neoucom.UUCP (Scott A. Mason) (08/31/89)

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 <VRetraceMgr.h>

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