[Coco] CnoY

Jeff Teunissen deek at d2dc.net
Thu May 14 05:56:40 EDT 2020


I had the idea the other day to add support for the "CnoY"
optimization to the assembly optimizer in my CoCoC repo. For those who
are unaware, CnoY takes any instruction that uses Y-relative indexed
addressing, and converts it to direct addressing, which works on Level
II systems where the data area begins at address 0, because on Level
II systems Y is set to zero for user code.

It can make a program perhaps a percent faster, since that addressing
mode uses fewer bytes and fewer cycles.

Adding the code to do CnoY into the optimizer would save significant
time -- after all, if we don't need the extra program, why slow down
the build?

However, the CnoY optimization is a bit annoying to make for a
peephole optimizer that is looking at whole operands and whole
instruction mnemonics. I can hack it some to enable more flexibility
in the optimizer, but while looking into it I noticed that it's
actually a lot easier to do this particular optimization in the
compiler itself. (it's just a few "ifs" in the code generator)

One of these options is gonna happen. My question to the C users,
though, is: all other things being equal, which would you prefer?


More information about the Coco mailing list