While most accidental illegal instructions have useless or even highly undesirable effects (such as crashing the device), some can have useful functions in certain situations. Such instructions were sometimes exploited in
computer games of the 1970s and 1980s to speed up certain time-critical sections. Another common use was in the ongoing battle between
copy protection implementations and
cracking. Here, they were a form of
security through obscurity, and their secrecy usually did not last very long. A danger associated with the use of illegal instructions was that, given the fact that the manufacturer does not guarantee their existence and function, they might disappear or behave differently with any change of the CPU internals or any new revision of the CPU, rendering programs that use them incompatible with the newer revisions. For example, a number of older
Apple II games did not work correctly on the newer
Apple IIc, because the latter used a newer CPU revision
65C02 that did away with illegal opcodes. Later CPUs, such as the
80186,
80286,
68000 and its descendants, do not have illegal opcodes that are widely known/used. Ideally, the CPU will behave in a well-defined way when it finds an unknown opcode in the instruction stream, such as triggering a certain
exception or
fault condition. The
operating system's exception or fault handler will then usually terminate the application that caused the fault, unless the program had previously established its own exception/fault handler, in which case that handler would receive control. Another, less common way of handling illegal instructions is by defining them to do nothing except taking up time and space (equivalent to the CPU's official
NOP instruction); this method is used by the
TMS9900 and
65C02 processors, among others. Alternatively, unknown instructions can be emulated in software (e.g.
LOADALL), or even "new" pseudo-instructions can be implemented. Some
BIOSes, memory managers, and operating systems take advantage of this, for example, to let V86 tasks communicate with the underlying system, i.e. BOP (from "BIOS Operation") utilized by the Windows
NTVDM. In spite of Intel's guarantee against such instructions, research using techniques such as
fuzzing uncovered a vast number of undocumented instructions in x86 processors as late as 2018. Some of these instructions are shared across processor manufacturers, indicating that Intel and
AMD are both aware of the instruction and its purpose, despite it not appearing in any official specification. Other instructions are specific to manufacturers or specific product lines. The purpose of the majority of x86 undocumented instructions is unknown. Today, the details of these instructions are mainly of interest for exact
emulation of older systems. ==See also==