The behaviors of the 'C02 NOPs certainly do seem enigmatic. I puzzled over the matter for quite a while before hitting on a plausible back story. If we were flies on the wall back when the 'C02 was on the drawing board, here's roughly what I think we would've heard:
"What are we gonna do about undefined opcodes? On the NMOS 6502 they had bizarre behaviors but folks managed to find a use for them anyway. Now they're an impediment to progress because there's a market segment that won't buy new chips unless the old behavior is preserved! Let's show more foresight than the NMOS team did. With the 'C02, let's make all the undefined opcodes into NOPs."
"Yikes! That could entail a lot of changes! Do they have to be "genuine" NOPs in the sense of doing absolutely nothing except wasting time and advancing the PC?"
"No. The goal is merely to remove motivation for using them. So it's alright to allow some of the undefined ops to inherit similarities to normal ops -- such as doing a memory access. As long as nothing gets written to the registers, flags or to memory then we can say they're NOPs and no-one will have a reason to use them."
Here's a speculation I
don't find plausible. Some of the NMOS undefined opcodes have side effects such as crashing the CPU and requiring a reset. I've heard it suggested that rendering all undefined opcodes as NOPs would remedy this because NOPs execute harmlessly. But that's flawed thinking. Your program shouldn't be fetching anything unexpected in the first place!
If the PC has gotten fouled up so as to point someplace inappropriate then you might as well hit reset anyway, since cogent results can't be expected.
MichaelM wrote:
Note: my processor core can support these behaviors with some minor updates to the microprogram
Interesting. The 'C02 design team wanted the undefined ops to be useless, but $DC and $FC turned out to be even better than the legitimate opcode $2C (BIT absolute) for the trick of skipping two bytes of code. And $02, $22, $42, $62, $82, $C2, and $E2 turned out to be useful for skipping over one byte of code. Michael, now
you face a dilemma like that faced by the 'C02 design team! Will you choose to support the unorthodox usages or will you suppress them?
-- Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html