home *** CD-ROM | disk | FTP | other *** search
- * Assembly language version of AutoIconOpen.c
- * Translated by John Veldthuis (Taranaki)
- * Only works under AmigaDOS 1.1, need to create port to receive reply msgs
- * See AutoIconOpen.c for documentation
- *
- section "AutoOpenIcon",code
- NOLIST
- NOPAGE
- include "exec/types.i"
- include "exec/io.i"
- include "exec/devices.i"
- include "devices/input.i"
- include "devices/inputevent.i"
- LIST
- xref _AbsExecBase
- xref _LVOOpenDevice
- xref _LVOCloseDevice
- xref _LVODoIO
-
- Start lea DevName,a0 ;"Input.Device",0
- clr.l d0
- lea IORequest,a1 ;IORequest Structure
- clr.l d1
- move.l _AbsExecBase,a6
- jsr _LVOOpenDevice(a6) ;open input.device
- tst.l d0
- beq.s Okay ;zero return if device open
- move.l #10,d0 ;If device not open signal errorto CLI
- rts
- Okay lea IORequest,a0 ;Pointer for setup
- move.w #IND_WRITEEVENT,IO_COMMAND(a0) ;Signal event for Intuition
- move.b #0,IO_FLAGS(a0)
- move.l #ie_SIZEOF,IO_LENGTH(a0) ;Length of Event structure
- lea Event,a2
- move.l a2,IO_DATA(a0) ;Address of event structure
-
- ** Move pointer to top lefthand corner **
-
- lea Event,a0
- move.l #0,ie_NextEvent(a0) ;no next event
- move.b #IECLASS_RAWMOUSE,ie_Class(a0)
- move.l #0,ie_TimeStamp+TV_SECS(a0)
- move.l #0,ie_TimeStamp+TV_MICRO(a0)
- move.w #IECODE_NOBUTTON,ie_Code(a0) ;no button down
- move.w #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
- move.w #-640,ie_X(a0) ;move mouse to upper left
- move.w #-512,ie_Y(a0)
- lea IORequest,a1
- jsr _LVODoIO(a6)
- tst.l d0
- bne Error ;Error from IO if not Null returned
-
- *** Move pointer to bottom righthand corner **
-
- lea Event,a0
- move.l #0,ie_NextEvent(a0) ;no next event
- move.b #IECLASS_RAWMOUSE,ie_Class(a0)
- move.l #0,ie_TimeStamp+TV_SECS(a0)
- move.l #0,ie_TimeStamp+TV_MICRO(a0)
- move.w #IECODE_LBUTTON,ie_Code(a0) ;left button down
- move.w #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
- move.w #638,ie_X(a0) ;move mouse to lower right
- move.w #398,ie_Y(a0)
- lea IORequest,a1
- jsr _LVODoIO(a6)
- tst.l d0
- bne Error ;Error from IO if not Null returned
-
- ** resize window **
-
- lea Event,a0
- move.l #0,ie_NextEvent(a0)
- move.b #IECLASS_RAWMOUSE,ie_Class(a0)
- move.l #0,ie_TimeStamp+TV_SECS(a0)
- move.l #0,ie_TimeStamp+TV_MICRO(a0)
- move.w #IECODE_LBUTTON!IECODE_UP_PREFIX,ie_Code(a0) ;left button up
- move.w #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
- move.w #-100,ie_X(a0) ;move mouse left 100
- move.w #0,ie_Y(a0)
- lea IORequest,a1
- jsr _LVODoIO(a6)
- tst.l d0
- bne Error ;Error from IO if not Null returned
-
- ** Move to Disk Icon (595,45)? **
-
- lea Event,a0
- move.l #0,ie_NextEvent(a0)
- move.b #IECLASS_RAWMOUSE,ie_Class(a0)
- move.l #0,ie_TimeStamp+TV_SECS(a0)
- move.l #0,ie_TimeStamp+TV_MICRO(a0)
- move.w #IECODE_NOBUTTON,ie_Code(a0) ;no button
- move.w #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
- move.w #55,ie_X(a0) ;move mouse to icon
- move.w #-355,ie_Y(a0)
- lea IORequest,a1
- jsr _LVODoIO(a6)
- tst.l d0
- bne Error ;Error from IO if not Null returned
-
- ** Press left button **
-
- lea Event,a0
- move.l #0,ie_NextEvent(a0)
- move.b #IECLASS_RAWMOUSE,ie_Class(a0)
- move.l #0,ie_TimeStamp+TV_SECS(a0)
- move.l #0,ie_TimeStamp+TV_MICRO(a0)
- move.w #IECODE_LBUTTON,ie_Code(a0) ;left button down
- move.w #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
- move.w #0,ie_X(a0)
- move.w #0,ie_Y(a0)
- lea IORequest,a1
- jsr _LVODoIO(a6)
- tst.l d0
- bne Error ;Error from IO if not Null returned
-
- ** Press left button again **
-
- lea Event,a0
- move.l #0,ie_NextEvent(a0)
- move.b #IECLASS_RAWMOUSE,ie_Class(a0)
- move.l #0,ie_TimeStamp+TV_SECS(a0)
- move.l #0,ie_TimeStamp+TV_MICRO(a0)
- move.w #IECODE_LBUTTON,ie_Code(a0) ;left button down again
- move.w #IEQUALIFIER_RELATIVEMOUSE,ie_Qualifier(a0)
- move.w #0,ie_X(a0)
- move.w #0,ie_Y(a0)
- lea IORequest,a1
- jsr _LVODoIO(a6)
- tst.l d0
- bne Error ;Error from IO if not Null returned
-
- ** All finished so close device and return to CLI **
-
- lea IORequest,a1
- jsr _LVOCloseDevice(a6)
- moveq.l #0,d0 ;inform CLI of success
- rts
-
- Error lea IORequest,a1
- jsr _LVOCloseDevice(a6)
- move.l #20,d0
- rts
-
- SECTION "Data",DATA
-
- DevName dc.b 'input.device',0
-
- CNOP 0,2
- IORequest
- dc.l 0
- dc.b 0
- dc.b 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.w 0
- dc.l 0
- dc.l 0
- dc.w 0
- dc.b 0
- dc.b 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
-
- Event dc.l 0
- dc.b 0
- dc.b 0
- dc.w 0
- dc.w 0
- dc.l 0
- dc.w 0
- dc.w 0
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
- end
-