微程序与微指令和微命令_8086微处理器中的程序

微程序与微指令和微命令

In a program, we very frequently face situations where there is a need to perform the same set of task again and again. So, for that instead of writing the same sequence of instructions, again and again, they are written separately in a subprogram. This subprogram is called a procedure. With the help of procedures, we can very well implement the concept of modular programming in our code. Also, whenever we need to execute the instructions mentioned in the procedure, we can simply make a CALL to it. Therefore, with the help of procedures, the duplicity in the instructions can be avoided.

在程序中,我们经常遇到需要一次又一次地执行同一组任务的情况。 因此,为此,它们不必一遍又一遍地编写相同的指令序列,而是将它们分别编写在子程序中。 该子程序称为过程。 借助过程,我们可以很好地在代码中实现模块化编程的概念。 另外,只要需要执行该过程中提到的指令,就可以对其进行调用。 因此,借助程序,可以避免指令中的重复。

The Syntax for a procedure is as follows:

过程的语法如下:

    Procedure_name PROC  [near / far]
        Instruction 1
        Instruction 2
        - - - - - - - - - - -
        - - - - - - - - - - -
        Instruction n
    Procedure_name ENDP

Here, the PROC is a keyword to define that the set of instructions enclosed by the given name is a procedure. It is used in the starting instruction whenever we define a procedure. The ENDP keyword defines that the body of the procedure has been ended. All the instructions lying between these two keywords are the instructions that belong to the procedure and will be executed whenever a CALL to the procedure is made. The keyword near or far defines the range of code within which the procedure is defined. If it is defined in the same segment as the rest code, then near is used. If it is defined in some other segment, then the keyword far is used for it.

在此, PROC是关键字,用于定义由给定名称围起来的指令集是一个过程。 每当我们定义一个过程时,它就会在开始指令中使用。 ENDP关键字定义该过程的主体已结束。 位于这两个关键字之间的所有指令都是属于该过程的指令,并且在对过程进行CALL调用时将被执行。 关键字near或far定义了定义过程的代码范围。 如果将其与其余代码定义在同一段中,则使用near。 如果在其他段中定义了关键字,则使用关键字far。

The CALL to a procedure can be made in the following way,

可以通过以下方式进行CALL调用:

    CALL procedure_name

At the end of the procedure, the RET instruction is used. This instruction will cause the execution to be transferred to the program from which the call to the procedure was made.

在该过程结束时,将使用RET指令。 该指令将导致执行转移到调用该过程的程序中。

翻译自: https://www.includehelp.com/embedded-system/procedures-in-the-8086-microprocessor.aspx

微程序与微指令和微命令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值