Re: [cc65] statics in zero page

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-05-21 15:27:09


Hi!

On Tue, May 21, 2002 at 01:03:42PM +0200, Christian Krüger wrote:
> Now, where I managed to build a little test project for the
> Lynx under cc65, I like to ask if there is a feature
> which allows to place static variables into zero page
> for quicker access?

I've decided against adding this for a couple of reasons:

  1. Most systems supported have very limited zeropage space. Adding zero page
     variables would be highly non portable, because one system has X bytes of
     zp space available, and the other one has Y bytes instead.

  2. Only the linker can decide how much zero page space is available and if
     the program uses more zero page space than available. Wouldn't you hate
     a library that uses all of your precious zero page space?

  3. Since cc65 (this is also true for the Lynx version) has no concept of
     real zero page registers, it will only use the zero page variables as
     storage, not as registers. This means, that it won't use something like

        lda     (zp),y

     with a zero page variable. All you gain is one cycle per access when
     storing and loading.

IMHO, there are a lot of better and more portable chances to squeeze a cycle
out of your code than using one byte of 30 or 40 bytes of the total available
zero page space.

> Is there anything similar in cc65 2.8 like 'interrupt' in the
> Lynx-Adaption?

No. As far as I remember, the Lynx cc65 had race problems in the code
generated by the "interrupt" keyword, at least this was true at one time,
don't know if it has been fixed. I do usually suggest to write interrupt
handlers in assembler, because the overhead involved for an interrupt handler
in C is quite large (all registers have to be saved, all zero page variables
have to be saved and a separate stack is needed). Writing the wrapper in C
will at least make the overhead visible instead of hiding it.

There have been discussions about this some time ago (may be it's already in
the mailing list archive). If anyone wants to spend some work on it, I would
prefer a library solution over an additional compiler keyword.

> (http://www.geocities.com/SiliconValley/Byte/4242/lynx/cc65notes.html
> for details and other cool features...)

I had long discussions with Bastian42 a few years ago. BTW: Does anybody know
what happened to him? The Lynx cc65 has not been updated for quite some time
now...

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-05-21 15:27:19 CEST