home *** CD-ROM | disk | FTP | other *** search
- /* This unit isn't CodeWarrior-compatible yet. It is a bit hard to make it so. */
- /* CodeWarrior users can always use MySlotVBL. After all, mixing languages isn't */
- /* hard as it used to be. /Ingemar */
-
-
- #include <Retrace.h>
- #include <Start.h>
-
- Boolean InstallVBLCounter(void);
- Boolean RemoveVBLCounter(void);
- pascal int VBLCounterProc(void);
-
- typedef struct {
- VBLTask task;
- short videoslot;
- long count;
- } VBLCounterRec;
-
- VBLCounterRec VBLCounter;
-
- /************************************************************/
-
- Boolean InstallVBLCounter(void)
- {
- DefVideoRec VBLVideoDefault;
-
- VBLCounter.task.vblAddr = VBLCounterProc;
- VBLCounter.task.qType = vType;
- VBLCounter.task.vblCount = 1;
- VBLCounter.task.vblPhase = 0;
-
- GetVideoDefault(&VBLVideoDefault);
- VBLCounter.videoslot = VBLVideoDefault.sdSlot;
-
- VBLCounter.count = 0;
-
- return (SlotVInstall((QElemPtr)&VBLCounter.task, VBLCounter.videoslot)== noErr);
- }
-
- /************************************************************/
-
- Boolean RemoveVBLCounter(void)
- {
- return (SlotVRemove((QElemPtr)&VBLCounter.task, VBLCounter.videoslot) ==noErr);
- }
-
- /************************************************************/
-
- pascal int VBLCounterProc(void)
- {
- asm {
- MOVE.W #1, OFFSET(VBLCounterRec, task.vblCount) (A0)
- ADDQ.L #1, OFFSET(VBLCounterRec, count) (A0)
- }
-
- return(true);
- }
-