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
  • True or False
  • Multiple Choice
  1. Reference Documentation
  2. Registers

Section Exercises

True or False

rax register is used for storing the return value of a subroutine.

True!

rdx is usually used to store the fourth argument and it is commonly used as loop counter.

False!

rdx is storing the third argument, while rcx is storing the fourth argument and is commonly used as a loop counter.

rdi, rsi, and rdx are caller-saved registers.

True!

ax, di, si, and dx store 8 bits.

False!

ax, di, si, and dx store 16 bits.

Any register starting with letter r (e.g. rax, rbx, rdi) indicates that it stores 64 bits.

True!

Registers are the fastest and smallest unit of storage available to the CPU.

True!

Although they are the fastest, they are the most expensive. Because of this, the CPU has a limited number of registers, some of which are designed for specific functionality. To review the memory hierarchy, see the Memory section.

Multiple Choice

How many bytes can be stored in esi?

1 byte

Wrong!

2 bytes

Wrong!

4 bytes

Correct!

8 bytes

Wrong!

Which registers are used to store the first three arguments of a function? (Specify in order)

rsi, rdi, rdx

Wrong!

rdi stores the first argument while rsi stores the second.

rsi, rdx, rcx

Wrong!

rsi stores the second argument, rdx the third and rcx the fourth.

rdi, rsi, rdx

Correct!

rdi, rsi, rbx

Wrong!

The third argument is stored in rdx. rbx can optionally be used as base pointer, but not to store the third argument of a function.

PreviousRegistersNextInstructions

Last updated 4 months ago