Laboratory Exercises For Computer Science 211

Introduction to HP Assembly Language

Introduction to HP Assembly Language

Goals: This laboratory provides an introduction to HP assembly language and allows for some comparisons between C and Pascal.

Resource: For this lab, you will want to refer to HP's manual, PA-RISC 1.1 Architecture and Instruction Set Reference Manual, Third Edition. It is strongly recommended that you include this reference in your list of Web bookmarks.

Steps for this Lab:

  1. Program ~/walker/assembly/prog1.p contains a linear search procedure, written in Pascal. Copy this program to your account, and compile it to assembly code, using the command:
    
         pc -S prog1.p
    
    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 Linear Search procedure. In particular,

    1. Indicate where the local variable Done and the parameters Number, Info and Found are stored.
    2. Outline which registers are used for what information when.

  2. Now, consider the the optimized C code, based on this Pascal program, which you wrote for the recent assignment. Compile it to assembly code, using the command:
    
         gcc -S filename.c
    
    Annotate the portion of this assembly language program which comes from the Linear Search procedure. That is,

    1. Identify all assembly language instructions and macros in the listing.
    2. Indicate where all local variables and parameters are stored.
    3. 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.math.grin.edu/~walker/courses/211/labs/as-assembler.html

created September 30, 1997
last revised October 1, 1997