[Coco] Interrupts

Bill Pierce ooogalapasooo at aol.com
Wed Nov 28 18:21:19 EST 2012


Thanks Harry, I thought that one had been forgotten. I will read through the suggested sections of the manuals and see what can figure out.
The whole idea is for a "status bar" kind of thing on a program I'm working on. I want to set up automatic updates of values of certain events while the program is running. The best way I could see to do it without creating a loop just for the purpose was to use an interrupt. I knew I had read somewhere that the Coco 3 as well as OS9 level 2 would do "user programmable" interrupts so I figured that would be a good way to implement this with low maintenance.

Thanx again,
Bill P

Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Bill Pierce
ooogalapasooo at aol.com




-----Original Message-----
From: Harry Hurst <hhos at st-tel.net>
To: coco <coco at maltedmedia.com>
Sent: Wed, Nov 28, 2012 6:09 pm
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