home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / glquake_src / in_amigamouse68k.s < prev    next >
Text File  |  2000-01-30  |  3KB  |  111 lines

  1. *
  2. * Copyright (C) 1996-1997 Id Software, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. *
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18. *
  19.  
  20. **
  21. ** Input interrupt routine for mouse control
  22. **
  23. ** used for M68k as well as for PowerPC
  24. **
  25.  
  26.   incdir  "StormC:ASM-Include/"
  27.  
  28.     include "exec/types.i"
  29.     include "devices/inputevent.i"
  30.  
  31.  
  32.     STRUCTURE       InputIntDat,0
  33. ; must be the same as struct InputIntDat in in_amigamouse.c
  34.     ULONG           iid_LeftButtonDown
  35.     ULONG           iid_MidButtonDown
  36.     ULONG           iid_RightButtonDown
  37.     ULONG           iid_LeftButtonUp
  38.     ULONG           iid_MidButtonUp
  39.     ULONG           iid_RightButtonUp
  40.     ULONG           iid_MouseX
  41.     ULONG           iid_MouseY
  42.     ULONG        iid_MouseSpeed
  43.  
  44.  
  45.     code
  46.  
  47.     xdef    _InputIntCode
  48.     xdef    InputIntCode
  49. _InputIntCode:
  50. InputIntCode:
  51.     move.l  a0,-(sp)
  52.     move.l    iid_MouseSpeed(a1),d1
  53. .loop:
  54.     cmp.b   #IECLASS_RAWMOUSE,ie_Class(a0)
  55.     bne.b   .next
  56.     move.w  ie_Code(a0),d0
  57.     btst    #7,d0
  58.     bne.b   .up
  59.     cmp.w   #IECODE_LBUTTON,d0
  60.     beq.b   .lmb_down
  61.     cmp.w   #IECODE_MBUTTON,d0
  62.     beq.b   .mmb_down
  63.     cmp.w   #IECODE_RBUTTON,d0
  64.     beq.b   .rmb_down
  65.     bra.b   .move
  66. .up:
  67.     and.w   #$007f,d0
  68.     cmp.w   #IECODE_LBUTTON,d0
  69.     beq.b   .lmb_up
  70.     cmp.w   #IECODE_MBUTTON,d0
  71.     beq.b   .mmb_up
  72.     cmp.w   #IECODE_RBUTTON,d0
  73.     beq.b   .rmb_up
  74.     bra.b   .move
  75. .lmb_down:
  76.     move.l  #-1,iid_LeftButtonDown(a1)
  77.     clr.l   iid_LeftButtonUp(a1)
  78.     bra.b   .move
  79. .mmb_down:
  80.     move.l  #-1,iid_MidButtonDown(a1)
  81.     clr.l   iid_MidButtonUp(a1)
  82.     bra.b   .move
  83. .rmb_down:
  84.     move.l  #-1,iid_RightButtonDown(a1)
  85.     clr.l   iid_RightButtonUp(a1)
  86.     bra.b   .move
  87. .lmb_up:
  88.     move.l  #-1,iid_LeftButtonUp(a1)
  89.     clr.l   iid_LeftButtonDown(a1)
  90.     bra.b   .move
  91. .mmb_up:
  92.     move.l  #-1,iid_MidButtonUp(a1)
  93.     clr.l   iid_MidButtonDown(a1)
  94.     bra.b   .move
  95. .rmb_up:
  96.     move.l  #-1,iid_RightButtonUp(a1)
  97.     clr.l   iid_RightButtonDown(a1)
  98. .move:
  99.     move.w  ie_X(a0),d0
  100.     muls    d1,d0
  101.     move.l  d0,iid_MouseX(a1)
  102.     move.w  ie_Y(a0),d0
  103.     muls    d1,d0
  104.     move.l  d0,iid_MouseY(a1)
  105. .next:
  106.     move.l  ie_NextEvent(a0),d0
  107.     move.l  d0,a0
  108.     bne.b   .loop
  109.     move.l  (sp)+,d0
  110.     rts
  111.