[comp.sys.amiga.tech] Interrupt Servers

brianr@tekig5.PEN.TEK.COM (Brian E Rhodefer) (06/29/90)

My program uses a Vertical Blanking Interrupt server whose only
function is to signal a task every N frames.  To call Exec's
Signal() function, of course, the server loads A6 with &SysBase,
but I have a few misgivings about this.

My copy of the Exec volume of the RKM, in the chapter on Interrupts
(Ch 7, I believe), says that Interrupt Server routines can't count
on the contents of A6, and that only regs D0-D1/A1/A5 are scratch.

I disassembled the Vertical Blank interrupt (for my system), and found
that D0-D1/A1/A5-A6 are all saved & restored by the Kernel.  With the
explicit warning against depending on A6's contents, it seems to me
that either

 a) if everyone indeed preserves A6, as the RKMs appear to mandate, then
    they should be able to depend on the Kernel's loading of A6 with SysBase
 or

 b) if nobody depends on A6, as the RKMs suggest, and the kernel
    saves&restores it, then A6 can be regarded as scratch

Is the RKM inaccurate/incomplete here?  I don't have to push&pop A6
in my Server routine, do I?

Brian Rhodefer

valentin@cbmvax.commodore.com (Valentin Pepelea) (07/04/90)

In article <6493@tekig5.PEN.TEK.COM> brianr@tekig5.PEN.TEK.COM (Brian E
Rhodefer) writes:
>
> My copy of the Exec volume of the RKM, in the chapter on Interrupts
> (Ch 7, I believe), says that Interrupt Server routines can't count
> on the contents of A6, and that only regs D0-D1/A1/A5 are scratch.

To be precise, what the RKM says is that the registers d0,d1,a0,a1 are
scratch registers that are automatically saved by the kernel, and so are
registers a5 and a6, because they are often used by servers.

> a) if everyone indeed preserves A6, as the RKMs appear to mandate, then
>    they should be able to depend on the Kernel's loading of A6 with SysBase

The kernel pre-saves a6 for you so that *you* may load it with whatever you
want. The a6 register is indeterminate at the beginning.

> b) if nobody depends on A6, as the RKMs suggest, and the kernel
>    saves&restores it, then A6 can be regarded as scratch

Correct.

> Is the RKM inaccurate/incomplete here?  I don't have to push&pop A6
> in my Server routine, do I?

You don't have to, the kernel does it for you. Just don't make any assumptions
as to the contents of the a6 register when your interrupt server gets
started. (interrupt handlers have ExecBase in a6 though)

The new RKM are accurate and complete, but I suggest you also buy the "Guru's
Guide, Meditation #1 - Interrupts" by Carl Sassenrath, the creator of the
Exec.

>Brian Rhodefer

Valentin
-- 
The Goddess of democracy? "The tyrants     Name:    Valentin Pepelea
may distroy a statue,  but they cannot     Phone:   (215) 431-9327
kill a god."                               UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb     Claimer: I not Commodore spokesman be