home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 180.lha / AutoIconOpen.asm < prev    next >
Assembly Source File  |  1988-04-28  |  6KB  |  185 lines

  1. * Assembly language version of AutoIconOpen.c
  2. * Translated by John Veldthuis (Taranaki)
  3. * Only works under AmigaDOS 1.1, need to create port to receive reply msgs
  4. * See AutoIconOpen.c for documentation
  5. *
  6.         section "AutoOpenIcon",code
  7.         NOLIST
  8.         NOPAGE
  9.         include "exec/types.i"
  10.         include "exec/io.i"
  11.         include "exec/devices.i"
  12.         include "devices/input.i"
  13.         include "devices/inputevent.i"
  14.         LIST
  15.         xref    _AbsExecBase
  16.         xref    _LVOOpenDevice
  17.         xref    _LVOCloseDevice
  18.         xref    _LVODoIO
  19.  
  20. Start   lea     DevName,a0              ;"Input.Device",0
  21.         clr.l   d0
  22.         lea     IORequest,a1            ;IORequest Structure
  23.         clr.l   d1
  24.         move.l  _AbsExecBase,a6
  25.         jsr     _LVOOpenDevice(a6)      ;open input.device
  26.         tst.l   d0
  27.         beq.s   Okay                    ;zero return if device open
  28.         move.l  #10,d0                  ;If device not open signal errorto CLI
  29.         rts
  30. Okay    lea     IORequest,a0            ;Pointer for setup
  31.         move.w  #IND_WRITEEVENT,IO_COMMAND(a0)   ;Signal event for Intuition
  32.         move.b  #0,IO_FLAGS(a0)
  33.         move.l  #ie_SIZEOF,IO_LENGTH(a0) ;Length of Event structure
  34.         lea     Event,a2
  35.         move.l  a2,IO_DATA(a0)          ;Address of event structure
  36.  
  37. ** Move pointer to top lefthand corner **
  38.  
  39.         lea     Event,a0
  40.         move.l  #0,ie_NextEvent(a0)     ;no next event
  41.         move.b  #IECLASS_RAWMOUSE,ie_Class(a0)
  42.         move.l  #0,ie_TimeStamp+TV_SECS(a0)
  43.         move.l  #0,ie_TimeStamp+TV_MICRO(a0)
  44.         move.w  #IECODE_NOBUTTON,ie_Code(a0)   ;no button down
  45.         move.w  #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
  46.         move.w  #-640,ie_X(a0)           ;move mouse to upper left
  47.         move.w  #-512,ie_Y(a0)
  48.         lea     IORequest,a1
  49.         jsr     _LVODoIO(a6)
  50.         tst.l   d0
  51.         bne     Error                   ;Error from IO if not Null returned
  52.  
  53. *** Move pointer to bottom righthand corner **
  54.  
  55.         lea     Event,a0
  56.         move.l  #0,ie_NextEvent(a0)     ;no next event
  57.         move.b  #IECLASS_RAWMOUSE,ie_Class(a0)
  58.         move.l  #0,ie_TimeStamp+TV_SECS(a0)
  59.         move.l  #0,ie_TimeStamp+TV_MICRO(a0)
  60.         move.w  #IECODE_LBUTTON,ie_Code(a0)   ;left button down
  61.         move.w  #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
  62.         move.w  #638,ie_X(a0)           ;move mouse to lower right
  63.         move.w  #398,ie_Y(a0)
  64.         lea     IORequest,a1
  65.         jsr     _LVODoIO(a6)
  66.         tst.l   d0
  67.         bne     Error                   ;Error from IO if not Null returned
  68.  
  69. ** resize window **
  70.  
  71.         lea     Event,a0
  72.         move.l  #0,ie_NextEvent(a0)
  73.         move.b  #IECLASS_RAWMOUSE,ie_Class(a0)
  74.         move.l  #0,ie_TimeStamp+TV_SECS(a0)
  75.         move.l  #0,ie_TimeStamp+TV_MICRO(a0)
  76.         move.w  #IECODE_LBUTTON!IECODE_UP_PREFIX,ie_Code(a0) ;left button up
  77.         move.w  #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
  78.         move.w  #-100,ie_X(a0)          ;move mouse left 100
  79.         move.w  #0,ie_Y(a0)
  80.         lea     IORequest,a1
  81.         jsr     _LVODoIO(a6)
  82.         tst.l   d0
  83.         bne     Error                   ;Error from IO if not Null returned
  84.  
  85. ** Move to Disk Icon (595,45)? **
  86.  
  87.         lea     Event,a0
  88.         move.l  #0,ie_NextEvent(a0)
  89.         move.b  #IECLASS_RAWMOUSE,ie_Class(a0)
  90.         move.l  #0,ie_TimeStamp+TV_SECS(a0)
  91.         move.l  #0,ie_TimeStamp+TV_MICRO(a0)
  92.         move.w  #IECODE_NOBUTTON,ie_Code(a0) ;no button
  93.         move.w  #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
  94.         move.w  #55,ie_X(a0)            ;move mouse to icon
  95.         move.w  #-355,ie_Y(a0)
  96.         lea     IORequest,a1
  97.         jsr     _LVODoIO(a6)
  98.         tst.l   d0
  99.         bne     Error                   ;Error from IO if not Null returned
  100.  
  101. ** Press left button **
  102.  
  103.         lea     Event,a0
  104.         move.l  #0,ie_NextEvent(a0)
  105.         move.b  #IECLASS_RAWMOUSE,ie_Class(a0)
  106.         move.l  #0,ie_TimeStamp+TV_SECS(a0)
  107.         move.l  #0,ie_TimeStamp+TV_MICRO(a0)
  108.         move.w  #IECODE_LBUTTON,ie_Code(a0) ;left button down
  109.         move.w  #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
  110.         move.w  #0,ie_X(a0)
  111.         move.w  #0,ie_Y(a0)
  112.         lea     IORequest,a1
  113.         jsr     _LVODoIO(a6)
  114.         tst.l   d0
  115.         bne     Error                   ;Error from IO if not Null returned
  116.  
  117. ** Press left button again **
  118.  
  119.         lea     Event,a0
  120.         move.l  #0,ie_NextEvent(a0)
  121.         move.b  #IECLASS_RAWMOUSE,ie_Class(a0)
  122.         move.l  #0,ie_TimeStamp+TV_SECS(a0)
  123.         move.l  #0,ie_TimeStamp+TV_MICRO(a0)
  124.         move.w  #IECODE_LBUTTON,ie_Code(a0) ;left button down again
  125.         move.w  #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
  126.         move.w  #0,ie_X(a0)
  127.         move.w  #0,ie_Y(a0)
  128.         lea     IORequest,a1
  129.         jsr     _LVODoIO(a6)
  130.         tst.l   d0
  131.         bne     Error                   ;Error from IO if not Null returned
  132.  
  133. ** All finished so close device and return to CLI **
  134.  
  135.         lea     IORequest,a1
  136.         jsr     _LVOCloseDevice(a6)
  137.         moveq.l #0,d0                   ;inform CLI of success
  138.         rts
  139.  
  140. Error   lea     IORequest,a1
  141.         jsr     _LVOCloseDevice(a6)
  142.         move.l  #20,d0
  143.         rts
  144.  
  145.         SECTION "Data",DATA
  146.  
  147. DevName dc.b    'input.device',0
  148.  
  149.         CNOP    0,2
  150. IORequest
  151.         dc.l    0
  152.         dc.b    0
  153.         dc.b    0
  154.         dc.l    0
  155.         dc.l    0
  156.         dc.l    0
  157.         dc.w    0
  158.         dc.l    0
  159.         dc.l    0
  160.         dc.w    0
  161.         dc.b    0
  162.         dc.b    0
  163.         dc.l    0
  164.         dc.l    0
  165.         dc.l    0
  166.         dc.l    0
  167.         dc.l    0
  168.         dc.l    0
  169.         dc.l    0
  170.         dc.l    0
  171.  
  172. Event   dc.l    0
  173.         dc.b    0
  174.         dc.b    0
  175.         dc.w    0
  176.         dc.w    0
  177.         dc.l    0
  178.         dc.w    0
  179.         dc.w    0
  180.         dc.l    0
  181.         dc.l    0
  182.         dc.l    0
  183.         dc.l    0
  184.         end
  185.