Re: [cc65] RODATA strings

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-12-03 17:23:06
On Tue, Dec 01, 2009 at 10:42:20PM -0800, Shawn Jefferson wrote:
> I was looking at an app I wrote trying to reduce size and I noticed I have
> quite a few strings that are the same in cputs (press any key type
> messages) calls.  Does cc65 already remove redundancy with these read-only
> strings?

cc65 doesn't do that. The reason is that the current implementation for string
literals is ineffective. Currently any string literal is placed into the
literal pool. A better implementation would be to have a separate literal pool
for each function - so if a function is removed, literals can be also removed.
This would mean that merging duplicate strings would work inside a function
only, which drastically reduces the positive effect.

What I'm usually doing to avoid duplication of string literals is to write
small functions for this purpose:

    static void HelpPrompt (void)
    {
        DisplayPrompt ("Press F1 for help");
    }

    static void AnyKeyPrompt (void)
    {
        DisplayPrompt ("Press any key to continue");
    }

(copied from dbg.c).

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 Thu Dec 3 17:23:14 2009

This archive was generated by hypermail 2.1.8 : 2009-12-03 17:23:18 CET