Path: utzoo!mnetor!uunet!husc6!mailrus!ames!amdahl!dlb!ardent!rap From: rap@ardent.UUCP (Rob Peck) Newsgroups: comp.sys.amiga Subject: Re: assembly use of gameport.device Message-ID: <316@ardent.UUCP> Date: 18 Feb 88 18:51:04 GMT References: <8802160312.AA22247@jade.berkeley.edu> Organization: Dana Computer, Inc., Sunnyvale, CA Lines: 39 In article <8802160312.AA22247@jade.berkeley.edu>, BBOURBIN@UMDD.BITNET (Brett S Bourbin) writes: > Last question: What is the difference between using a: > > DoIo( IO_Message) ; > > or using : > > SendIO( IO_Message ) ; > WaitPort( MsgPort ); > GetMsg( MsgPort ); > DoIO is a synchronous command. Your task sleeps while the I/O is happening. To paraphrase the RKM, DoIO "internally uses" the ReplyPort IF THERE IS ONE, meaning that it sends the I/O message to the device, waits for the reply to be received, and removes the message from the port without your task ever being aware that this has happened. But there does not have to be a ReplyPort specified for the I/O message (if I remember RKM correctly). SendIO is asynchronous. You start the I/O then can go on to do other things. The example given works if and only if the port begin waited on is that which is specified in the mn_ReplyPort. Only when you feel you cannot do anything more until the I/O completes do you need to use WaitPort. If the I/O is done, no wait occurs - the next instruction gets executed right away. In the example provided, it is GetMsg, that removes the message from the port. (If you fail to remove the message, then send it off a second time, it is likely that you will lock up the system - endless loop of linking a list node onto its own tail as I recall). If you provide no ReplyPort in the message when using SendIO, then you can tell that the I/O has completed by using CheckIO(IO_Message). I forget exactly what this function returns, but it effects a polling function on the message. Or use WaitIO(IO_Message) that will put your task to sleep until the I/O finishes. Rob Peck ...ihnp4!hplabs!ardent!rap