Tiva Lab 01: Getting Started with ARM Assembly Language Programming



  • Learn how to control the execution flow by using the conditional flags
  • Learn how to access array and/or structure data in the memory.

Required Reading Material


Background Information

High-level computer programming languages have a level of abstraction between the code and the processor. The abstraction means that the programmer never has to worry about the details of the computer, and this also allows programmer to write code that could run on various different processors. All the high-level programming language need to be converted into assembly language and then into machine code. The executable code in high level language is huge, and hence it sometimes not efficient. This means that if performance is critical, the programmer might have to write their code differently.

The best way of getting the performance is by understanding how the machine works so that the programmer can do large architectural transformations that a compiler can't easily. Assembly language is a really good way of learning these performance in details, since it helps programmers understand practical concepts of computer such as what a registry is and how it is used. Assembly language uses a symbolic designation of programming elements instead of machine code, so it is considered to be a low-level language, compare with other transitional computer languages such as C and Java.

One advantage of assembly language programming has to do with its use in increasing the running speed of programs. Should an algorithm be optimally complex, we can choose to write instructions using assembly language in order to achieve faster execution times.

Assembly language is not without its disadvantages. It is not portable, meaning an application written for an PC would not run on an ARM devices. In addition, a program in assembly language is more difficult to write and takes more time than a program written in C or other high-level language.

Assembly is still using for some key tasks, e.g.

  • Hardware specific code, such as device drivers, boot-loader, BIOS ...
  • Embedded devices, Real-time system where size of code and performance are important
  • Low level code where performance is critical etc.





Part-I. Loop

Write ARM assembly code to calculate sum of numbers from 1 to 100 (R0 = 1 + 2 + 3 + ... + 100 = 5050 = 0x13BA) using the following flowcharts:

Assembly Code 1-1: Counting up with while-loop.

Assembly Code 1-2: Counting up with do-while loop.
Assembly Code 1-3: Counting down with do-while loop

You need to submit one assembly code for each flowchart. Total you will create three assembly code.

 Part-II. Accessing Arrays

Using assembly code to calculate the sum, average value, find the maximum and minimum value in array A[10], which is already predefined the initial value.