RETI与RET有什么区别?
的有关信息介绍如下:atmel公司的芯片手册关于RETI是这么说的
Description: RETI pops the high- and low-order bytes of the PC successively from the stack and restores the interrupt logic to accept additional interrupts at the same priority level as the one just processed. The Stack Pointer is left decremented by two. No other registers are effected; the PSW is not automatically restored to its pre-interrupt status. Program execution continues at the resulting address, which is generally the instruction immediately afte the point at which the interrupt request was detected. If a lower- or same-level interrupt was pending when the RETI instruction is executed, that one instruction is executed before the pending interrupt is processed.
而RET是这么说的
Description: RET pops the high- and low-order bytes of the PC successively from the stack, decrementing the Stack Pointer by two. Program execution continues at the resulting address, generally the instruction immediately following an ACALL or LCALL. No flags are affected.
举例说明:
假设SP为60H
MOV A,#12H
PUSH ACC ;SP=61H, 61H地址的内容为0x12
MOV A,#13H
PUSH ACC ;SP=62H, 62H地址中的内容为0x13
RET ;SP=60H, PC=0x1312;
完整的程序:可以在KEIL里面软件仿真看看结果
ORG 0000H
LJMP MAIN
ORG 0100H
MAIN:
MOV SP, #60H
MOV A, #12H
PUSH ACC
MOV A, #13H
PUSH ACC
RET
ORG 1312H
SJMP $ //原地跳转
END