This reader introduces the basics of ARM v7 assembly. The primary goal is to help students who already know how to program in a high level language learn about the form their programs take after compiling - the kinds of instructions a computer really processes information. These materials provide examples of basic ARM instructions, assembly programming constructs, and how high level languages constructs are represented in assembly.
Things this reader is NOT: a standalone course - it is a resource for a class; focused on “real” ARM programming - the goal is to understand how assembly works, not become a working assembly developer.
Assumed background knowledge:
High-level programming experience (preferably C++)
Boolean logic - AND / OR/ XOR
Samples will sometimes end with an infinite loop:
end: b end
This is provided to prevent the simulator from running invalid instructions or data. Often times, this will be omitted for brevity, in which case the simulator will report an error after attempting to run past the last instruction.
All code should start with:
.text @identifies this is code .global _start @declare _start symbol to be globally visible _start: @identify this location as entry point for the program
It is often omitted as the simulator will assume that it should start at the first line of code it encounters.
- 1. Basics
- 2. Memory
- 3. Bitwise Operations
- 4. Branches and Control Structures
- 5. Arrays and Strings
- 6. Functions and the Stack
- 6.1. The Stack
- 6.2. Pushing and Popping
- 6.3. Branch and Link
- 6.4. Calling Conventions
- 6.5. A Simple Function Call
- 6.6. A Smarter Function Call
- 6.7. Another Function
- 6.8. Nested Function Calls
- 6.9. Stack Frames
- 6.10. Using the Stack Frame
- 6.11. Using the Stack Frame - Continued
- 6.12. Final Calling Convention
- 7. Objects