Re: [cc65] Zero page, C stack, and interrupts

From: Oliver Schmidt <ol.sc1web.de>
Date: 2010-04-25 17:58:55
Hi,

>> I guess that's what I really need to get nailed down first: how
>> do cc65 and the kernal coexist?
>
> There's nothing special about that. They coexist as every other machine
> language program coexists with the kernal. There are thousands of examples for
> machine language programs that load from disk, run and terminate without any
> problems with the kernal or whatsoever. Why do you assume, cc65 generated
> programs have special problems?

I don't actually know the CBM specifics but I think I can add a
somewhat different more general view from the Apple2 perspective:

The ZP is a shared resource and there's no resoruce manager. Therefore
it's all about cooperation. The ZP location used by the different
parts of the ROM (especially BASIC vs. lowlevel routines), the DOS and
other general services are (more or less) well documented. So any
program using those services needs to make sure not to trash over the
ZP locations used by those services. So far so good...

You as a cc65 user programming in C can rightfully presume that the
author(s) of the cc65 C library for the target machine of your choice
have taken care to not trash over any ZP locations needed by general
services called on your behalf by the C library. And regarding the
general services never called by the C library there's no need to
worry as the C library saves all ZP locations it uses itself on
startup and restores them on cleanup.

So the only area you can potentially get into trouble is when you
(bypassing the C library) directly call into general services on your
target machine yourself which are never used by C library. The BASIC
interpreter would be an example for such a general service you can't
presume to cooperate with cc65's ZP usage - at least not on every
target machine.

Maybe this was all too obvious but maybe this was just the type of
information your were looking for...

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 Sun Apr 25 17:59:08 2010

This archive was generated by hypermail 2.1.8 : 2010-04-25 17:59:11 CEST