Trap flag

A trap flag permits operation of a processor in single-step mode.

The contents of registers and memory locations can be examined; if they are correct, the system can be told to go on and execute the next instruction.

The Intel 8086 trap flag and type-1 interrupt response make it quite easy to implement a single-step feature in an 8086-based system.

If the trap flag is set, the 8086 will automatically do a type-1 interrupt after each instruction executes.

To reset the trap flag, simply replace the OR instruction in the preceding sequence with the instruction:The trap flag is reset when the 8086 does a type-1 interrupt, so the single-step mode will be disabled during the interrupt-service procedure.