Re: [cc65] local .res ?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2007-11-24 21:39:55
Hi!

On Fri, Nov 23, 2007 at 01:51:19PM +0100, Anders Ã…strand wrote:
> Now, it would be nice to not having to do the increments manually and let
> the linker find out what size the temp-mem needs to be (by checking how
> much whatever proc that uses most temp-mem uses). Is this at all possible?
> If not, which way do you recommend for handling this?

I haven't done this myself, so all I have are two ideas that may help a bit,
but don't make the process fully automatic.

The first idea is to create a new segment for each temporary and let the
linker overlay all these segments in one memory area. So actually, each module
has it's own zeropage segment, and you will place all these zeropage segments
at the same address using the linker config. The disadvantage is that you will
have to write a rather detailed config file and that the size calculation is
still not automatic. However, since each segment is listed in the map file
together with it's size, it is easy to find the largest one, if you use a
common naming scheme for these temporary segments.

Another idea is to use structs for allocation. This will handle the offsets
automatically. You can output the size of the storage used and determine the
largest one by some script magic.

.struct         tmpseg
        var1    .word
        var2    .byte
.endstruct

.out .sprintf ("Size of temp storage is %d", .sizeof (tmpseg))

Since structs do just generate a set of constants for the "fields", you will
have to use "addr+offset" notation when accessing the storage, which is not
really comfortable.

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 Nov 24 21:40:17 2007

This archive was generated by hypermail 2.1.8 : 2007-11-24 21:40:21 CET