What is flow control? Give two examples of instructions that are used to accomplish it.
We know that sequential statements are executed line by line i.e in a sequential manner.
flow control defines how the statements/instructions are executed . flow control keeps track of all instructions flow.
example:
mov ax,5
mov bx,5
jmp label1:
mov cx,3
label1:
.....
....
In the above example, mov instructions are executed normally but jmp instruction causes the change in program flow , control will go to label1: (it is called unconditional jump), rather than executing mov cx,3.
Two example instructions are:
JC----> jump if carry
this instruction will change the control flow of program when carry flag (CF) is set to 1
JA-----> jump if above
ex: cmp ax,bx
ja label2
...
label2:
....
It is used with unsigned (positive) numbers.
The above instruction changes the control flow if first operand value is greater than second operand.
Get Answers For Free
Most questions answered within 1 hours.