© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
S. SmithRP2040 Assembly Language Programminghttps://doi.org/10.1007/978-1-4842-7753-9_5

5. How to Control Program Flow

Stephen Smith1  
(1)
Gibsons, BC, Canada
 

Now we know a handful of Assembly Language instructions and can execute them linearly one after the other. We built programs and debugged them. In this chapter, we’ll make our programs more interesting by using conditional logic—if/then/else statements, in high-level language. We will also introduce loops—for and while statements, in high-level languages. With these instructions in hand, we will have all the basics for coding program logic.

Unconditional Branch

The simplest branch instruction is
B label ...

Get RP2040 Assembly Language Programming: ARM Cortex-M0+ on the Raspberry Pi Pico now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.