MGMT 1030 Lecture Notes - Lecture 22: Subroutine
![](https://new-preview-html.oneclass.com/aOyR3GWKrXY5QpV8qpOdjldMxEP7v8o0/bg1.png)
MGMT 1030 Lecture 22 Notes – Program Control Instructions
Introduction
• Rotate instructions take the bits as they exit and rotate them back into the other end of
the register.
• Some instructions sets include the carry or overflow bit as part of the rotation.
• Some CPUs also allow the rotation to take place between two registers.
• Rotate instructions can be used to exchange the 2 bytes of data in a 16-bit word, for
example, by rotating the word by 8 bits.
• Program control instructions control the flow of a program.
• Program control instructions include jumps and branches, both unconditional and
conditional, and also subroutine CALL and RETURN instructions.
• Various conditional tests are provided, including those with which you are already
familiar
• Branch on zero, branch on nonzero, branch on positive, branch on negative, branch on
carry, and so on.
• CALL instructions, sometimes known as JUMP SUBROUTINE instructions, are used to
implement subroutine, procedure and function calls.
• Thus, CALL instructions are important as a means to enable program modularization.
• From your programming experience, recall what happens when your program calls a
subroutine or procedure.
• The program jumps to the starting location of the subroutine and executes the code in
the subroutine.
• When the subroutine is completed, program execution returns to the calling program
and continues with the instruction following the call.
• The machine language CALL instruction works the same way.
• The bits as they exit and rotate them back into the other end of the register.
• Some instructions sets include the carry or overflow bit as part of the rotation.
• Some CPUs also allow the rotation to take place between two registers.
find more resources at oneclass.com
find more resources at oneclass.com