CO Lab Manual
Course Page
  • Course Information
    • Welcome
    • Introduction
    • Your Contributions
    • Lab Sessions and Etiquette
    • Team Setup
    • Assumed Prior Knowledge
  • Setup Guides
    • GitHub Repository Setup
    • Technical Setup
      • Windows
      • Linux
      • macOS
    • GitHub SSH Setup
    • Framework Setup
  • Reference Documentation
    • Introduction to the Documentation
    • A Brief History Lesson
    • Syntax (Intel vs. AT&T)
      • Section Exercises
    • Memory
      • Memory Management
      • Section Exercises
    • Registers
      • Section Exercises
    • Instructions
    • Subroutines
      • Calling Subroutines
      • Writing Subroutines
      • Section Exercises
    • Input/Output
      • Printing to the Terminal
      • Reading from the Terminal
      • Section Exercises
    • Programming Constructs
    • Assembler Directives
    • C/C++ vs Assembly
    • Building and Running Programs
    • Address Sanitization
    • A0: A Running Example
  • Assignments
    • Introduction to the Assignments
    • Mandatory Assignments
      • A1: Subroutines and I/O
      • A2: Recursion
    • Extra Assignments
      • A3-a: Fibonacci Calculator
      • A3-b: Fibonacci REPL
      • A4: Diff
      • A5: Printf
      • A6: HPC
      • A7: Bitmap
      • A8: Game
  • Appendix
    • Acknowledgments
    • Rules and Regulations
    • Frequently Asked Questions
    • How to use a Debugger
Powered by GitBook
On this page
  1. Reference Documentation

Input/Output

Doing I/O may be quite tricky, even more so in Assembly. Normal processes do not have permission to access the hardware I/O devices directly, so the input and output must be handled by the operating system. Instructing the operating system to do so is typically done through so-called system calls, that hand control over to the kernel until the action is performed.

However, as you may have guessed, different operating systems have different ways of... well... operating. Luckily, the C Standard Library is available on essentially any major operating system you might run on your device and it offers abstractions for I/O that hide the underlying system calls. Furthermore, the functions of the C Standard Library (like printf and scanf) come with many niceties, like ASCII-to-integer (or vise versa) conversions.

PreviousSection ExercisesNextPrinting to the Terminal

Last updated 8 months ago