Amiga-C (30/157)

From:Paul Qureshi
Date:9 Sep 2001 at 12:55:06
Subject:[amiga-c] Re: VB int problem (was Re: Help needed with random crashing problem)

Hi Andrew.

>> Anyone got any ideas why a vb int written in Storm C might fail? I
>> have __interrupt and __saveds, and I return(0) at the end too.

> Don't forget that interrupts aren't executed on the context of your
> process, but in supervisor mode. So don't assume that system
> structures will be valid. Also, you can only use a small subset of
> exec functions. Signal() is OK. But memory allocation, Wait()ing, etc.
> aren't allowed. I noticed that you were trying to call printf() from
> inside your interrupt, this is a big no no and the results can be
> fatal.

Yeah, I noticed that :)

Actually, the code has been hacked up so much, they shouldn't even be
there. I have been trying many different things and different ways of
calling the code periodically, but nothing seems to work.

The latest code is:

int __interrupt __saveds MPCV(VOID)
{
db++;
if (db > prefs.volspd)
db = 0;

if (db == 0)
{
db++;
// no pot so max out volume
// mojo = cust->pot1dat >> 8;
mojo=180;
tempvol = mojo * 0.8;
if (tempvol > 100)
tempvol = 100;
if ( abs(tempvol - intvolume) > prefs.volacc || (tempvol == 100 && intvolume != 100) )
{
intvolume = tempvol;
Signal(mytask, intsigmask);
}
}
else
{
cust->potgo = 1;
}
return(0);
}

All the interrupt stuff I did for my MAS Player drivers for MHI was in
assembler and used CIA interrupts. That was actually quite easy to do,
I just can't understand why this casuses random crashing after a while.
That's the odd thing really, that the crashing is seemingly random and
only happens after a few minuites, like it's some kind of stack overflow
or something. Problem is, the machine resets and there is no way I can
see of finding out what the actual cause of the reset was.

Oh, and is there any way I can make sure that the 1 written to potgo is
a byte write?

> Basically keep the routine small and tight and don't do anything
> fancy. Plus VERTB servers should return with the Z condition code set
> (this is mentioned in the AddIntServer() autodoc).

Is there any reliable way to do this from C? I tried return codes, but
it doesn't stop things crashing.

> You'd better read the RKMs on interrupts for more information, just to
> be on the safe side.

I have read those damned things to death, and as far as I can tell there
isn't anything wrong with my code :(

Regards,
Paul



.-------------------------------------.----------------.
| Ami3D....www.mc68k.btinternet.co.uk | Asm..C..Blitz2 |
| email...paul.qureshi@btinternet.com | Intel..Outside |
`-------------------------------------^----------------'
Amiga Support Association - www.amigasupport.co.uk

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Secure your servers with 128-bit SSL encryption! Grab your copy of VeriSign's FREE Guide: "Securing Your Web Site for Business." Get it Now!
http://us.click.yahoo.com/n7RbFC/zhwCAA/yigFAA/dpFolB/TM
---------------------------------------------------------------------~->

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/