From: Michael J. Mahon on
Stephen Harris wrote:
> Michael J. Mahon <mjmahon(a)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."
From: Rainer Buchty on
In article <d4CdnR_y__CUmfXZnZ2dnUVZ_s-dnZ2d(a)comcast.com>,
"Michael J. Mahon" <mjmahon(a)aol.com> writes:
|> 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.

You are too today-centric.

Back in the 1970s even that "likely not very expensive" decision raised
the costs significantly and introduced complexity to the chip which was
unnecessary from a technical and marketing point of view.

|> If I had been designing the 6502,
|> I likely would have made the same choice.

Probably everyone would have. Leaving out the illegal opcode traps or
mapping them to NOP did no harm, implementing them would just raise
costs.

|> (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.)

If a platform stays identical over a long-enough period of time
then why not starting to squeeze the last out of it by using undocumented
behavior. After all, the use of such undocumented behavior in the end
led to enhanced capabilities, even the chip designers didn't envision
in the first place.

I'm especially thinking about all the fancy stuff coders did with the
C64's video chip, which like the original 6502 (and the hereon based 6510)
is a hardwired design.

And back then noone really thought about future utility. Maybe apart from
the Apple II those machines were pretty much integrated & rather unexpandable
boxes -- even more, in the early homecomputer and video game market there was
no sense for a "family concept" where software from the old machine would just
run on its next generation successor, cause that most likely was an entirely
new box.

Think of Atari 400/800 vs. 600/800XL, Commodore VIC20 vs. C64, Sinclair ZX81
vs. Spectrum just to name a few.

Rainer
From: Stephen Harris on
Michael J. Mahon <mjmahon(a)aol.com> wrote:


> Stephen Harris wrote:
> > 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.

Remember, the 6502 was designed in 1975. Every single gate was expensive.
Optimisation of the "don't care" conditions was an important skill that
had a very real impact on the production cost. Cost was important on this
chip, being a lot cheaper than the competition.

Note that when WDC designed the CMOS version of the chip (65C02) they _did_
NOP the undefined instructions but that was a later design using newer
technologies (CMOS vs NMOS).

> 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.)

The home computer I'm most used to that used the R6502 (the Rockwell
version) at 2Mhz was the Acorn BBC Micro. About the only programs that
used the undocumented codes were games that used them for disassembly
protection; most disassemblers at the time didn't recognise them so
would display a single ??? and then try to decode the next byte as an
opcode. Since the R6502 really treated it as a 2 or 3 byte NOP this
caused bad dissassembly. Later disassemblers were updated to handle
this :-)

It caused some minor issues, though, when the BBC Master came out, which
used the 65C02. Oops! Magazines at the time would publish "hacks" to
fix the few popular rogue programs :-)

--
Stephen Harris
usenet(a)spuddy.org
The truth is the truth, and opinion just opinion. But what is what?
My employer pays to ignore my opinions; you get to do it for free.
From: heuser.marcus on
> And back then noone really thought about future utility. Maybe apart from
> the Apple II those machines were pretty much integrated & rather unexpandable
> boxes -- even more, in the early homecomputer and video game market there was
> no sense for a "family concept" where software from the old machine would just
> run on its next generation successor, cause that most likely was an entirely
> new box.
> Think of Atari 400/800 vs. 600/800XL, Commodore VIC20 vs. C64, Sinclair ZX81
> vs. Spectrum just to name a few.

The Ataris are not a good example - they are mostly compatible
(hardware and software). Think of their 8-bit machines simply as
"family members" - not different hardware generations like the other
machines.

bye
Marcus

From: Bruce Tomlin on
In article <d4CdnR_y__CUmfXZnZ2dnUVZ_s-dnZ2d(a)comcast.com>,
"Michael J. Mahon" <mjmahon(a)aol.com> wrote:

> 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.

Nope, it's handled by good old random logic. A PLA is designed to be a
programmable generic replacement for random logic, and is way too
inefficient for high-volume VLSI.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Prev: what happened CBM=VGA
Next: 1581 Drive Kits on eBay