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

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-04-25 16:54:31
On Sun, Apr 25, 2010 at 07:21:11AM -0700, Steve Davison wrote:
> My program needs to co-exists with the ROM OS, and with BASIC
> programs.  On the surface, this seems like a very Unnatural
> Thing for cc65, requiring that I swap the cc65 ZP area every
> time I transition into or out of cc65 code.

Maybe you can explain a bit what that means. Either there's nothing to worry
about, or you're planning some really complex things, in which case the
necessary precautions depend heavily on your program.

> Also, it looks like
> calling into any library code from an ISR would require separate
> parameter stacks as well (except for maybe single-param fastcall
> functions).

That is true, and even worse: You have to take special precautions when
calling C code from an interrupt handler. See the mailing list archive for
several threads on this topic.

> I haven't found any information on choosing a good location for
> ZP.

Why do you want to do explicit ZP placement? What is so bad about the standard
ZP location?

> I tried to see what
> cbm_load might do to deal with it, but I can't find where
> cbm_k_load is defined.  (It's declared in cbm.h, and called by
> cbm_load, but from there it falls off the radar.)

It's in libsrc/cbm/c_load.s.

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

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 Sun Apr 25 16:54:39 2010

This archive was generated by hypermail 2.1.8 : 2010-04-25 16:54:42 CEST