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. This is available on-line in either html
or postscript format.
It is strongly recommended that you include one or both of these
references in your list of Web bookmarks.
Steps for this Lab:
-
Programs ~walker/assembly/prog1.c and
~walker/assembly/prog2.c each contain a linear search
procedure, written in C.
-
Copy these programs to your account.
-
Peruse, compile, and run the programs to check how they work.
-
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?
-
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,
-
Where are variables
item, elements and itemFound
stored?
-
Indicate where the local variable index and the parameters
number, dataArray and found are stored.
-
Outline which registers are used for what information when.
-
How are values computed for the
done variable, and how is
done tested in the code generated from the while
and if statements.
-
Next compile prog2.c to assembly language.
Annotate the portion of this assembly language program which comes from the
linearSearch procedure. That is,
-
Where are variables
item, elements and itemFound
declared?
-
Indicate where all local variables and parameters are stored.
-
Identify all assembly language instructions and macros in the listing.
-
Outline which registers are used for what information when.
Work to be turned in:
-
Commentary for step 1c.
-
Steps 2a, 2b, 3a, and 3b may be accomplished either in a written discussion
or with an appropriate diagram of memory.
-
Steps 2c and 3d require a few sentences. While not required, a diagram of
registers and their usage may expedite the discussion.
-
Step 2d may be accomplished either in a written discussion or using a code
listing which you annotate.
-
Write the annotations for Step 3c 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.fa99/labs/as-assembler.html
created September 30, 1997
last revised October 3, 1999