Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!oliveb!amiga!kodiak From: kodiak@amiga.UUCP (Robert R. Burns) Newsgroups: comp.sys.amiga Subject: Re: Reading the gameport.device Message-ID: <2431@amiga.UUCP> Date: 16 Jun 88 18:21:03 GMT References: <8806151701.AA08881@jade.berkeley.edu> Reply-To: kodiak@tooter.UUCP (Robert Burns) Organization: Commodore-Amiga Inc, Los Gatos CA Lines: 37 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"\_________