Assembly language-single step interrupt

      After the CPU has executed an instruction, if it detects that the TF bit of the flag register is 1, it will generate a single-step interrupt, triggering the interrupt process. The interrupt type code of single step interrupt is 1

How does Debug use the single-step interrupt function provided by the CPU for debugging? For example, use the t command to view the register status

Debug provides an interrupt handler for single-step interrupts, whose function is to wait for input commands after displaying the contents of all registers

When using the t command to execute an instruction, Debug sets TF to 1. After the CPU finishes executing this instruction, a single-step interrupt is triggered, and the interrupt handler of the single-step interrupt is executed. The contents of all registers are displayed on the screen, and Waiting for input command.

Before entering the interrupt handler, set TF=0. So as to avoid the single-step interrupt when the CPU is executing the interrupt handler

 

Reference: <<Assembly Language>> Wang Shuang

Guess you like

Origin blog.csdn.net/ma2595162349/article/details/108543554