[Coco] Interrupts

Harry Hurst hhos at st-tel.net
Wed Nov 28 18:09:38 EST 2012


Sorry to be so tardy in answering, but I haven't done any of this kind of
thing, so I had to do some research first. I thought someone more
qualified would surely answer before I could. First thing I come up with
is that you have used two quite similar sounding terms in your question,
"interrupt" and "intercept". In my understanding an intercept, function
F$Icpt, is for handling signals received from other processes. I don't
think that is what you want.

It also sounds like you don't have an actual hardware interrupt to go with
this function. A VIRQ, function F$VIRQ, sounds like it would serve your
purpose pretty well. It is managed by Clock, which counts the number of
ticks from the vertical interrupt, and is serviced by the entry you
install with the F$IRQ function.

> How do you set up user interrupts in OS9?
> Let's say I want an event to occur once every 2 seconds, then return to my
> program.
> How would I go about setting up the interrupt?

The first thing you would do is set up your entries for the F$IRQ and
F$VIRQ polling tables. Then install the IRQ using the "Vi.Stat" in the
VIRQ entry as the device status register (its address in the D register).
The flip byte should be 0, and the mask should be 1. On pages 2-21 (page
31 in the PDF file) through 2-26 (page 36) of the OS9 Level 2 Technical
Reference there is an example source. The actual installation of the IRQ's
is on page 2-22 (page 32). Some other pages of interest might be 2-16
(p.26) to 2-20 (p.30), 8-92 (p.206), and 8-110 (p.224).

> I am using C as well as the RMA assembler so either format would work for
> me.
> I know how to go about setting the intercept call, but the books are a
> little vague on using the interrupt.

The NitrOS-9 and OS9 Technical References are the only references that
seem to cover it, but they do it very well. The only thing they both left
out was what kind of return to exit with. OS9TR's example uses a RTS, so a
PULS could also be used. They are both available at:

https://sites.google.com/a/aaronwolfe.com/cococoding/home/docs

HH






More information about the Coco mailing list