NOP
NOP (short for "No OPeration") is the mnemonic for a machine language instruction which merely fills in a byte of program memory (and takes two machine cycles to "execute"). This two-microsecond "coffee break" for the CPU is useful for several purposes, mostly debugging and other "hacks". For that reason, heaps of CPU architectures include such an instruction.
For programs in RAM, NOP is used to "edit out" instructions, by overwriting the unwanted instruction(s) with one or more NOPs. This is a "quick patch" solution, since actually removing the byte from the code would imply re-compiling all code following the "deleted" instruction(s). Quite a lot of "cheat POKEs" for various games involving POKEing some addresses with the byte 234; the opcode for NOP.
In time-critical operations, such as raster bars, NOP instructions can prolong the execution time for a given snippet of code in increments of about two microseconds.
Undocumented NOP's[edit | edit source]
Of the 105 undocumented opcodes, there are six which seems to act as "duplicates" of the NOP; they are 26/$1A, 58/$3A, 90/$5A, 122/$7A, 218/$DA, and 250/$FA.
Addressing mode[edit | edit source]
Opcode | Addressing mode |
Assembler format |
Length in bytes |
Number of cycles | |
Dec | Hex | ||||
234 | EA | Implied | NOP | 1 | 2 |
NOP only supports the Implied addressing mode, as shown in the table at right.
CPU flags[edit | edit source]
NOP does not affect any of the CPU's status flags.