Re[2]: [cc65] statics in zero page

Date view Thread view Subject view

From: groepaz (groepaz_at_gmx.net)
Date: 2002-05-21 14:12:04


Hello Mark,

Tuesday, May 21, 2002, 2:00:54 PM, you wrote:

KM> Hi Christian,

>> Now, where I managed to build a little test project for the
>> Lynx under cc65, I like to ask if there is a feature
>> which allows to place static variables into zero page
>> for quicker access?
>> 
>> The special (old) Lynx-Adaption of cc65 has the keyword 'zstatic'
>> for this feature. Is there something like that to achieve the
>> same behaviour under cc65 2.8?

KM> After a little experiment I think there maybe a bug here
KM> but that'll need to be confirmed as I'm not sure how
KM> this should work. I tried my test.c file:

KM> #pragma rodataseg ("zp")
KM> char *msg = "Hello.";
KM> #pragma rodataseg ("RODATA")

KM> main(int c,char**v) {
KM> exit(printf("%s\n",msg));
KM> }

KM> Compiled using "cl65 -S test.c" gave this in the asm produced:

KM> <snip>
KM> .segment        "DATA"

KM> _msg:
KM>         .addr   L0001+0

KM> .segment        "RODATA"

KM> .segment        "zp"
KM> .segment        "RODATA"
KM> L0001:
KM>         .byte   $C8,$45,$4C,$4C,$4F,$2E,$00,$25,$53,$0D,$00
KM> </snip>

KM> Shouldn't the last bit be this:

KM> .segment        "zp"
KM> L0001:
KM>         .byte   $C8,$45,$4C,$4C,$4F,$2E,$00

KM> .segment        "RODATA"
KM> L0002:
KM>         .byte   $25,$53,$0D,$00
 
KM> Thoughts?

nmmmh i _think_ the only way to put variables into zeropage is by
using the "register" keyword.

-- 
Best regards,
 groepaz                            mailto:groepaz_at_gmx.net


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-05-21 14:10:47 CEST