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

Re: 6502 illegal opcodes questions



Sam Gillett wrote:
<heuser.marcus@freenet.de> wrote ...

What would be interesting to know is when did the 6502 programmers
begin using illegal/undocumented opcodes. Right from the start? I
vaguely remember hearing about them first in the mid-eighties.


I remember hearing about undocumented opcodes in the mid 80's.  But I don't
think I heard the term "illegal opcodes" was used in the Commodore world back
then.  Perhaps what was called "undocumented" in the Commodore world was
called "illegal" in the Apple world?

The difference between the two terms is dependent on point of view.

The chip/system designer tends to regard undocumented or undefined
behavior as the territory reserved for future expansion.  Of course,
if the space is not protected, either by trapping or by behaving
as a NOP, then it is "reserved" only by convention, not by silicon.

The on-the-metal programmer sometimes feels that "undefined" is just
an invitation to experiment, and proceeds to at least document, if
not define, the actions that the chip designer did not intend and
has no intention to preserve.

If a chip/system is successful, there comes a time when follow-on
designs are done.  If the officially undefined behaviors have become
sufficiently widely used, then they represent a barrier to the orderly
expansion of the design--such as new instructions requiring previously
undefined opcodes that may have been widely, but unwisely, used.

The new designer quickly comes to resent any such barriers, and would
therefore like to think of them as prohibited, or "illegal", but what
is really missing is discipline--on the part of the original designer,
who failed to "protect" the undefined space (to save a few transistors),
and on the part of coders who couldn't resist the temptation to use
whatever they found--even without any guarantee of future support
(to save a cycle or two).

Ironically, the combination of these two lapses in discipline can result
in there being no acceptable space for the expansion of a design, and
therefore they mortgage the future for a pittance today.

(If it isn't obvious, I've played both the designer's part and, earlier,
the coder's part.  ;-)

-michael

Music synthesis for 8-bit Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."