Xref: utzoo comp.os.os9:281 comp.sys.m6809:966
Path: utzoo!utgpu!watmath!clyde!ag@floyd.ATT.COM
From: ag@floyd.ATT.COM
Newsgroups: comp.os.os9,comp.sys.m6809
Subject: MIDI Interface driver for CoCo 3
Keywords: OS-9, Driver, MIDI
Message-ID: <37148@clyde.ATT.COM>
Date: 29 Nov 88 14:57:04 GMT
Sender: nuucp@clyde.ATT.COM
Lines: 102

Hi Mike:

> Congratulations, Ag!  Now have you tried any freeware music
> editors on the beat (hint, hint)?

Jeez, you're persistant!  Actually, NOW I need to know if the 6551 UART
is what you assume for UltiMusE, and if the address of your MIDI interface
matches the address of the RS-232 PAK!  (I expect a negative answer to
at least one of these questions!)

> Technically your drivers are not restricted to the VIRQ
> polling interrupt.  After all, the ACIA driver(s) use interrupts
> directly.

I read in the OS-9 manual that any MultiPak device has to use the
VIRQ interrupt.  I'm not too sure, but I think I read that once the
VIRQ service routine finds the interrupt, it passes control to the
IRQ service routine.  The problem is that a VIRQ interrupt can only
be sampled once every clock tick at its maximum speed, which is way
too slow for MIDI.

> However, the MPI (actually the GIME's attempt to force all
> peripherals into a narrow band of addresses) forces some
> restrictions that are gradually becoming clear thru discoussions
> on these nets and mail lists.  A fundamental requirement of
> OS9's interupt server is that the device's status register
> must be readable when the interrupt comes in.

OK, I agree with that.

> So if your MPI slot is switched to slot 3 and a pak in slot 4
> throws an interrupt, the "whodunit" polling in the interrupt server
> can't see pak 4's device; instead, it may read slot 3's.
> (This is why Sardis and Burke & Burke don't get along).

If the device directly decodes the address without using CTS or
SCS, then it doesn't matter which slot is selected; any address
can be read.  This is how my (modified RS-232 Pak) MIDI interface
works.

> Also why the MPI only accepts interrupts from the CTS-enabled
> slot, so only the "currently active" device's interrupts will
> get thru.  If you hotwire all 4 slots' IRQs together, you
> lose this protection, tho in practice the protection
> was no use anyway.

I see what the problem is with the current set-up.  However, I
don't know if hot-wiring the IRQs (you mean CARTs, right?) will
solve the problem.  The GIME chip must have CART selected as an
interrupt source, and I don't know if this is true under OS9.

> As for running several serial devices at same address,
> this would require some fancy selective enabling of interrupts
> in the ACIA chips, and even then I don't see how two chips could
> co-exist at the same address AND slot.

I don't WANT to run more than one device at the same address.  I
was just wondering how OS9 can support two RS-232 Paks or 2 ModemPaks
at the same time without any conflict.

> Ag, as far as recording MIDI performance under OS9, I think
> you'd have to block all interrupts (orcc #$55 in assembler)
> and run "raw RSDOS mode" during the performance, running sofware
> timing loop and just writing received bytes into memory
> (well you could take the time to parse them).
> Monitor the Coco keyboard for a keypress to break out of the loop.
> All multi-tasking and system clock stop during recording,
> just as with floppy disk accesses only longer.

What about time-stamping the data as it arrives (in the interrupt
routine)?  Regardless of what process is currently running, the
interrupt routine will get called every time a MIDI byte arrives.
The current time can be read and stored along with the MIDI byte.
Then, upon playback, the stored time could be compared with the
elapsed time, and the MIDI byte could be sent out at the right
moment.  I think this could be done using the CoCo 3's built-in
timer to generate an interrupt when it is time to send a note.
In this way, you could keep everything running, and STILL use
MIDI send and receive!

> If you don't like locking up your system for minutes at a time,
> someone suggested to me to buy an outboard hardware MIDI sequencer,
> play your piece into that, then mass-dump it (in a few seconds)
> into the Coco for editing, etc.  Reverse should work well too,
> tho not necessary, as I hope you know from UltiMusE.

Sounds like a lot of extra hardware.  I think I'll play with the
CoCo a little bit more....

> -- 
> Mike Knudsen  Bell Labs(AT&T)   att!ihlpl!knudsen

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
         ________
        /_______/|       __________________________
        |       ||----->/                         /     Ag Primatic
        |       ||<----/_________________________/      ag@floyd.ATT.com
        |_______|/    / / / /   / /   / / /   / /
       /oooooooo/    /_________________________/
      /oooooooo/
      ---------
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=