© Jo Van Hoey 2019
J. Van HoeyBeginning x64 Assembly Programminghttps://doi.org/10.1007/978-1-4842-5076-1_4

4. Your Next Program: Alive and Kicking!

Jo Van Hoey1 
(1)
Hamme, Belgium
 

Now that you have a firm grasp of GDB and know what an assembly program looks like, let’s add some complexity. In this chapter, we will show how to obtain the length of a string variable. We will show how to print integer and floating-point values using printf. And we will expand your knowledge of GDB commands.

Listing 4-1 contains the example code that we will use to show how we can find the length of a string and how numeric values are stored in memory.
;alive.asm
section .data
      msg1   db    "Hello, World!",10,0       ; string with NL and 0
      msg1Len      equ    $-msg1-1     ; ...

Get Beginning x64 Assembly Programming: From Novice to AVX Professional 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.