[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 6502 illegal opcodes questions
Stephen Harris wrote:
Michael J. Mahon <mjmahon@aol.com> wrote:
is really missing is discipline--on the part of the original designer,
who failed to "protect" the undefined space (to save a few transistors),
Not really. At the time every gate on the chip was expensive and saving
them was a valid concern. When I studied VLSI design we called these
undefined cased "Don't care" conditions; invalid input meant we didn't
care about the output. You can see this on some cheap LED digital
clocks where pressing wierd button combinations can cause odd displays;
invalid input. That can actually cut down the number of gates by 20%
or more and so reduce the cost, accordingly.
True, but the decoding in the 6502 is handled by a kind of PLA, so
it would likely not be very expensive (in real estate) to trap or
NOP the invalid combinations.
But your point is well taken, it's a tradeoff of the present vs.
the future of your chip.
Handling these "don't care" conditions actually requires a level of
optimisation which doesn't exist in a naive design. So it's not a case
of the designers failing to protect the undefined space, but of them
optimising the circuitry for efficiency.
It is a valid design decision.
Yes, but not without implications for the future--see above.
The 6502 was already a much less expensive processor than its
competitors, because of a mask retouching technique MOS Technology
developed that saved mask iterations.
Admittedly, though, the microprocessor design culture at that time
was not oriented toward "protecting" undefined space, as they all
have been in the years since.
When you have just done it, you aren't weighting how you will proceed
over the next 15 years very highly. ;-)
With the 6502 essentially not having a microcode level, this
optimisation is exposed to the programmer. This also shows up in the
regularity of the opcodes, and allowed hackers to make educated guesses
as to what the undocumented codes could do.
Right--with all the negative implications for the future that I
discussed.
I was discussing the nature of the "undefined" problem in general,
and in light of current practice. If I had been designing the 6502,
I likely would have made the same choice. (But as a coder, I would
have regarded undefined ops as a curiosity, not as an opportunity
to save a few cycles at the expense of future utility.)
-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."