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

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2012-01-17 23:24:13
Hi!

On Tue, Jan 17, 2012 at 04:29:04PM +0100, Oliver Schmidt wrote:
> When looking at
> http://wiki.cc65.org/doku.php?id=cc65:interrupt_handlers_in_c and some
> dicussions here on the list I'm asking myself 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? 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.

That said, I'm not against such a function if there is public demand. 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.

> The wrapper would save/restore the zeropage memory area, save/restore
> the sp and switch to a new sp. It would call exactly one C function.
> Trying to use the registration function twice without prior
> unregistration would just fail. The base addr and size for the
> interrupt stack could be additional args to the registration function.

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

> Any reasons against this - beside the actual work, which I'd be
> willing to spend ?

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.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Jan 17 23:24:21 2012

This archive was generated by hypermail 2.1.8 : 2012-01-17 23:24:24 CET