[Coco] Interrupts

Gene Heskett gheskett at wdtv.com
Thu Nov 29 00:59:39 EST 2012


On Thursday 29 November 2012 00:34:16 Lothan did opine:

> 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.

That code was removed at one point way back in the level 1 sands of time 
because it was broken as written.  I put it back in and made it work for 
the intended purpose in multivue, which was to actually act like an alarm 
clock, sounding a 1 second on 1 second off beep for one minute when the 
minute matched what you fed into it with the F$Alarm call.

Setting it up to issue a periodic signal like you want wouldn't even be a 
horse, more like a chickadee on too much coffee.  That fastest rate you 
could set would be once per 1/60th second tick.  Any code loop of 
consequence running that frequently will seriously impact the coco's speed.

If you want to set up recurring interrupts at a reasonable repetition rate, 
I'd suggest taking a look at the src code of my cron_vE, in Genes-os9-stf.  
As is however, its graininess is a 1 minute repeat, so it would need to be 
expanded, both in the code, and the crontab format to bring it down to 1 
second repeats.  Accessing the time to any finer degree means getting the 
dd.tick count from the DP, which is not part of the std time packet.
Even to do it as often a 1/minute, I would recommend that the crontab 
format chosen is a DataMod merged to the cron module, and ISTR it has that 
facility so it isn't hammering the drives for the file every minute.  
Drives wear out fast enough without that sort of exercise every minute.

> -----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
> 
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco


Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
You can't break eggs without making an omelet.



More information about the Coco mailing list