home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / devices / keyboard / keyhandler.a next >
Encoding:
Text File  |  1980-02-03  |  3.0 KB  |  83 lines

  1. * Copyright (c) 1990 Commodore-Amiga, Inc.
  2. *
  3. * This example is provided in electronic form by Commodore-Amiga, Inc. for
  4. * use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals.
  5. * The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
  6. * information on the correct usage of the techniques and operating system
  7. * functions presented in this example.  The source and executable code of
  8. * this example may only be distributed in free electronic form, via bulletin
  9. * board or as part of a fully non-commercial and freely redistributable
  10. * diskette.  Both the source and executable code (including comments) must
  11. * be included, without modification, in any copy.  This example may not be
  12. * published in printed form or distributed with any commercial product.
  13. * However, the programming techniques and support routines set forth in
  14. * this example may be used in the development of original executable
  15. * software products for Commodore Amiga computers.
  16. * All other rights reserved.
  17. * This example is provided "as-is" and is subject to change; no warranties
  18. * are made.  All use is at your own risk.  No liability or responsibility
  19. * is assumed.
  20. *
  21. ***********************************************************************
  22.  
  23. *
  24. * This is in two parts...
  25. *
  26. * Compile the C code with:
  27. *    LC -cfist -v keyreset.c
  28. *
  29. * Assemble this ASM code with:  (Cape 68K)
  30. *    CAsm -a keyhandler.a -i include: -o keyhandler.o
  31. *
  32. * Link with:
  33. *    BLink FROM lib:c.o+keyreset.o+keyhandler.o LIB LIB:lc.lib LIB:amiga.lib TO keyreset
  34. *
  35.  
  36. *
  37. * Keyboard reset handler that signals the task in the structure...
  38. *
  39. ************************************************************************
  40. * Required includes...
  41. *
  42.         INCLUDE "exec/types.i"
  43.         INCLUDE "exec/io.i"
  44.         INCLUDE "devices/keyboard.i"
  45. *
  46.         xref    _AbsExecBase    ; We get this from outside...
  47.         xref    _LVOSignal      ; We get this from outside...
  48. *
  49. ************************************************************************
  50. * Make the entry point external...
  51. *
  52.         xdef    _ResetHandler
  53. *
  54. ************************************************************************
  55. *
  56. * This is the input handler
  57. * The is_Data field is passed to you in a1.
  58. *
  59. * This is the structure that is passed in A1 in this example...
  60. *
  61.         STRUCTURE       MyData,0
  62.         APTR            MyTask
  63.         ULONG           MySignal
  64. *
  65. ************************************************************************
  66. * The handler gets called here...
  67. *
  68. _ResetHandler:  move.l  MySignal(a1),d0 ; Get signal to send
  69.                 move.l  MyTask(a1),a1           ; Get task
  70. *
  71. * Now signal the task...
  72. *
  73.                 move.l  a6,-(sp)        ; Save the stack...
  74.                 move.l  _AbsExecBase,a6 ; Get ExecBase
  75.                 jsr     _LVOSignal(a6)  ; Send the signal
  76.                 move.l  (sp)+,a6        ; Restore A6
  77. *
  78. * Return to let other handlers execute.
  79. *
  80.                 rts                     ; return from handler...
  81. *
  82. ************************************************************************
  83.