BBOURBIN@UMDD.BITNET (Brett S Bourbin) (06/15/88)
I want to use the first port on the Amiga to send mouse movements to my program, so I configured it and now I am ready to read the events. Can I do a: move.b #GPD_READEVENT,IO_COMMAND(a2) ; read cmd in io block move.l eventbufbase,a3 ; get the buffer address move.l a3,IO_DATA(a2) ; tell where to store evnt move #ie_SIZEOF,IO_LENGTH(a2) ; set the size and then do a: move.l a2,a1 ; pass io block callsys SendIO ; ASYNC io send Now I have asked for a event to be reported, according to my triggers set, (more on those later). The program I am using this for is a loop which reads the mouse port, if there is a message, processes the mouse movement or triggers, and then updates the grapgics according to results. So I want to be able to READ the gameport each time through the loop. Now, here comes the real question {AT LAST! 8^) }: Can I use the GetMsg() call, since it will return a zero if there is no messages waiting, and if I get a result on the first call to the routine, do more until I get a zero? I want to do this because I only need the latest event. Is this the best way of doing what I want, or should I do a CheckIO() call and if I get a non-zero return then do a GetMsg()? Now about the triggers- I set the mouse to report movements >= 2 in any direction, also for all up and down mouse buttons. Can I set the timeout value in the trigger structure to some value so it will never timeout? I do not need it, and I don't just want to set it to some large value and have it still timeout if let alone for a long time. Thanks for any help you may lend. Brett S Bourbin Internet: brett@PIGPEN.UMD.EDU Instructional Computing Programs -- University of Maryland, College Park
kodiak@amiga.UUCP (Robert R. Burns) (06/17/88)
In article <8806151701.AA08881@jade.berkeley.edu> BBOURBIN@UMDD.BITNET (Brett S Bourbin) writes: > >The program I am using this for is a loop which reads the mouse port, if there >is a message, processes the mouse movement or triggers, and then updates the >grapgics according to results. So I want to be able to READ the gameport each >time through the loop. Now, here comes the real question {AT LAST! 8^) }: > > Can I use the GetMsg() call, since it will return a zero if there is no > messages waiting, and if I get a result on the first call to the routine, > do more until I get a zero? I want to do this because I only need the > latest event. Is this the best way of doing what I want, or should I do > a CheckIO() call and if I get a non-zero return then do a GetMsg()? The simple answer is yes, you can just use GetMsg(). The next complication is that you can set the MsgPort.mp_Flags to PA_IGNORE so the signal isn't sent to you, because you're polling for it. Furthermore, you will get no more messages than you've sent READEVENT commands for (you supplied the buffer, remember). If you've sent only one command, and nothing else shares the message port, you know there are only zero or one messages at the port. But this all reeks of a busy loop. I hope the global context of your GetMsg call makes that not so. If it's in a top of frame interrupt list, make it low priority: the gameport is at priority zero so you'ld want to be lower than that so you're not getting reports that are already a frame old. > >Now about the triggers- I set the mouse to report movements >= 2 in any >direction, also for all up and down mouse buttons. Can I set the timeout >value in the trigger structure to some value so it will never timeout? A timeout value of zero is the special case that never triggers that you want to set. - Kodiak -- | / _ _|' _ |/ Bob Burns . . . . .---. . |/ (_)(_)|(_\|\ USENET: amiga!kodiak / \ |\ /| | | __ / \ |\ Kodiak \ _______/ A \| \/ |_|_|___|/ A \ | \ Software "Dedicated to the Science of Fun"\_________
berry@hor-res.UUCP (No comment) (06/17/88)
In article <8806151701.AA08881@jade.berkeley.edu>, BBOURBIN@UMDD.BITNET (Brett S Bourbin) writes: > > Can I use the GetMsg() call, since it will return a zero if there is no > messages waiting, and if I get a result on the first call to the routine, > do more until I get a zero? I want to do this because I only need the > latest event. Is this the best way of doing what I want, or should I do > a CheckIO() call and if I get a non-zero return then do a GetMsg()? I believe you can use either one, as long as you specify the right args. Since you started with a SendIO (?? maybe DoIO ??) you can use CheckIO to see if a message came back, and GetMsg to remove it. Alternately use GetMsg and check for a non null return. > > Now about the triggers- I set the mouse to report movements >= 2 in any > direction, also for all up and down mouse buttons. Can I set the timeout > value in the trigger structure to some value so it will never timeout? I Set them to zero. A time of Zero means infinity. > > Thanks for any help you may lend. > No prob. -- -Steve Berry- ...!bunny!hor-res!berry "Dare to be gorgeous and unique. But don't ever be cryptic or otherwise Unfathomable. Make it unforgettably great." Intuition Reference Manual, pg 231.