[net.micro.amiga] Manx C and interrupt handlers

waterfal@vger.UUCP (Douglas Waterfall) (07/19/86)

I am having a tough time trying to get the input device
to work properly.  The C code in the ROM Manual v1.1 will
not work properly under Manx without modifications.  I was
able to get it to work properly by saving all the registers
in the assembly language piece before calling the handler.  Now
the only problem is making ROM calls from within the interrupt
handler.  The original code has a Forbid() and Permit() placed
within the handler, this invariably causes the dreaded red box
to appear.  Has anyone been able to make the code work properly?


Thank
Douglas Waterfall

higgin@cbmvax.UUCP (07/20/86)

In article <431@vger.UUCP> waterfal@vger.UUCP (Douglas Waterfall) writes:
>I am having a tough time trying to get the input device
>to work properly.  The C code in the ROM Manual v1.1 will
>not work properly under Manx without modifications.  I was
>able to get it to work properly by saving all the registers
>in the assembly language piece before calling the handler.

Do you mean the code on 1-55 and 1-56 in RKM vol 1?  If so, I have managed
to get this to work by having my handler in assembler, getting register a4
from a1 (is_Data) as is explained in the Manx docs.

>Now
>the only problem is making ROM calls from within the interrupt
>handler.  The original code has a Forbid() and Permit() placed
>within the handler, this invariably causes the dreaded red box
>to appear.  Has anyone been able to make the code work properly?
>
>Thank
>Douglas Waterfall

I don't know what code you're referring to, because I haven't seen any
code which has Forbid()/Permit() in it, but I am calling the Signal()
routine from my handler without problems.

Hope this helps,
	Paul.

Disclaimer: Opinions are my own and I do not work for Commodore.

jimm@amiga.UUCP (07/20/86)

In article <431@vger.UUCP> waterfal@vger.UUCP (Douglas Waterfall) writes:
>I am having a tough time trying to get the input device
>to work properly.  The C code in the ROM Manual v1.1 will
>not work properly under Manx without modifications. 

See the section "Technical Information/Interrupt Handlers" in the Aztec
manual.

For a simpler solution, set the proper flags to use both large code (your
problem is calling the interface routines (from libc.a) to Forbid/Permit )
and the large data (if your need is to use global data at interrupt time).

As far as I got, I used the small data model and used the is_data to
store the base of all "static" data I would reference.

I never personally set up A4 the way the manual suggests, but that
is probably the best way to go if you want to use small code.

	jimm

toebes@sas.UUCP (07/21/86)

In article <431@vger.UUCP>, waterfal@vger.UUCP writes:
> I am having a tough time trying to get the input device
> to work properly.  The C code in the ROM Manual v1.1 will
> not work properly under Manx without modifications.  I was
> able to get it to work properly by saving all the registers
> in the assembly language piece before calling the handler.  Now
> the only problem is making ROM calls from within the interrupt
> handler.  The original code has a Forbid() and Permit() placed
> within the handler, this invariably causes the dreaded red box
> to appear.  Has anyone been able to make the code work properly?
> 
> 
> Thank
> Douglas Waterfall
I typed in and ran the input.device example using Lattice 3.04 and encountered
similar problems whenever I did not disable stack checking.  However, I suspect
that part of the problem may be in using the small data option.  The
interrupt routine wants to share data with the main code and as such needs the
base register that points to the massive data area.  Since the handler code
runs from (conceptually) another task it will not have ready access to the
registers of the original task which installed it.  Compiling with a large
data model should relax this requirement.

After a little work I was able to rework the example (actually rewrite is the
word) into the POPCLI program that also blanks the screen.  If interested the
source is available on the Software Distillery Bulletin Board: (919)471-6436
-- 
John A. Toebes, VIII       usenet:..mcnc!rti-sel!sas!toebes
USnail: 235 Trillingham Ln, Cary NC 27511   BBS:(919)471-6436