mark@unisec.UUCP (03/03/87)
Hello, fellow Amigans. This message is coming to you from just the other side of insanity. I was pushed there by a public domain program that doesn't work, inadequate documentation and just plain not knowing what the hell is going on! Let me explain. I recently purchased a Casio CZ-1 synthesizer and after about 3 weeks of waiting, my Golden Hawk MIDI interface box finally arrived. The only software I currently own is Music Studio which, though it provides some MIDI capability, is grossly inadequate for my needs (I'd like to hear about your favorite MIDI-capable music program). Anywho, there is a crude public domain program, written in Lattice C (3.03) which allows you to upload and download patch libraries and to record/play back keyboard input. I have Aztec C, version 3.20a, and probably will have for a while to come, considering how slow MANX is at getting around to updating lower-than- whale-turd developer system licencees such as myself. Though I have gotten most of the program ported to Aztec C by adding the functions.h include, casting to longs where appropriate, etc., I have been driven to distraction in my attempts to get the record/playback stuff to work. The program was designed to use timer A with a countdown interrupt at every 1/11 second. An interrupt handler, written in C is added via AddICRVector (I think that's the correct name - don't have source in front of me) for which I have no documentation. I DO have a set of Amiga developers manuals for which I paid my $100.00, which make NO MENTION of this routine. Though I can surmise what it does, I sure would like more specific information. Reading through the errata sheets for the hardware manual, I found a description of the 4 timers which indicated that timer A is also used by the serial device handler. When? The program uses BeginIO, IOQuick and WaitIO. The interrupt handler does nothing more than count microseconds and seconds, with microseconds being updated at 90909 per hit. When micros reaches 999999, seconds is incremented. The record loop adds to these values the time elapsed since the last interrupt by directly reading the CIAA timer registers. I added an interrupt counter to the interrupt handler and some debug stuff to see if interrupts ever occur. Once in a great while I'll get a 'hit'. I've done things like #asm move.l d1,a4 #endasm at the beginning of the interrupt handler, written the handler entirely in asm, etc. to no avail. Could someone explain to me the significance of setting a4 if the handler only references global data? I can see no reason to do this in such a simple routine which does not utilize a4 in any of its addressing. If someone has already dealt with this or a similar problem, PLEASE tell me what you did. If someone is willing to examine what I have so far, let me know and I'll mail you a copy. If someone has an example of timer / interrupt stuff that works with Aztec 3.20a, again - would you share it with me? Thanks. p.s. I modified the program to use CurrentTime and SubTime (to get the actual delta time) and though it works somewhat, the timing is too sloppy to be useful. -- | Mark R. Rinfret, SofTech, Inc. mark@unisec.usi.com | | Guest of UniSecure Systems, Inc., Newport, RI | | UUCP: {gatech|mirror|cbosgd|uiucdcs|ihnp4}!rayssd!unisec!mark | | work: (401)-849-4174 home: (401)-846-7639 |
bobb@tekfdi.UUCP (03/04/87)
[This article dealt with trying to make an interrupt handler work in a public-
domain MIDI program.]
After 1/2 week, I've succeeded (I think) in getting an interrupt handler to
work. My application was somewhat different, so I don't know if all this
applies, but here goes. . . .
The "move d1,a4" sounds like it comes from the Aztec manual, which is wrong.
The RKM indicates the data area pointer is in a4, so the instruction is
"move.l a1,a4." This is the 2nd thing to be done, however. The first is to
save the existing registers on the stack, since, at least for Aztec, a4 must be
preserved. If memory serves me right, the instruction to do this is
"movem.l d0-d7/a0-a7, -(a7)." Actually, probably only the registers needed by
the compiler must be saved. So my handler looks like:
handleInt()
{
#asm
MOVEM.L D0-D7/A0-A7, -(A7)
MOVE.L A1,A4
#endasm
[C interrupt code]
#asm
MOVEM.L (A7)+, D0-D7/A0-A7
[Set interrupt return code]
#endasm
}
Like I said, the assembler syntax may not be exact. Setting the return code
depends on exactly what you are doing, as discussed in the RKM. I set up the
date field pointer in the Interrupt structure as discussed in the Aztec manual
(probably different for Lattice).
Anyway, I'm using one handler in the vertical blank chain to count frames, and
then call another handler via Cause() every second. So far, the guru has stayed
away. . . .
Bob Bales
Tektronix, Inc.
I help Tektronix make their instruments. They don't help me make my opinions.