Re: [cc65] Interrupt handlers in C as part of the C library ?

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-01-18 00:02:22
Hi,

>> ... why we don't provide a
>> generic interrpt wrapper as part of the C library?

> Maybe because it's too slow to do anything serious?

Is from your perspective the overhead caused be the wrapper to high or
is the called C code too slow? Anyway on the Apple2 the overhead
caused by the firmware plus OS is already quite high. Compared to that
the overhead of the wrapper is rather low...

> At least this is one
> reason that caused me not to offer such a function. Someone with enough
> knowledge can easily adapt the functions from the debug module. All others
> should better not use interrupt handlers in C.

Surely, but that code isn't specific to the task at all. So the
question is why do it again and again...

> That said, I'm not against such a function if there is public demand.

I need it once so I'll implement it. I personally don't need it in the
C library. I'm offering to try to implement in a way suitable for
library integration. That's all.

> What I
> fear is people calling printf and similar stuff and messing up the runtime
> environment. Or doing stuff that causes overruns of the interrupt handler
> thread. These problems are quite nasty. It works ok a hundred times and then
> fails randomly.

That sort of reminds me of me avoiding comments in complicated code
sections to keep others from changing my code if they don't really
know hat they're doing ;-)) However I've been told that this isn't the
right way...

> No need to fail. Just use a function vector that may be set any times.

But that makes it slower ;-)

> See above. What I fear are hordes of people experiencing interrupt handler
> problems. Writing interrupt handlers in C is actually *more* difficult than
> writing the in assembler.

Hm, I think that depends heavily on the task at hand. In my case I've
got an existing C code designed from the start to run in an interrupt
handler - it doesn't even call memcy(). But it's quite a lot and it
contains a quite some if()s, while()s and switch()es and typed array
addressing operations and pointer arithmetic. I don't see why I should
translate all that into 6502 asm if I have cc65 at hand...

Anyway, I'm not into a discussion on this topic. If there's no
momentum then I'll just do it locally for my current task.

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jan 18 00:02:31 2012

This archive was generated by hypermail 2.1.8 : 2012-01-18 00:02:34 CET