saf@clyde.UUCP (03/25/87)
I recently started trying to write some real-time music software using MPW. MPW can either build stand-alone code or a "tool" which runs under the MPW shell. If I run my code standalone, it works correctly. Yet, compiling the code as a tool, I get receive-buffer overruns from the mac UART chip. The code I am trying to run is a "driver" for the UART to handle MIDI protocol (which requires an external baud rate clock - I can't use Apple's driver). For efficiency, I bypass the normal mechanisms for drivers - I just point the Lvl2DT vectors at my code. All this is as per a MacTutor article from Nov 85 so I know the approach is ok - plus my code works fine standalone. Does anyone know what the MPW shell does that screws up real-time code? Does it install some funny VBL task to watch for command-. or does it disable interrupts for long periods of time? Another question is: can I tell if there is something in the keyboard queue before doing a getc()? I.e., I want to read a character if one is immediately available - I don't want to wait for one. I would guess the approach would be to turn off stdio buffering and look in the system queue for characters - anybody ever try this or know how to look in the system queue? Finally, how does the time manager keep track of time-of-day to 1 millisecond resolution? It can't be using a VBL task - that is 16.7 milliseconds. Is it using an interrupt on horizontal retrace? If so, where does it keep its counter? (I know its not wise to look at the counter directly, but I have to. I can't afford the queue overhead!) Please mail any info, suggestions, etc to me. I'll summarize what I get. Steve Falco AT&T Bell Laboratories {moss, floyd, clyde}!saf