Amiga-C (51/157)

From:Paul Qureshi
Date:13 Sep 2001 at 00:17:56
Subject:[amiga-c] Re: VB int problem (was Re: Help needed with random crashing problem)

Hi Gunther.

>> If it's local won't the interrupt code have to put it on the stack or
>> something?

> If your function is simple the compiler will put local variables
> into
> registers. The compiler does only use stackslots if there aren't
> enough
> free registers.

Ah yes, makes sense. I guess the only way to tell is to look at the
assembler code though.

>> I did think of doing that, but for some reason didn't. I did it for
>> my MHI interrupt, as I think I said, although it probably wouldn't
>> make much difference since everything here as the compiler uses
>> absolute addressing anyway.

> But your interrupt function is a critical part. You should always
> try
> to be as fast as possible. If you can avoid absolute addressing you
> should do. It doesn't matter what the rest of your program does.

I'm not sure Storm C allows you to compile the interrupt code
differently (i.e. with a small data model) than the rest of the code. In
then end it seems that I could compile everything with a small data
model anyway, as the program is about 36k.

>> You make some good points. I didn't really think about using floating
>> point code, but now it's clear it could cause problems. Removing the
>> floating point code from the interrupt seems to have fixed the
>> problem, the program is no longer crashing.

> If its now solved than I think its very clear that you trashed the
> FPU
> registers.

Yeah, odd how the compiler doesn't seem to care about them even though
it should know that the code is part of an interrupt (__interrupt used).
I guess technically it's a bug, although as you say the RKMs make no
mention of the FPU so it's a slightly gray area.

>> It seems that there is a bit of an oversight in the RKMs then,
>> regarding floating point register use.

> Well, they were written then the presence of a FPU wasn't that
> commom.
> Besides, this information is there since the RKMs tell you which
> registers
> you may safely use. FPU registers are not mentioned .-)

*grin* Yeah... you are right there. So then, I guess it is a problem for
Storm C V3 at least, since it should save any register that is not
scratch.

>> does GNU C pick up on that kind of thing?

> Yes, it does.

Nice... I can see why they switched to it.

>> However, I just realised the obvious mistake we both made. It's
>> impossible to use the CIA timer,

> I wasn't talking about CIA timers but about timer.device.

But even then, does it sync accuratly enough vblank to make analogue joy
reading work? I'd have to try it.

>> and in fact better to use the VERTB timer which is based on the
>> screen update. In order to use the analogue joystick registers (which
>> is what the interrupt does, as you can see), you have to access the
>> potgo register during the vertical blanking period, then read it
>> again at the next vblank.

> I am not an expert with hardware-banging. I hope you know what you
> do ;-)

To be honest, I'm not entirely sure on that one. The docs arn't very
good and seem to be at least partly wrong :(

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/