home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / DevCon88.1 / JimmDemos / DemoSource / vint.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  1.5 KB  |  55 lines

  1. /* vint.c -- video interrupts
  2.  * Copyright (c) 1988, I and I Computing, and Commodore-Amiga, Inc.
  3.  *
  4.  *
  5.  * Executables based on this information may be used in software
  6.  * for Commodore Amiga computers.  All other rights reserved.
  7.  *
  8.  * This information is provided "as is"; no warranties are made.
  9.  * All use is at your own risk, and no liability or responsibility is assumed.
  10.  */
  11.  
  12. #include "sysall.h"
  13.  
  14. #define VBLANK_TOO    0        /* do we want vblank interrupt    */
  15.  
  16. /* don't change this around without modifying intSignal() to suit    */
  17. struct SigStuff    {
  18.     LONG        ss_Signals;        /* send these signals ...    */
  19.     struct Task    *ss_Task;        /* ... to this task.        */
  20. }    sigstuff;
  21.  
  22. struct Interrupt    vidint1;        /* hang this off of vertical blank        */
  23. struct Interrupt    vidint2;        /* hang this off of copper interrupt    */
  24.  
  25. VOID intSignal();        /* interrupt server, signals me    */
  26.  
  27. installHandlers( signum )
  28. int        signum;            /* handlers will post this signal    */
  29. {
  30.     /* fill out my little bundle o' info    */
  31.     sigstuff.ss_Signals = (long) 1 << signum;
  32.     sigstuff.ss_Task = FindTask( 0L );
  33.  
  34.     /* set up interrupt node    */
  35.     vidint1.is_Node.ln_Pri = 0;
  36.     vidint1.is_Node.ln_Name = NULL;
  37.     vidint1.is_Data = (APTR) &sigstuff;
  38.     vidint1.is_Code = intSignal;
  39.  
  40.     vidint2 = vidint1;        /* another copy, for a different server chain    */
  41.  
  42. #if VBLANK_TOO
  43.     AddIntServer( (long) INTB_VERTB, &vidint1 );
  44. #endif
  45.     AddIntServer( (long) INTB_COPER, &vidint2 );
  46. }
  47.  
  48. removeHandlers()
  49. {
  50. #if VBLANK_TOO
  51.     RemIntServer( (long) INTB_VERTB, &vidint1 );
  52. #endif
  53.     RemIntServer( (long) INTB_COPER, &vidint2 );
  54. }
  55.