Within programming languages, control structures are one of the most useful features. They allow us to say things such as the following:
If this action happens then do this, otherwise do this
Keep doing this until some condition is met
The most common control structures you may be familiar with are the if
and else
statements.
As with C and Python, we can implement a control structure like this in Assembly language.
Also included in control structures are loops. You may have seen these in the format of the for
loop and while
loop.
The following program demonstrates how we can implement iteration via loops and if else
structures in Assembly language via branching.
We will be building upon our previous program where we introduced you to the SUB
command, and will also explore some new commands including CMP
and BLT
.
Create a new file called fourth_assem_prog.s
in the assem_programs
directory.
To this file we are now going to add the following code:
.data...