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

From: Brad Smith <rainwarrior1gmail.com>
Date: 2012-10-17 22:41:14
> Thanks for the report! There are quite some cases where cc65 does generate bad
> code. These cases are not easy to fix because of the internal structure of the
> compiler. So while I will try to keep it in mind, I cannot promise anything.
> At least you know how to have the compiler generate better code:-)

It is easy to work around this particular case now that I know about
it. I just figured you might want to know in case the same mechanism
that does this is doing it somewhere else more important. Thanks!

By the way, I discovered this because I was trying to use it on the
NES to write to the memory mapped register at 0x2007, which increments
an internal write address on every read or write. Apparently the
6502's STA (zp), Y instruction issues a dummy read before the write, I
was getting quite unexpected results when the address was
double-incremented! There are very few registers on the NES that have
read/write side effects anyway, so it's not really a problem in the
general case. It's a very rare case where replacing an absolute
address with an indirect indexed one isn't functionally the same
(aside from the timing, of course).

-- 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 22:41:54 2012

This archive was generated by hypermail 2.1.8 : 2012-10-17 22:41:57 CEST