[AmigaOS 3.x] Interruptions

3 sujets de 1 à 3 (sur un total de 3)

  • glames

      #6059

      Bonjour,

      Les interruptions, le retour! Je suis parti d’un source MOS mais je bloque pour l’instant après le StartTimerInt. Je ne suis pas sûr du tout de la partie “register…”

      Al’aide :-)

      Merci d’avance!

      Glames

      ===========

      #include

      #include

      #include

      /***** Prototypes ********************************************************/

      ULONG AffMsg(void);

      /***** Variables globales ************************************************/

      struct Library *LowLevelBase; /* Low level */

      /* Fonction */

      int main(void)

      {

      /* Variables locales */

      APTR p_idfInterrupt;

      volatile int b_quitter; /* Quitter l’application */

      /* Initialisations */

      b_quitter=0;

      /* Ouvertures bibliothèques */

      LowLevelBase = OpenLibrary(“lowlevel.library”,0);/* librairie lowlevel (bas-niveau) */

      /* Initialisation de l’interruption */

      p_idfInterrupt=AddTimerInt(AffMsg,(APTR)&b_quitter);

      if (p_idfInterrupt)

      {

      printf(“Initialisation de l’interruptionn”);

      /* Démarrage de l’interruption */

      StartTimerInt(p_idfInterrupt, 10000L, 0);

      printf(“Activation de l’interruptionn”);

      /* Attente interruption */

      while (b_quitter==0)

      {

      }

      printf(“Fin de l’attente grâce à AffMsg appelée par interruptionn”);

      /* Arrêt de l’interruption */

      StopTimerInt(p_idfInterrupt);

      /* Libération de l’interruption */

      RemTimerInt(p_idfInterrupt);

      }

      else

      printf(“Can’t init timer interruptn”);

      //Fermeture bibliothèque

      CloseLibrary(LowLevelBase);

      }

      ULONG AffMsg(void)

      {

      register unsigned long a1 __asm(“a1”) = 1;

      return(0);

      }

      ===========

      henes

        #99646

        a1 contient &b_quitter

        pour mettre 1 dans b_quitter, fais qque chose comme *((int *)a1) = 1

        glames

          #99647

          Salut Henes,

          Bien vu, ça fonctionne :-)

          Merci :-)

        3 sujets de 1 à 3 (sur un total de 3)

        • Vous devez être connecté pour répondre à ce sujet.

        Forums AmigaOS, MorphOS et AROS Développement [AmigaOS 3.x] Interruptions

        Amiga Impact