首页 > 编程知识 正文

微机call指令,微机原理call指令

时间:2023-05-06 16:51:11 阅读:248991 作者:3852

call和ret指令

8086微处理器中的CALL指令 (The CALL instruction in the 8086 microprocessor)

The CALL instruction is used whenever we need to make a call to some procedure or a subprogram. Whenever a CALL is made, the following process takes place inside the microprocessor:

每当我们需要调用某些过程或子程序时,都会使用CALL指令 。 每当进行调用时 ,微处理器内部都会发生以下过​​程:

The address of the next instruction that exists in the caller program (after the program CALL instruction) is stored in the stack.

调用程序中存在的下一条指令的地址(在程序CALL指令之后)存储在堆栈中。

The instruction queue is emptied for accommodating the instructions of the procedure.

清空指令队列以容纳该过程的指令。

Then, the contents of the instruction pointer (IP) is changed with the address of the first instruction of the procedure.

然后,指令指针(IP)的内容随过程的第一条指令的地址而改变。

The subsequent instructions of the procedure are stored in the instruction queue for execution.

该过程的后续指令将存储在指令队列中以供执行。

The Syntax for the CALL instruction is as follows:

CALL指令的语法如下:

CALL subprogram_name 8086微处理器中的RET指令 (The RET instruction in the 8086 microprocessor)

The RET instruction stands for return. This instruction is used at the end of the procedures or the subprograms. This instruction transfers the execution to the caller program. Whenever the RET instruction is called, the following process takes place inside the microprocessor:

RET指令代表返回。 该指令在过程或子程序的末尾使用。 该指令将执行转移到调用程序。 每当调用RET指令时 ,微处理器内部都会发生以下过​​程:

The address of the next instruction in the mainline program which was previously stored inside the stack is now again fetched and is placed inside the instruction pointer (IP).

现在再次获取主线程序中先前存储在堆栈中的下一条指令的地址,并将其放置在指令指针(IP)中。

The instruction queue will now again be filled with the subsequent instructions of the mainline program.

现在,指令队列将再次充满主线程序的后续指令。

The Syntax for the RET instruction is as follows:

RET指令的语法如下:

RET

The following diagram illustrates how the control of the instruction execution is transferred within the code from one program to another whenever a procedure is called and whenever it returns the execution. In most of the cases, the procedure CALL is made from the mainline program and hence the control is returned to the mainline program itself.

下图说明了无论何时调用过程以及何时返回执行,如何在代码内将指令执行的控制权从一个程序转移到另一个程序。 在大多数情况下,过程CALL是从主线程序执行的,因此控件将返回给主线程序本身。

Note: The storing and fetching of the address inside and from the stack takes place in the same way as the data is pushed into it or popped form it.

注意:在内部和从堆栈中存储和获取地址的方式与将数据压入或弹出数据的方式相同。

翻译自: https://www.includehelp.com/embedded-system/the-call-and-ret-instruction-in-the-8086-microprocessor.aspx

call和ret指令

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。