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:
-
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,
-
Indicate where the local variable Done and the parameters
Number, Info and Found are stored.
-
Outline which registers are used for what information when.
-
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,
-
Identify all assembly language instructions and macros in the listing.
-
Indicate where all local variables and parameters are stored.
-
Outline which registers are used for what information when.
Work to be turned in:
-
Steps 1a and 2b may be accomplished either in a written discussion or with
an appropriate diagram of memory.
-
Steps 1b and 2c require a few sentences. While not required, a diagram of
registers and their usage may expedite the discussion.
-
Write the annotations for Step 2a on the assembled listing. The
annotations may be either long hand or typed as comments.
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