< X86 Disassembly

Example: Hello World Listing

Write a simple "Hello World" program using C or C++ and your favorite compiler. Generate a listing file from the compiler. Does the code look the way you expect it to? Do you understand what the assembly code means?

Here are examples of C and C++ "Hello World!" programs.

#include <stdio.h>

int main()
{
  printf("Hello World!\n");
  return 0;
}
#include <iostream>

int main()
{
  std::cout << "Hello World!\n";
  return 0;
}

Example: Basic Disassembly

Write a basic "Hello World!" program (see the example above). Compile the program into an executable with your favorite compiler, then disassemble it. How big is the disassembled code file? How does it compare to the code from the listing file you generated? Can you explain why the file is this size?

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.