single opcode. On the 6502, some of these leftover codes actually perform computation. Due to the way the 6502's instruction decoder works, simply setting certain bits in the opcode cause parts of the instruction processing to take place. Some of these opcodes immediately crash the processor, while other perform useful functions and were even given unofficial assembler mnemonics by some programmers. The 65C02 adds new opcodes that use some of these previously undocumented instruction slots. For example, $FF is used for the new BBS instruction. Those which remain truly unused are equivalent to NOPs. 6502 programs using those opcodes will not work on the 65C02. Bug fixes The original 6502 had several errata when initially launched. Early versions of the processor had a defective ROR (rotate right) instruction, which MOS Technology addressed by not documenting the instruction. ROR was fixed very early in the production run and was not an issue for the vast majority of machines using the processor. A bug that is present in all NMOS variants of the 6502 involves the jump instruction when using indirect addressing. In this addressing mode, the target address of the JMP instruction is fetched from memory, the jump vector, rather than being an operand to the JMP instruction. For example, JMP ($1234) would fetch the value in memory locations (least significant byte) and (most significant byte) and load those values into the program counter, which would then cause the processor to continue execution at the address stored in the vector. The bug appears when the vector address ends in , which is the boundary of a memory page. In this case, JMP will fetch the most significant byte of the target address from of the original page rather than of the new page. Hence JMP ($12FF) would get the least significant byte of the target address at and the most significant byte of the target address from rather than . The 65C02 corrected this issue. More of an oversight than a bug, the state of the (D)ecimal flag in the NMOS 6502's status register is undefined after a reset or interrupt. This means programmers have to set the flag to a known value in order to avoid any bugs related to arithmetic operations. As a result, one finds a CLD instruction (CLear Decimal) in almost all 6502 interrupt handlers, as well as early in the reset code. The 65C02 automatically clears