[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 6502 illegal opcodes questions



Michael J. Mahon wrote:

This works only when the behavior of all versions are known, and they
can be differentiated by software tests.

Since it is difficult to predict which undocumented behavior(s) would
be present in a future chip, it cannot, in general, allow for future
chips, except in the special case where the "test" encompasses *exactly*
the behavior that the exploiting code uses (no more, no less).

SHX/SHY have been replaced with STZ on later CPUs, so there is no problem with future chips since either these chip's expand the old instruction set which has STZ already, or it is incompatible anyway since it does not implement all the former legal opcodes.

Modern programming practice does allow for code (and even algorithms)
tailored to specific processor levels, but only when there is a method
for differentiating implementations that is architectural, and therefore
sanctioned by the manufacturer(s).  Of course, most compilers don't
offer support for this, except in some embedded environments.

Ok, next time I will ask MOS if the use of illegal opcodes is sanctioned by them... Oh wait, MOS doesn't exist anymore for almost 20 years now :D