Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!homxb!mtuxo!tas From: tas@mtuxo.UUCP (T.SKROBALA) Newsgroups: comp.sys.amiga Subject: Re: losing MIDI bytes Message-ID: <755@mtuxo.UUCP> Date: Mon, 21-Sep-87 02:13:31 EDT Article-I.D.: mtuxo.755 Posted: Mon Sep 21 02:13:31 1987 Date-Received: Tue, 22-Sep-87 01:32:00 EDT References: <8709110105.AA27649@cory.Berkeley.EDU> <27773@sun.uucp> Organization: AT&T, Middletown NJ Lines: 39 Summary: Chuck McManis and netnews come to the rescue Thanks to all who responded to my question about losing MIDI system-exclusive bytes. I didn't have any luck with Forbid()/Permit(), and I wasn't keen on busy waiting with all interrupts locked out, and I was indeed using SetIntVector(), so I tried Chuck McManis'suggestion, and it worked beautifully. Now my Read Buffer Full handler has assembly code at the end that does something like the following: for( i = 0 ; i < 50 ; i++ ) { if( custom.intreq & INTF_RBF ) goto RBFHandler ; /* do it all again w.o. leaving the handler */ } return ; Just checking the bit once isn't good enough: apparently you can still get screwed from time to time if the bit gets set right after you leave the handler. The loop does cause a few (~300) uSeconds of wasted time if there is indeed nothing coming down the pike, but the gain in integrity is worth it. (I may be able to trim a few iterations off the loop and still maintain integrity, but I know that there's a point where I start losing again.) By the way, when I was struggling with the problem, I saw loss of bytes even when the MIDI data was only coming in bursts of 6 bytes, so I imagine that the problem could arise even with just ordinary NOTE_ON/ NOTE_OFF types of stuff. Anyway, Chuck's solution works, even with vd0: running (not that I ever suspected that, but some people did), and I suspect that serial.device will never work reliably unless it, too, has the fix put in. Now, can someone tell me just *what* was running and causing me to lose those bytes before? There isn't much that runs at priority higher than the serial read interrupt, and I only lost about 1 byte in 15000, i.e. about 1 every 5 seconds. What high priority CPU-hog thing happens on a more or less idle Amiga once every 5 seconds? Am I guaranteed that Chuck's solution will *always* work? Tom Skrobala AT&T mtuxo!tas