[Coco] Interrupts

Lothan lothan at newsguy.com
Wed Nov 28 23:46:15 EST 2012


Is F$VIRQ actually usable from user mode?

I never looked into it because the OS-9 Technical Reference manual states it 
is a privileged system call that can only be used by device drivers or 
pseudo device drivers (in kernel mode). Then I peeked at the code in the 
NitrOS-9 clock module and see that it doesn't have the system bit set (which 
is normally set for privileged system calls). This just might be an 
oversight in the clock module code, or I might be overlooking something.

I thought F$Alarm might be a really useful system call if it called back 
into a user process at a set time (or at a recurring interval) until I read 
what it actually does. The way it's implemented, it's pretty much a waste of 
code that (as far as I know) nobody has used.

-----Original Message----- 
From: Harry Hurst
Sent: Wednesday, November 28, 2012 6:09 PM
To: coco at maltedmedia.com
Subject: Re: [Coco] Interrupts

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




--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco 




More information about the Coco mailing list