Laboratory Exercises For Computer Science 211

Introduction to Pentium Assembly Language

Goals: This laboratory provides an introduction to Pentium assembly language.

References: The following manuals may provide useful additional commentary for the elements of Pentium assembly langauge.

It is strongly recommended that you include some of these references in your list of Web bookmarks; pointers to the Instruction Set Reference and to Thiebau's Web site are particularly encouraged.

Steps for this Lab:

  1. Programs ~walker/assembly/prog1.c and ~walker/assembly/prog2.c each contain a linear search procedure, written in C.

    1. Copy these programs to your account.
    2. Peruse, compile, and run the programs to check how they work.
    3. Compare on any similarities or differences between these two programs:
      • How are constants declared?
      • Where are variables item, elements and itemFound declared?
      • How are data values read?
      • What parameters are used for procedures, and what is being passed (e.g., addresses or values)?
      • How is the linear search performed?
      • How is the found variable set?
  2. Compile prog1 to assembly code, using the command:

    
         gcc -S prog1.c
    
    This command will produce an assembly language program, stored in file prog1.s. Comment upon the general organization of data for the portion of this assembly language program which comes from the linearSearch procedure. In particular,

    1. Where are variables item, elements and itemFound stored?
    2. Indicate where the local variable index and the parameters number, dataArray and found are stored.
    3. Outline which registers are used for what information when.
    4. How are values computed for the done variable, and how is done tested in the code generated from the while and if statements.

  3. Next compile prog2.c to assembly language.

    Annotate the portion of this assembly language program which comes from the linearSearch procedure. That is,

    1. Where are variables item, elements and itemFound declared?
    2. Indicate where all local variables and parameters are stored.
    3. Identify all assembly language instructions and macros in the listing.
    4. Outline which registers are used for what information when.


Work to be turned in:


This document is available on the World Wide Web as

     http://www.cs.grinnell.edu/~walker/courses/211.fa01/labs/as-assembler.html

created September 30, 1997
last revised October 8, 2001
Valid HTML 3.2!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.