cmcclary@bronze.ucs.indiana.edu (Charles McClary) (01/23/91)
I am struggling with setting a procedure to jGNEFilter. I have a feeling I need to add assembly somewhere (setting the jGNEFilter are, I think). Can this be done in C? I have included my source for reference. Thanks, Charles McClary cmcclary@bronze.ucs.indiana.edu /********** SOURCE **********/ /********** Attach procedure to jGNEFilter ***********/ #include <SetUpA4.h> #defineNIL_POINTER0L ProcPtr oldjGNEFilter; Str255 trash; pascal void NewjGNEFilter(void); void ResetFlags(void); void main(void); pascal void NewjGNEFilter() { SetUpA4(); asm { move.l oldjGNEFilter,A1; /* save the global in register a1 */ } RestoreA4(); asm { unlk A6; /* remove the stack frame */ jmp (A1); /* jump to the old SystemEvent */ } } /********** main **********/ void main() { Handle myHandle = NIL_POINTER; Ptr myPtr; SysEnvRec world; Str255 *namePtr; asm { move.l A0, myPtr /* copy address of this program to myPtr */ } RememberA0(); SetUpA4(); if (!Button()) { myHandle = RecoverHandle(myPtr); DetachResource(myHandle); oldjGNEFilter = JGNEFilter; JGNEFilter = (ProcPtr) NewjGNEFilter; SysBeep(1); } RestoreA4(); } Charles McClary Workstations Division University Computing Services Indiana University cmcclary@bronze.ucs.indiana.edu
aep@world.std.com (Andrew E Page) (01/24/91)
Check out the first line of code in main... in your variable declarations there your are initializing a handle to NIL. It is possible that the compiler is using the A0 register to initialize this variable and thus blowing the contents of A0 away before your first assembly block can get to it. One way to to check on this is to using the dissasembler pressent in what ever your debugger is and examine the code carefully. -- Andrew E. Page (Warrior Poet) | Decision and Effort The Archer and Arrow Concepts Engineering | The difference beteween what we are CIS:70202,234 BIX:page1 | and what we want to be.