Re: [cc65] size of .enum?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2013-03-30 18:26:22
On Sat, Mar 30, 2013 at 05:48:33PM +0100, silverdr@wfmh.org.pl wrote:
> Situation: several variables to be placed in zeropage starting at $50. ZP
> content to be backed up and restored. Using .enum I have something like:
[...]
> Now, elsewhere I need to know the number of those variables in order to save
> and restore only the required ZP addresses' contents. Any clues for something
> acceptably elegant?

I would start by not using enum. If you want to place something somewhere, use
the linker.

.segment        "MYZP" : zeropage
var0:   .res    1
var1:   .res    2
var2:   .res    4
...
varn:   .byte   0

Place this segment in it's own memory area starting at $50. The size is then
the fill level of the memory area:

        .import __MYZP_START__, __MYZP_LAST__   ; Linker defined

        lda     #<(__MYZP_LAST__ - __MYZP_START__)

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 Sat Mar 30 18:26:43 2013

This archive was generated by hypermail 2.1.8 : 2013-06-15 17:37:38 CEST