Exercises

1:

Extend the SQUARES program in Chapter 1 in order to compute a list of values of one of the following polynomials for integer values of N from 1 through 9, again without using explicit multiplication instructions. Hint: Use a repeat block.

  1. N 2 + N

  2. 2 N2 + 1

  3. N2 + N + 2

Store the function values in memory locations. Use an examine command of the debugger to inspect the results.

2:

Use a repeat block to construct a data section containing 25 instances of a record structure that provides five quad words for a part number, a quantity, a cost, a selling price, and a net profit, and then 40 bytes for a description. Note that the resulting memory region comprises an array with one row per part and six columns for the specified fields of information.

3:

Use a repeat block with .irp to construct a data section containing five successive 25-element vectors labeled NUMBER, COUNT, COST, PRICE, and PROFIT. Then allocate a space at label NAME for 25 strings of 40 bytes in length. Draw a sketch that shows how this data region differs from the one that would result from exercise 2 above.

4:

Explain how the macro

 .macro      loadit         FROM,TO,LENGTH=8             ld\LENGTH      \TO,[\FROM] .endm 

will expand in the following cases of invocation:

  1. loadit r14, r15, 4

  2. loadit r14, r15

  3. loadit r14, r15, 1

5:

Write simple macros for swapping integers, as follows:

  1. Macro SWAP assumes that the two register parameters contain the quad word data.

  2. Macro SWAPI (swap indirect) assumes that the two register parameters point to the quad word data.

6:

Write out all the lines needed to alter USDOLLARS appropriately for:

  1. up to 1999 UK pounds

  2. up to 1999 Euros in French

  3. up to 1999 Euros in German

  4. up to 1999 units of some other country's currency

7:

Develop an algorithm, a data structure, and a macro that would support the writing of numbers as Roman numerals.



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