© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
J. BartlettLearn to Program with Assemblyhttps://doi.org/10.1007/978-1-4842-7437-8_5

5. Comparison, Branching, and Looping

Jonathan Bartlett1  
(1)
Tulsa, OK, USA
 

In this chapter, we are going to look at how the computer makes comparisons and decisions.

5.1 The %rip Register and the jmp Instruction

In Chapter 4, we learned about the general-purpose registers. These registers are general purpose because they can be used for most arithmetic instructions. However, there are a few registers which are not usable in this way, but have a specific function that is maintained by the CPU itself. These are the special-purpose registers .

The first register I want to talk ...

Get Learn to Program with Assembly: Foundational Learning for New Programmers 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.