home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / quakeworld_src / client / in_amigamouse68k.s < prev    next >
Encoding:
Text File  |  2000-06-17  |  2.6 KB  |  109 lines

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