本帖最后由 DianGongN 于 2011-12-22 16:34 编辑
今天用到c8051f120,查看datasheet中对clr ea指令的描述,说必须后跟2机器周期的指令,否则可能进入中断。
很奇怪,intel手册没有说过。
请高手分析为什么会这样?有什么方法可以验证?
原文如下:
Note: any instruction which clears the EA bit should be immediately followed by an instruction which has two or more opcode bytes. For example:
// in 'C':
EA = 0; // clear EA bit
EA = 0; // this is a dummy instruction with two-byte opcode
; in assembly:
CLR EA ; clear EA bit
CLR EA ; this is a dummy instruction with two-byte opcode
If an interrupt is posted during the execution phase of a "CLR EA" opcode (or any instruction which clears the EA bit), and the instruction is followed by a single-cycle instruction, the interrupt may be taken. If the EA bit is read inside the interrupt service routine, it will return a '0'. When the "CLR EA" opcode is followed by a multi-cycle instruction, the interrupt will not be taken. |