[comp.sys.mac.programmer] VBL task problems solved!

galetti@uservx.afwl.af.mil (05/16/91)

Thanks to all who responded to my post regarding VBL tasks.  The problem I
was having was that A5 was not getting initialized properly in the VBI code.
So, when I reinitialized the vblCount element of the vblTask structure, I
thought I was reinitializing a global variable, but in reality, A5 did not
point to the global stack frame, so there's no telling what I was
reinitializing!  However, I can be sure that I WASN'T reinitializing vblCount,
and consequently, my vblTask was being removed from the queue.

Apple Technical Note #180 has all the answers.  You have to attach a piece of
memory to the vblTask structure.  In this piece of memory you must put the
value of A5 for the main program.  Then, when the VBL task is called, you know
where to find A5 with respect to the vblTask structure.  Alternatively, if you
had very few global variables to deal with in the VBI routine, you could 
simply attach them to the vblTask structure and not even worry about A5, but
simply access the variables you needed to with respect to the address of the
vblTask structure.

The key to it all is managing A5, the global variable base pointer.  There are
also a couple other obscurities that are covered in tech. note #180.  If you
are having problems with the vertical retrace manager, I highly recommend you
get a copy of this note.  Also, feel free to e-mail me if you have any
questions on what I've done, or more likely, if you see a mistake I've made!

Again, many thanks to all who respended!
  ___________________________________________________________________________
 /   Ralph Galetti                  Internet:   galetti@uservx.afwl.af.mil   \
|    PL/LITT                        Interests:  computers, music, computers   |
|    Kirtland AFB, NM 87117-6008                and music, golf, sleep.       |
 \__"No, they couldn't actually prove that it was HIS vomit" - Nigel Tufnel__/