Amiga-C (36/157)

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

Hi Gunther.

Thanks for the reply.

> It would have been helpful to know which type your variables have.

struct Custom *cust = (APTR)0xdff000;
UWORD mojo = 0;
UWORD intvolume;
UWORD tempvol;
UBYTE db = 0;

>> tempvol = mojo * 0.8;

> This looks like floating point math. This is a bad idea to use in an
> interrupt.

You arn't the first to say that, so I'm going to try without floating
point math. I thought it would be okay because I set the compiler to use
the 68882 FPU instead of the math libraries.

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

> Yes, keep the work in the code as small as possible. You should do
> only
> the really necessary work in the interrupt. What is necessary
> depends
> on you.
> Furthermore, you should pass a pointer to a structure with all data
> your
> function needs (don't forget SysBase!) to avoid accessing global
> data.
> Then you could get rid of __saveds.

That's a good idea. I used that technique for my MHI interrupt which was
all assembler.

> BTW, you shouldn't use the VERTB interrupt in the first place. Did
> you
> consider using a PA_SOFTINT port together with the timer.device?
> This
> will give you constant timing on every amiga.

I didn't think of that. It sounds like a better way to do things though.
I just thought that the VERTB interrupt would be a simple and easy way
to get timing on my fixed system. I didn't worry too much about
compatability beyond the A1200 030 I am using, TBH.

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/