Quote:
Are all unimplemented codes on the C02 NOPs?
The processor thinks they're NOP's, because no flags or registers are altered. But in some cases a data fetch (a fetch other than the instruction fetch) is generated. Depending on the system, that might have potential for a destructive read of an I/O register -- so, perhaps
not a NOP from the system's point of view.
On a more positive note, the NOP's are useful for hardware and software hacks. (The software hack, discussed
here, uses the NOP to skip a byte or two. It's smaller and may be faster than a BRA.)
The most numerous undefined NOP's have no time for a data fetch, as they are both single-byte and single-cycle. 64 such NOP's are present on older 'C02 processors such as the NCR65C02; their opcodes fill columns $3, $7, $B and $F of the opcode map. Slightly newer C02's including Rockwell use columns $7 and $F to accommodate the bit-manipulation instructions, thus reducing the number of single-byte, single-cycle NOP's to 32. Modern WDC C02's further reduce that number to 30, as the STP and WAI opcodes reside in column $B.
Attachment:
NCR65c02 invalid opcodes.png [ 108.64 KiB | Viewed 1201 times ]
GARTHWILSON wrote:
Jeff has used the single-cycle ones for
his fast-I/O tricks.
Yes, the single-byte, single-cycle have great potential for hacking.
They're fast, compact and plentiful. And your hardware perhaps won't need to decode the entire opcode -- merely decoding the column may suffice.
That said, the remaining NOP's (
non-single-cycle) are the most intriguing, as they give your hardware access to the following address modes (as dictated by an appropriate program):
- Absolute
- Zero-page
- Zero-page,X
- Immediate
For example, your program might include the two-byte instruction $44, $69. $69 is some arbitrary location of interest, and $44 is the opcode for "NOP" Zero-page. At runtime $44, $69 will cause the processor to obligingly fetch whatever's at $69. The processor discards the byte fetched, and it remains only for your hardware to capture it by snooping the data bus. That's how my
KK Computer is able to load a Bank Register in only three cycles.
(Or
two cycles, using "NOP" Immediate.)
For detailed specifics on 'C02 NOP's see
here.
-- Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html