A89: Re: Re: Re: Re: Grayscale troubles
[Prev][Next][Index][Thread]
A89: Re: Re: Re: Re: Grayscale troubles
>Hello!
> I knew if I started messing around with interrupts I'd get into trouble.
Here's my problem: After I activate my interrupt routine,
>I get lots of Address Errors. I know my routine is getting called right
because I tried putting a DrawStr statement in it. I read in
> Jimmy Mardell's 68K guide that there is a special command to return from
interrupts, rte. TI-GCC doesn't know that my interrupt
> handler is an interrupt handler, so I'm sure it's not using this special
command. Is this the problem? How can I fix it? (I tried
> doing asm("rte"), but it didn't work. Did I do it wrong, or is that illegal?)
Just doing "rte" won't do the necessary restoration of the stack and/or the
changed registers. The way I do it is like this:
void MyInterrupt(void) {
... interrupt code goes here ...
}
// This goes after MyInterrupt but not inside a function.
asm("MyInterrupt_Real:
movem.l %a0/%d0,-(%sp)
bsr MyInterrupt
movem.l (%sp)+,%a0/%d0
rte");
Then you just point the interrupt vector to that little assembly code instead.
There is supposed to be a directive that tells GCC that a function is an
interrupt handler, and inserts the proper assembly for it, but when I tried it
it changed nothing... maybe this has changed in recent versions of TI-GCC
though.
--
/ Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF Quote follows:
The one positive thing you could say about the bread products around him
was that they were probably as edible now as they were on the day they were
baked. *Forged* was a better term. Dwarf bread was made as a meal of last
resort and also as a weapon and a currency. Dwarfs were not, as far as
Vimes knew, religious in any way, but the way they thought about bread came
close.
Follow-Ups:
References: