Re: [cc65] size of .enum?

From: <silverdr1wfmh.org.pl>
Date: 2013-03-30 22:48:27
On 2013-03-30, at 18:26, Ullrich von Bassewitz 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.

I liked the .enum idea on the beginning since I can freely move/edit the content of the enum without much attention but deeper down the road things start to be more and more kludgy then.

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

Even if I don't need/want to reserve anything in the output file(s)? Hm, going to check it now. Thanks!

> The size is then
> the fill level of the memory area:
> 
>        .import __MYZP_START__, __MYZP_LAST__   ; Linker defined
> 
>        lda     #<(__MYZP_LAST__ - __MYZP_START__)

This should do the trick very well. Thanks again.

-- 
SD!

----------------------------------------------------------------------
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 22:48:41 2013

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