NOP takes one byte and changes nothing but IP, which moves to the next instruction. Its opcode, 90h, is the encoding of XCHG AX, AX: the 8086 has one-byte forms 90h to 97h for XCHG AX, reg, and swapping AX with itself is the do-nothing case. No flags change.
Uses
Padding: making the next instruction or a table start at an even address, which lets the 8086 fetch words in one bus cycle. MASM's EVEN and ALIGN directives fill such gaps in code with do-nothing bytes.
Patch space: overwriting an instruction with NOPs removes it without moving anything else, a common way to disable a check in a binary. Leaving a few NOPs in code reserves room to add a call later.
Debugging: a NOP is a harmless place to put a breakpoint, or a marker you can find in a memory dump.
Timing: a short fixed delay for slow hardware between two OUTs. Such loops depend on the CPU speed, so they break on faster machines; prefer waiting on a status bit or the timer.
BEFORE1:NOPNOPNOP ; three bytes of nothingAFTER1:MOV AL, AFTER1 - BEFORE1 ; the distance: 3ADD AL, '0' ; digit -> characterMOV DL, ALMOV AH, 02h ; DOS: print DLINT 21h
Other instructions can serve as longer do-nothings, such as MOV AX, AX (two bytes), but only 90h is the official NOP.
Later CPUs: the Pentium Pro adds a multi-byte NOP (0Fh 1Fh) for padding, and PAUSE, written F3h 90h (REP NOP), is a hint for spin-wait loops; older processors run it as a plain NOP.