[comp.sys.mac.programmer] Debugging code that uses the MIDI Manager

schiff@birch.berkeley.edu (Michael Schiff) (05/31/90)

I've been trying to get started writing programs that use the MIDI manager (in
Think C 4.0), but I'm having lots of problems.

Basically, I can't seem to use MIDIWakeUp() properly.  The real problem,
though, is that every time my program crashes (in a routine called by
MIDIWakeUp()), I have to reboot my Mac.  This is a major pain.

I'm using the Think C source-code debugger, and I have MacsBug installed.
Neither exit-to-shell nor exit-to-application seems to work.  I suspect my
problem has something to do with not setting up the A5 register properly, but
I'm not sure about that.

Any suggestions on how I can get back to Think C (or even the Finder) without
rebooting?

Thanks in advance...

Mike

nick@lfcs.ed.ac.uk (Nick Rothwell) (05/31/90)

In article <SCHIFF.90May30115338@birch.berkeley.edu>, schiff@birch (Michael Schiff) writes:
>I've been trying to get started writing programs that use the MIDI manager (in
>Think C 4.0), but I'm having lots of problems.

I can't help you with your specific problem (I'm not using
MIDIWakeUp), but can only give a general piece of advice:

Keep the interrupt routines (read hooks and so on) as small and simple
as possible. Don't ever try to do graphics and printing in them.
Assigning global variables (after setting up A5) and calling some
other MM routines (e.g. output) are OK things to do, but I wouldn't do
anything else. These routines are running in deep space, and I'm not
surprised you can't debug them. Hence: keep them small and simple, and
do printing by running a global circular print buffer or something.
Less chance to get them wrong this way.

>Mike

		Nick.
--
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
		   Ich weiss jetzt was kein Engel weiss