Re: [cc65] Literal cast to pointer generating unnecessary code with [].

From: Brad Smith <rainwarrior1gmail.com>
Date: 2012-10-17 23:28:35
> you probably should write this kind of stuff in assembler anyway - eg
> something like
>
> *(unsigned char*)0xdead = 0;
> *(unsigned char*)0xdead = 0;
>
> will not generate two writes either (but one)

Yes, most of my code that use memory mapped registers will be in the
assembly part of my code, but there is a value in being able to do it
in C too.

I'm confused by your example. Why would two assignment statements not
generate two writes? (They do on my cc65 anyway.) Do you mean if there
was only one of those lines? The example I had posted using []
generates a dummy read then the write, not explicitly in the assembly
output, but implicit as part of STA (zp), Y.

-- Brad Smith
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Oct 17 23:29:16 2012

This archive was generated by hypermail 2.1.8 : 2012-10-17 23:29:20 CEST