Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!rosie!sstreep From: sstreep@next.com (Sam Streeper) Newsgroups: comp.sys.atari.st.tech Subject: Re: MIDI (continued) Message-ID: <294@rosie.NeXT.COM> Date: 16 Feb 91 21:37:29 GMT References: <3979@ryn.mro4.dec.com> Sender: news@NeXT.COM Organization: Next Computer, Inc. Lines: 39 Nntp-Posting-Host: elvis.next.com In article <3979@ryn.mro4.dec.com> miskinis@aisg.enet.dec.com (John Miskinis) writes: > I wrote routine that would scan my data, looking for corruption. >I noticed that when a byte was WRONG, it was a copy of the last on, and >one was missing (the interrupt fired, but the previuos byte was still in >the ACIA buffer. > > I then learned 6800 assembler, and wrote a routine that emulated the >BIOS MIDI functions, and had the EXACT SAME PROBLEM. I then added code to >check the ACIA status, and found that there were overruns. I had been using >the KBD vector MIDISYS to point to my interrupt routine, which is really >only as good as the routine that IT is called from, being the standard >level 6 interrupt handler, which handles keyboard, mouse, and MIDI I/O. > >_John_ (sick with the flu, pardon my rambling in some spots) You're exactly right that you're being bit by overruns. If any routine spends too long with interrupts disabled, or if you spend too long parsing mouse or keyboard packets (which is done at the same interrupt level as the midi handler) and a second byte comes in, you get an overrun condition, and one symptom of this with the default hanlder is a repeated character. I will post a couple of programs here that demonstrate how easy it is to get this problem. One program blasts ordered data out the midi port on a transmit buffer empty interrupt, so the data goes out as fast as possible. The other, run on another machine, scans the received data and reports errors. I sent these to Atari years ago asking for help, but I was smarter about the problem than anyone I could get in touch with there... The solution for me was to diverge from standard midi format and write a packetized layered system that insures that the received data arrives error free. This obviously is not an option if you must talk to synths. The problem should be solvable by rewriting the mouse and keyboard handlers, minimizing other interrupts and critical sections. Obviously this is a big job, so I wish you the best and let the world know when you find a solution! My test apps will be here soon... -sam