
All of these structures are available to the assembly language programmer, but he has to be more explicit about his intentions. ELSE.), and a multi-way decision based on some value ( ON. Extensions of this are the ability to take two separate, mutually exclusive paths ( IF. The second type of control flow is decision: the ability to execute a sequence of instructions only if a certain condition holds (e.g.
#Arm assembly readwrite Pc#
On the ARM, this action is a consequence of the PC being incremented after each instruction, unless it is changed explicitly. The three important types of control structure that have been identified are: the sequence, iteration, and decision.Īn instruction sequence is simply the act of executing instructions one after another in the order in which they appear in the program. Down at the assembly language level, subroutines perform the same function.įlow of control in a program is the order in which the instructions are executed. In high-level languages such as BASIC and Pascal, the procedure mechanism allows the practical decomposition of programs into smaller, more manageable units. When combined, these units, or sub-programs, form a solution to the problem as a whole. The composition of a program relates to how it is split into smaller units which solve a particular part of the problem. Two of the most important are program decomposition and flow of control. Any such solution, or algorithm, may be expressed in terms of a few fundamental concepts.

It illustrates with examples how the programming techniques that you use when writing in a high-level language translate into assembler.Ī program is made up of instructions which implement the solution to a problem. Since we are assuming you can program in BASIC, most of this chapter can be viewed as a conversion course. Now we are in a position to start programming properly.

The previous chapters have covered the ARM instruction set, and using the ARM assembler. ARM Assembly Language Programming - Chapter 5 - Assembly Programming Principles
