Re: [cc65] size of .enum?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2013-03-31 12:06:22
Hi!

On Sun, Mar 31, 2013 at 12:23:06AM +0100, silverdr@wfmh.org.pl wrote:
> On 2013-03-30, at 18:26, Ullrich von Bassewitz wrote:
> > .segment        "MYZP" : zeropage
> > var0:   .res    1
> > var1:   .res    2
> > var2:   .res    4
> > ...
> > varn:   .byte   0
>
> Unfortunately it doesn't look so nice when I want to .exportzp this. In file
> "zp_variables.s" I have now something like:

Use an include file like this:

---------------------------------- zp.inc ----------------------------------
.globalzp       te_counter
.globalzp       he_counter
----------------------------------------------------------------------------

You might have noticed that I hadn't used .res in my example above, and this
is also my suggestion for you, since .word etc. are more readable in my eyes.
So your .s file will look like this:

----------------------------------- zp.s -----------------------------------
.include        "zp.inc"

.segment        "ZP_VARIABLES": zeropage

te_counter:     .byte   0
he_counter:     .byte   0
----------------------------------------------------------------------------

Doesn't this look clear and well arranged? :-)

Other modules will then just use zp.inc as an include. The nice thing when
using an include file like the one above is that it is used by all modules,
the one defining the variables, and the one using it. So the assembler will
help finding mismatches.

> then the linker config:
>
> MEMORY
> 	ZP_50: start = $0050, size = $0030, type = rw;
>
> SEGMENTS
> 	ZP_VARIABLES:	load = ZP_50,	type = zp,	define = yes;
[...]
> Unresolved external `__ZP_VARIABLES_LAST__' referenced in:
>   read.s(11)
> Unresolved external `__ZP_VARIABLES_START__' referenced in:
>   read.s(11)

As thefox has already noted, __XXX_LAST__ is defined for the memory area, not
for the segment. Be sure to discard the contents of this memory area by
specifying an empty file name.

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 Mar 31 12:06:30 2013

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