home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / system / alock / source.lha / handler.a < prev   
Text File  |  1993-09-02  |  1KB  |  45 lines

  1. ************************************************************************
  2. *       Handler.a
  3. *
  4. * Handler that grabs all inputevents
  5. *
  6. ************************************************************************
  7. *
  8. * Required includes...
  9. *
  10.         INCLUDE "exec/types.i"
  11.         INCLUDE "exec/io.i"
  12.         INCLUDE "devices/inputevent.i"
  13. *
  14. ************************************************************************
  15. *
  16. * Declarations
  17. *
  18.         xdef    _Grab
  19.     xref    _eventbuf
  20. *
  21. ************************************************************************
  22. *
  23. _Grab:        move.l  a0,-(sp)        ; Save the event list
  24.         move.l    a1,-(sp)
  25. *
  26. *
  27. CheckLoop:    cmp.b   #IECLASS_RAWKEY,ie_Class(a0)    ; Check for key
  28.                 bne.s   NextEvent                       ; If not, next...
  29. *
  30.         lea    _eventbuf,a1
  31.                 move.l  a0,(a1)                         ; Save...
  32. *
  33. NextEvent:      move.l  (a0),d0                         ; Get next event
  34.                 move.l  d0,a0                           ; into a0...
  35.                 bne.s   CheckLoop                       ; Do some more.
  36. *
  37. * All done, just return 0 as the event list...  (in d0)
  38. *
  39.         move.l    (sp)+,a1
  40.                 move.l  (sp)+,d0        ; Get event list back...
  41.         move.l    #0,d0
  42.                 rts                     ; return from handler...
  43.  
  44.         END
  45.