Exercises

1:

What is meant by a programming environment?

2:

Give an example of a simple statement in a high-level language and its assembly language equivalent.

3:

What are the meanings of the special symbols such as ":" and ";" or "/" used in writing an assembly language statement?

4:

Point out the specific aspects of SQUARES that you think would need to be modified in order to use double word instead of quad word storage.

5:

What are the advantages of equating a value to a symbol that can be used throughout a program?

6:

Write the syntax for specifying the value 42 using several radix values for an Itanium assembler for the programming environment that you are using.

7:

Some assemblers support a user-defined symbol table for registers.

  1. Find out whether your Itanium assembler will permit a declaration of the form diff1 = r21 as well as the substitution of diff1 everywhere that r21 occurs in SQUARES. What would be the advantage of doing this? How should the comment fields be altered to match?

  2. If your assembler does indeed support user-defined symbols for register names, find out whether your symbolic debugger also supports displaying the value contained in diff1, or whether the register name r21 still has to be specified to do that. Assess the consequences of your combined investigation on both parts of this exercise.

8:

What hexadecimal numbers are stored in memory for the following statement, using your assembler?

 data1      156, 128, 3, 0x29, 0123, 3+5/4 
9:

If the symbols PAR1 and PAR2 have been equated to 7 and 9, respectively, how will the expression 8*PAR1 PAR2/3 be evaluated by the assembler in your programming environment?

10:

Show what will be stored where in memory if the following lines are assembled in the order shown. Assume that here is at location 30000 (hexadecimal). List all symbols defined by these directives, their values, and whether they are absolute or relative.

 here:   .quad    102 there   =        104 this:   .quad    12, 34 thing   =        200 
11:

Determine whether any permutations of two or three unary arithmetic and logical operators out of the set { , ~, 0x} applied to the number 10 are valid. For example, is 0x~ acceptable to your assembler? Do parentheses help at all? Summarize your findings, including a statement about precedence.

12:

How many no-operation instructions has the GNU assembler introduced into SQUARES (Figure 3-2)?

13:

Why do assemblers typically make two straight-through passes, instead of moving back and forth within the text of an assembly language source program in order to resolve the values of symbols that are referenced at an earlier point than where they are actually defined?

14:

Explain why a linker program must usually make two passes through all of the object files that are brought together into one executable program.

15:

Draw a sketch (perhaps using jagged lines to indicate missing regions) for the assignment of Itanium virtual addresses to the programmer's data locations and instruction sequence in SQUARES, using information from the listing file, nm command, and/or your own explorations using the debugger.

16:

Adapt the program SQUARES to compute the cubes of the first five integers without using any explicit multiplication. Hint: An algorithm for N 3 can be discovered by writing down the series 1, 8, 27, 64, … and then inspecting the pattern of first, second, and third tabular differences. Test using the debugger.

17:

Extend the assembly language SQUARES program in order to compute a list of values of one of the following polynomials for integer values of N from 1 through 5, again without using explicit multiplication instructions:

  1. N 2 + N

  2. 2 N 2 + 1

  3. N 2 + N + 2



ItaniumR Architecture for Programmers. Understanding 64-Bit Processors and EPIC Principles
ItaniumR Architecture for Programmers. Understanding 64-Bit Processors and EPIC Principles
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net