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

19. Console I/O

Jo Van Hoey1 
(1)
Hamme, Belgium
 

We already know how to do console output using system calls or using printf. In this chapter, we will again use system calls, not only for display on the screen but also for accepting input from the keyboard.

Working with I/O

We could easily borrow functions from the C library, but that would spoil the assembly fun! So, Listing 19-1 shows the example source code.
; console1.asm
section .data
      msg1       db    "Hello, World!",10,0
      msg1len    equ   $-msg1
      msg2       db    "Your turn: ",0
      msg2len    equ   $-msg2
      msg3       db    "You answered: ",0
      msg3len    equ   $-msg3 ...

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.