next up previous contents index

[ENGN3213 Home]

Program Control

  Instructions for program control allows the processor to choose between different courses of action, depending on the outcome of a test.

For example, in the code

CMP.B #4,D3
BEQ LABEL
...
...
LABEL ...

the value of (D3[7:0]) is compared with 4 (i.e. (D3[7:0]) - 4 is evaluated), and if the result is true (i.e. (D3[7:0]) - 4 = 0000 0000), the Z flag is set, and when tested by BEQ, the program branches to the address LABEL and execution continues there.



ANU Engineering - ENGN3213